[FFmpeg-user] How to get he total number of frames

MediaMouth communque at gmail.com
Fri Mar 12 16:04:41 EET 2021

> On Mar 12, 2021, at 01:10, Peter White <peter.white at posteo.net> wrote:
> Anyway, ffmpeg is not the right tool, as I myself have learned in this
> very thread. ffprobe -count_frames should be used. Yes it is rather slow
> but that is because a packet needs to be decoded first to get the frame.

Hi Peter,

 It's an interesting challenge and approach you've posed.

I understand the interest in literally counting video frames, but for your purposes would simple math be just as reliable and much faster?

Assuming files with fixed frame rates, where your frame rate and total time can be reported to the millisecond, I suspect (but haven't tested) you'll get the exact same frame count whether you use ffprobe or a simple calculation.

More information about the ffmpeg-user mailing list