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

Peter White peter.white at posteo.net
Tue Mar 9 13:53:28 EET 2021

On Tue, Mar 09, 2021 at 12:39:09PM +0100, Nicolas George wrote:
> Peter White (12021-03-09):
> > Sorry, I didn't mean to offend.
> I was not offended, I was amused.
> > Is there a proper universal way to do this with ffprobe that does not
> > take ages to complete? Honest question.
> Of course. As I already said, FFprobe can do the same thing as FFmpeg,
> but its output is meant for parsing.

Would you mind answering the OP's question with a command line example,

> Your solution will break as soon as we change a tiny detail in the
> statistics line.

I am well aware of that, but nobody said anything about parsing. But if
there is an equivalent to my suggestion with ffprobe I would gladly use
that and henceforth recommend it.

> Show us your complete command line and console output if you have
> trouble.

ffprobe -v error -count_frames -select_streams v:0 -show_entries stream=nb_read_frames -of default=nokey=1:noprint_wrappers=1 input.mkv

No need for output because it takes to long to complete: roughly one
minute for a 20 minute video as opposed to virtually no time with:

ffmpeg -i input.mkv -an -sn -c copy -f null -


More information about the ffmpeg-user mailing list