detect video length in seconds

G

garylinux

Is there a way to get the length of a video clip (divix/xvid) in
seconds?
oh this is on linux. I first tryed to see if mplayer would tell me then
I could wrap the call in a popen object and be done but it does not
appear to output the length.
Now I am looking at pymedia .It would be nice if there was some actual
docmentation for it.
 
T

Tim Roberts

Is there a way to get the length of a video clip (divix/xvid) in
seconds?

This is non-trivial. MPEG files do not have an index, so the only way to
figure this out is to scan from the front of the file until you find a
timestamp, then scan backwards from the end of the file until you find a
timestamp, and subtract.

You can also try to extract the bitrate from an early header and use
arithmetic to get a good estimate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,203
Latest member
LillianaFr

Latest Threads

Top