Log in

View Full Version : Getting exact videolength, framecount etc.


drunken_clam
10th June 2010, 15:14
Hi,

i need a save way to get the correct videolength, framerate, framecount from a videofile.

I already tried Mediainfo, but there i often get date which seems to be wrong.

My idea is to decode the video frame by frame and then get amount of encoded frames and probably the framerate to calculate the duration.

I have tested with mplayer command like this


mplayer -benchmark -vo null -nosound file.avi

or

mplayer -benchmark -vo null file.avi


Output looks like this:
MPlayer dev-SVN-r26940
CPU: Intel(R) Xeon(R) CPU 5120 @ 1.86GHz (Family: 6, Model: 15, Stepping: 6)
CPUflags: MMX: 1 MMX2: 1 3DNow: 0 3DNow2: 0 SSE: 1 SSE2: 1
Compiled with runtime CPU detection.
Can't open joystick device /dev/input/js0: No such file or directory
Can't init input joystick
mplayer: could not connect to socket
mplayer: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing AP2_teaser.avi.
AVI file format detected.
[aviheader] Video stream found, -vid 0
[aviheader] Audio stream found, -aid 1
VIDEO: [AP41] 720x400 24bpp 25.000 fps 919.6 kbps (112.3 kbyte/s)
==========================================================================
Opening video decoder: [ffmpeg] FFmpeg's libavcodec codec family
Selected video codec: [ffdivx] vfm: ffmpeg (FFmpeg DivX ;-) (MSMPEG-4 v3))
==========================================================================
Audio: no sound
Starting playback...
VDec: vo config request - 720 x 400 (preferred colorspace: Planar YV12)
VDec: using Planar YV12 as output csp (no 0)
Movie-Aspect is undefined - no prescaling applied.
VO: [null] 720x400 => 720x400 Planar YV12
[msmpeg4 @ 0xb40fa0]ext header missing, 16 left
V: 61.6 1542/1542 2% 0% 0.0% 0 0

BENCHMARKs: VC: 1.276s VO: 0.004s A: 0.000s Sys: 0.121s = 1.401s
BENCHMARK%: VC: 91.1000% VO: 0.2499% A: 0.0000% Sys: 8.6501% = 100.0000%

It seems to work but for some files i get no info about the decoded framecount.

Anyone any idea how to get the information probably, maybe with ffmpeg.

Kind regards

Guest
10th June 2010, 15:20
Open the AVI in VirtualDub and look at File/Information.

drunken_clam
10th June 2010, 15:23
sorry i forgot to say that i need a command line tool on linux.

Ghitulescu
11th June 2010, 07:55
There's a special subforum for linux -> http://forum.doom9.org/forumdisplay.php?f=63

Nexin
11th July 2010, 12:52
drop ffprobe.exe onto console> "ffprobe.exe" drop_file_to_examine_here
drop ffmpeg.exe onto console> "ffmpeg.exe" -i drop_file_to_examine_here

both should details you need if ffmpeg knows them.