FFMPEG video from images comes out same (yet incorrect) duration regardless of frame rate
When creating a video from an image sequence using ffmpeg, I'm finding that I get a same length video whether encoding it as 30fps or 60fps. Given, in my current case, 6329 image files, the following two commands produce video files of the same length:
1. ffmpeg -pattern_type glob -i '*.png' -r 30 -pix_fmt yuv420p out-30fps.mp4
2. ffmpeg -pattern_type glob -i '*.png' -r 60 -pix_fmt yuv420p out-60fps.mp4
With the above, ffprobe shows video 1 is 00:04:13.17 and encoded at 30fps, while video 2 is 00:04:13.15 and encoded at 60fps. When loaded into Quicktime Player, both videos have the same length and speed.
So, two questions:
I'm confused by the total video duration, as 4m13s is a total of 253 seconds. At 30fps, 253 seconds should require 7590 frames, not 6329.
What is required to use the existing frame sequence as if it's 60fps source instead of 30? Or, put another way, how to make the final video have twice as many frames/second during playback?
Solution 1:
For image sequences, ffmpeg assumes the input stream has a framerate of 25 if not specified otherwise. So, use
ffmpeg -pattern_type glob -framerate 60 -i '*.png' -r 60 -pix_fmt yuv420p out-60fps.mp4
What -r 60
as an output option does is create a 60 fps constant frame rate stream. If the input stream has a different rate, it will duplicate or drop frames to meet this rate.