Reputation: 91
ffmpeg version 3.4.8-0ubuntu0.2 Copyright (c) 2000-2020 the FFmpeg developers
No matter what I do, ffmpeg just ignores everything and encodes it as if it's 25fps.
-framerate 60
does nothing
-t 60
does nothing
-r 60
makes it to interpolate frames
-r:v 60
does the same
-vf "fps=60"
does the same
-vframes <actual number of frames>
makes it to end the encoding prematurely
Everything google shows seems to be outdated, including ffmpegs own documentation
Upvotes: 5
Views: 7856
Reputation: 67
If you convert image to video, and specify 120fps. You need to put "-framerate 120" before "-i input".
correct:
ffmpeg -framerate 120 -i input%06d.jpg -pix_fmt yuv420p out.mp4
incorrect:
ffmpeg -i input%06d.jpg -pix_fmt yuv420p -framerate 120 out.mp4
ffmpeg -i input%06d.jpg -pix_fmt yuv420p -r 120 out.mp4
ffmpeg -i input%06d.jpg -pix_fmt yuv420p -framerate 120 -r 120 out.mp4
In this command ffmpeg -i input%06d.jpg -pix_fmt yuv420p -r 120 out.mp4
,it's meaning: first create a video from images and use 25fps(defaut), second convert the 25fps video to 120fps(video speed not change, but per frame change to more same frames).
So if you want to let images convert to 120fps video, you must use this:ffmpeg -framerate 120 -i input%06d.jpg -pix_fmt yuv420p out.mp4
Upvotes: 0
Reputation: 998
I had a similar issue. I'm using ffmpeg 3.4.2, trying to compile a set of PNGs into a video at 60 fps. What worked in the end is this:
ffmpeg -framerate 60 -i 'foo-%05d.png' -r 60 -c:a aac -vcodec libx264 -vf format=yuv420p foo.mp4
As others have noted above, it's the -framerate 60
that made the difference. Note that the order of the flags on the command line matters.
It's not clear from the man page why -framerate
would change the behavior, and unfortunately, the option is not documented there beyond this reference:
-r[:stream_specifier] fps (input/output,per-stream)
Set frame rate (Hz value, fraction or abbreviation).
As an input option, ignore any timestamps stored in the file and instead generate timestamps
assuming constant frame rate fps. This is not the same as the -framerate option used for some
input formats like image2 or v4l2 (it used to be the same in older versions of FFmpeg). If in
doubt use -framerate instead of the input option -r.
Upvotes: 4
Reputation: 91
The solution is:
ffmpeg -framerate <framerate> -start_number <number> -i ./<name>%d.png -r <framerate> -c:v <encoder name> -r <framerate> -crf <value> -preset <preset name> <output file name> -async 1 -vsync 1
example:
ffmpeg -framerate 60 -start_number 225 -i ./render_%d.png -r 60 -c:v libx264 -r 60 -crf 10 -preset veryslow render4k.mp4 -async 1 -vsync 1
Upvotes: 1