How to find the total number of frames in a video using ffmpeg?
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.
ffmpeg -i <filename>
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.