Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f0fbadb

Browse files
committed
Force frame rate of FFMpegFileWriter input
The output video file was observed to skip frames, when input frame rate does not match output (e.g., when fps=1, or interval=1000). See https://www.ffmpeg.org/ffmpeg.html#Description for a description of the solution.
1 parent 838502e commit f0fbadb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/matplotlib/animation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ class FFMpegFileWriter(FileMovieWriter, FFMpegBase):
446446
def _args(self):
447447
# Returns the command line parameters for subprocess to use
448448
# ffmpeg to create a movie using a collection of temp images
449-
return [self.bin_path(), '-i', self._base_temp_name(),
449+
return [self.bin_path(), '-r', str(self.fps), '-i', self._base_temp_name(),
450450
'-vframes', str(self._frame_counter),
451451
'-r', str(self.fps)] + self.output_args
452452

0 commit comments

Comments
 (0)