[FFmpeg-user] Frames in a stream

Nicholas Robbins nickrobbins at yahoo.com
Sun Jan 3 18:26:03 CET 2016


I have been using the following to get a count of the frames in video:

PROBE=`/usr/bin/ffprobe -select_streams v -show_streams -count_frames -i ${VIDEO} 2>&1`
FC=`/bin/echo "$PROBE" | /bin/grep nb_read_frames | /usr/bin/cut -d"=" -f2`

Recently I noticed that my regular ffmpeg/ffprobe invocations now have a more extensive metadata section, including, for instance:

...
Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 32:27 DAR 16:9], max. 7500 kb/s, SAR 186:157 DAR 279:157, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Metadata:
BPS-eng         : 549782
DURATION-eng    : 02:00:22.515300000
NUMBER_OF_FRAMES-eng: 173168
...

For the sample I've tested, these two methods agree. 

My question is, where is the NUMBER_OF_FRAMES-eng obtained? Is it accurate?

For instance, note that this video is labeled as 29.97 fps, but quick arithmetic gives 23.976 fps as the actual frame rate. Transcoding with output option -r 24000/1001 produced no dropped frames.

Thanks,

Nick


More information about the ffmpeg-user mailing list