@@ -628,15 +628,28 @@ class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
628
628
Frames are written to temporary files on disk and then stitched
629
629
together at the end.
630
630
"""
631
- supported_formats = ['png' , 'jpeg' , 'ppm' , 'tiff' , 'sgi' , 'bmp' ,
632
- 'pbm' , 'raw' , 'rgba' ]
631
+ supported_formats = ['png' , 'jpeg' , 'tiff' , 'raw' , 'rgba' ]
633
632
634
633
def _args (self ):
635
634
# Returns the command line parameters for subprocess to use
636
635
# ffmpeg to create a movie using a collection of temp images
637
- return [self .bin_path (), '-r' , str (self .fps ),
638
- '-i' , self ._base_temp_name (),
639
- '-vframes' , str (self ._frame_counter )] + self .output_args
636
+ args = []
637
+ # For raw frames, we need to explicitly tell ffmpeg the metadata.
638
+ if self .frame_format in {'raw' , 'rgba' }:
639
+ args += [
640
+ '-f' , 'image2' , '-vcodec' , 'rawvideo' ,
641
+ '-video_size' , '%dx%d' % self .frame_size ,
642
+ '-pixel_format' , 'rgba' ,
643
+ '-framerate' , str (self .fps ),
644
+ ]
645
+ args += ['-r' , str (self .fps ), '-i' , self ._base_temp_name (),
646
+ '-vframes' , str (self ._frame_counter )]
647
+ # Logging is quieted because subprocess.PIPE has limited buffer size.
648
+ # If you have a lot of frames in your animation and set logging to
649
+ # DEBUG, you will have a buffer overrun.
650
+ if _log .getEffectiveLevel () > logging .DEBUG :
651
+ args += ['-loglevel' , 'error' ]
652
+ return [self .bin_path (), * args , * self .output_args ]
640
653
641
654
642
655
# Base class of avconv information. AVConv has identical arguments to FFMpeg.
@@ -745,8 +758,7 @@ class ImageMagickFileWriter(ImageMagickBase, FileMovieWriter):
745
758
together at the end.
746
759
"""
747
760
748
- supported_formats = ['png' , 'jpeg' , 'ppm' , 'tiff' , 'sgi' , 'bmp' ,
749
- 'pbm' , 'raw' , 'rgba' ]
761
+ supported_formats = ['png' , 'jpeg' , 'tiff' , 'raw' , 'rgba' ]
750
762
751
763
def _args (self ):
752
764
# Force format: ImageMagick does not recognize 'raw'.
0 commit comments