[MPlayer-users] retrieve total frame number?

Corey Hickey bugfood-ml at fatooh.org
Mon Aug 23 01:46:57 CEST 2004


Martin Ankerl wrote:
> Is there a simple way to use mplayer to retrieve the total number of
> frames of a video?  At the moment I use this command:
> 
> mencoder movie.bin  -oac copy -ovc copy -o -noskip -skiplimit 0 -mc 0
> -o  /dev/null
> 
> which writes the frames when it finishes playing the whole movie. This
> is a bit slow, is it possible to get the frames without playing the
> whole movie?
> 

Well, if you need an estimate, you can use mplayer -identify and
multiply ID_LENGTH by ID_VIDEO_FPS. I don't know how accurate this will
be for variable-fps video.


This should be a failsafe way that is also faster than using mencoder:
$ mplayer movie.bin -nosound -vc null -vo null -benchmark

-nosound	disables audio decoding and output
-vc null	disables video decoding
-vo null	disables video output
-benchmark	makes mplayer play as quickly as it can

At the end mplayer will leave a line that looks like this:
V:8591.4  205987   0%  0%  0.0% 0 0 0%

The second number (205987 in this example) is the number of frames.

Note that I haven't actually tried this much, but I think it'll work for
any video mplayer can play.

-Corey




More information about the MPlayer-users mailing list