Total frames with ffmpeg

How to find the total number of frames in a video using ffmpeg?

+6
ffmpeg video video-processing
source share
2 answers

Check out this answer . The problem is that the exact number of frames is often not stored in the metadata and can be truly found (not estimated) by decoding the file and determining the number of it. If you only need an estimate, you can simply use the frame rate and duration provided by ffmpeg -i <filename> for the estimate.

+9
source share

If you programmatically run ffmpeg, then the OpenCV library provides a convenient python / C ++ interface for accessing video properties -

http://opencv.willowgarage.com/documentation/python/reading_and_writing_images_and_video.html#getcaptureproperty

Alternatively, you can try to parse the output from ffprobe that comes with ffmpeg and calculate the total frame based on the duration and FPS.

+1
source share

All Articles