10000 Force frame rate of FFMpegFileWriter input by auneri · Pull Request #5453 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

Force frame rate of FFMpegFileWriter input #5453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 11, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
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.
  • Loading branch information
auneri committed Nov 9, 2015
commit f0fbadba84128330c742b5a8131a8773d8ae9dc2
2 changes: 1 addition & 1 deletion lib/matplotlib/animation.py
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,7 @@ class FFMpegFileWriter(FileMovieWriter, FFMpegBase):
def _args(self):
# Returns the command line parameters for subprocess to use
# ffmpeg to create a movie using a collection of temp images
return [self.bin_path(), '-i', self._base_temp_name(),
return [self.bin_path(), '-r', str(self.fps), '-i', self._base_temp_name(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line is now too long.

'-vframes', str(self._frame_counter),
'-r', str(self.fps)] + self.output_args
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait-a-minute... this argument is already in the list. Maybe the issue is where it is positioned?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you closely read the link in the original post, you'll see that the first -r controls the rate for the raw input, while the second -r controls the rate for the output. Blame the ffmpeg guys for their command-line syntax.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, yes. And I looked back at the man-page on my CentOS6 system, and I can confirm that it describes that very behavior.


Expand Down
0