Why total frame count is different in ffmpeg than ffprobe?
I wanted total frame count of video so that i use below ffprobe command :
ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -of default=noprint_wrappers=1 100P.mp4
and i get output below
in above output i get 559 frames
then i use same video to add watermark on it and i use below command:
ffmpeg -i 100P.mp4 -i mt.png -filter_complex "overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2" -codec:a copy -preset ultrafast output.mp4
i get output like this:
and in above image, after adding watermark i get 605 frames
so my question is why i am getting different frame count in ffmpeg and ffprobe?
FFmpeg, by default, sets constant frame rate mode for MP4 output. When the input stream is VFR, ffmpeg will duplicate or drop frames to generate a CFR stream. In the output stats, to the right of frame=605
, you can see dup=46
, which indicates that ffmpeg added 46 duplicated frames. The short version is this happens when two input frames are further apart than 1/FPS
seconds, where FPS represents the output frame rate. The output frame rate is set to the detected input framerate (the tbr
value), if not expressly set by the user.
Add -vsync vfr
to prevent frame duplication.