Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 97a2b36

Browse filesBrowse files
committed
Support raw/rgba frame format in FFMpegFileWriter.
1 parent 755fc9e commit 97a2b36
Copy full SHA for 97a2b36

File tree

Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+12
-4
lines changed

‎lib/matplotlib/animation.py

Copy file name to clipboardExpand all lines: lib/matplotlib/animation.py
+12-4Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -634,15 +634,23 @@ class FFMpegFileWriter(FFMpegBase, FileMovieWriter):
634634
def _args(self):
635635
# Returns the command line parameters for subprocess to use
636636
# ffmpeg to create a movie using a collection of temp images
637-
args = [self.bin_path(), '-r', str(self.fps),
638-
'-i', self._base_temp_name(),
639-
'-vframes', str(self._frame_counter)]
637+
args = []
638+
# For raw frames, we need to explicitly tell ffmpeg the metadata.
639+
if self.frame_format in {'raw', 'rgba'}:
640+
args += [
641+
'-f', 'image2', '-vcodec', 'rawvideo',
642+
'-video_size', '%dx%d' % self.frame_size,
643+
'-pixel_format', 'rgba',
644+
'-framerate', str(self.fps),
645+
]
646+
args += ['-r', str(self.fps), '-i', self._base_temp_name(),
647+
'-vframes', str(self._frame_counter)]
640648
# Logging is quieted because subprocess.PIPE has limited buffer size.
641649
# If you have a lot of frames in your animation and set logging to
642650
# DEBUG, you will have a buffer overrun.
643651
if _log.getEffectiveLevel() > logging.DEBUG:
644652
args += ['-loglevel', 'error']
645-
return [*args, *self.output_args]
653+
return [self.bin_path(), *args, *self.output_args]
646654

647655

648656
# Base class of avconv information. AVConv has identical arguments to FFMpeg.

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.