[FFmpeg-user] Why Does ffprobe Report an Incorrect Number of Frames?

Tom Evans tevans.uk at googlemail.com
Thu May 8 13:43:09 CEST 2014

On Thu, May 8, 2014 at 1:59 AM, John G <skeeve99 at yahoo.com.au> wrote:
> ...which is the correct frame count.
> So, to use ffprobe successfully, it seems that I might need to convert all the videos (!!!) into a format that ffmprobe "likes"!?

Your video is probably VFR - variable frame rate. Converting it to CFR
- constant frame rate - results in a video that has num_seconds *
frames_per_second frames.

Your original video, being VFR, the only way you can work out how many
frames there are is to decode every single frame.

ffprobe is a probe command, and so it inspects a small amount of the
file and guesses how many frames there are. If you want to know
precisely how many frames there are in a VFR file, use

  ffprobe -select_streams v -count_frames -show_entries
stream=nb_read_frames input.ext

to determine the number of frames.

This command:

  ffmpeg -i sample.avi -c:v mpeg4 -q:v 2.0     new.mpg

is converting your VFR video to CFR. If you do as Carl suggested, and
insert the option "-vsync 0" (and probably "-an", to disable audio),
then ffmpeg will still create a CFR video (MPEG2 is always CFR), but
with exactly one output frame for every input frame.

You will then see that there are not 6999 frames in the source.



More information about the ffmpeg-user mailing list