3

I have a small video file which ffprobe describes as:-

Input #0, avi, from 'sample.avi': 
Metadata: 
encoder : Lavf55.12.100 
Duration: 00:00:35.00, start: 0.000000, bitrate: 546 kb/s 
Stream #0:0: Video: msmpeg4v3 (MP43 / 0x3334504D), yuv420p, 320x240, 
             506 kb/s, 200 fps, 200 tbr, 200 tbn, 200 tbc 

As the video is 35 sec. long, and with 200 fps frame rate, I expect there would be (35 x 200) = 7000 frames in the video.

If I use ffmpeg to actually extract frame images from the video, I actually get 6999 images (near enough, I suppose). The command I use for this is:-

c:\> ffmpeg -i sample.avi  -f image2 -c:v png Img%%04d.png

Note: the '%%' is required when the command is run from the WinXP CLI

However, using the command:-

c:\> ffprobe -select_streams v -show_frames sample.avi > frames.lis 

and counting how many [FRAME] items are in frames.lis gives a frame count of 1023 frames and not 7000.

Any explanation?

Here's a link to a very similar file that behaves in the same way (~7MB):

http://www.filedropper.com/sample_65

Left-click on the "Download This File" image on the page.

I'm using 17APR2014 static Win32 build of ffmpeg 'ffprobe' under WinXP-SP3.

If there's another way to do it, I'm primarily trying to build a table of "frame number" versus "time" for a series of video files for use in another application.

Thanks.

  • Can you share a video sample? Note that the duration doesn't always have to be accurate. – slhck Apr 23 '14 at 6:19
  • Have added a link to a sample .avi file in the posting. – Skeeve Apr 23 '14 at 9:35
  • For others with the same issue, @Skeeve got answers on the FFmpeg mailing list: ffmpeg.org/pipermail/ffmpeg-user/2014-May/021318.html Not sure it entirely solves my problem though. – Gauthier Aug 18 '16 at 12:38
1

Is there a reason 1023 cannot be correct? The fps you are referring to is header info and so it can easily be incorrect.

In the output of the png's, are there a lot of duplicate frames? Ffmpeg may be doing you a favor and outputting copied frames to match the reported fps and duration.

Using ffprobe is my recommended solution. It's difficult to be certain 100% of the time unless you are actually decoding the frames and counting. So using -count_frames or -show_frames should give you the number you are looking for.

Note: There is no guarantee that the duration listed is accurate.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.