How to analyze video files?
Again, I'd love to ask this question.
It's convenient for me to encode a video file from multiple .jpg files, for example:
[code]$ ffmpeg -i %3d.jpg video.mpg[/code]
However, how can I use ffmpeg command (or other commands) to analyse how many frames in such a .mpg file? It may have something to do with how I encode (for example, the framerate, etc.), right? But, the default encoding shouldn't change the number of frames in such a encoded .mpg file, right?
Anyway, can anybody please help how I can analyse a video file ---- how many frames (better, both audio and video streams) in such a video file?
Thank you very much.
The frame rate changes how many frames get played every second. It doesn't change the number of frames. So if you have 300 frames and you set the frame rate to 30fps then it will last 10 seconds, but if you set the frame rate to 25fps it will last 12 seconds, or 30 seconds at 10fps.
As for analysng the movie, ffmpeg comes with ffprobe, which is a tool for analysing movies. It will tell you the duration of the movie and the frame rate, in the form hh:mm:ss:ff and using that you can find how many frames there are.
Editor, Animator, Motionographer
Hi, Thank you Stephen !!
Thanks...very clear answer...
The above code is telling the duration is 10.68 seconds, and 25fps. Totally, there should be 25*10.68=267 frames, right? However, there should be 267+1=268 frames. The command I'm using to generate such a video file from 268 .jpg files is
And, there are definitely 268 files:
Why ffprobe can only find 267 frames?
Ooops.. On the other hand, if I generate in .avi or .mp4 format (instead of in .mpg format), the duration will be 10.72 seconds at 25 fps, that will be 10.72*25=268 frames in total.
Anyway, it seems ffprobe has some problem in analysing .mpg files.
Thanks Stephen. Thank you very much !!