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

Nicolas George george at nsup.org
Tue Mar 9 14:07:41 EET 2021


Peter White (12021-03-09):
> Would you mind answering the OP's question with a command line example,
> then?

I help people who help themselves, thus avoiding Russel's paradox.

> I am well aware of that, but nobody said anything about parsing.

Oh? Please, explain to me how you extract the number of frames from the
statistics line without parsing it?

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

Do not use "-v error" if you want help.

> 
> 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 -

-c copy tells ffmpeg to dispense with the decoder, which means it does
not count frames but packets. Have you tried telling ffprobe to count
packets?

Regards,

-- 
  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20210309/daf4da11/attachment.sig>


More information about the ffmpeg-user mailing list