This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Calculating video file duration Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Calculating video file duration" Watch "Calculating video file duration" New topic
Author

Calculating video file duration

andrea gabrieli
Greenhorn

Joined: May 21, 2012
Posts: 3
Hi all,

I'm searching a java library to calculate video file duration for all possible video formats (flv, mpeg, avi, mp4).
I've tried "getDuration()" (class player" into package javax.media) but it's wrong for my porpouse.

Peraphs jffmpeg (net.sourceforge.jffmpeg.VideoDecoder)?
Has someone ever tried it?
where can i Find some explampe code?

Thank you,
bye

Andrea
andrea gabrieli
Greenhorn

Joined: May 21, 2012
Posts: 3
resolved
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
Welcome to the Ranch and well done but please tell us how you did it.
andrea gabrieli
Greenhorn

Joined: May 21, 2012
Posts: 3
Hi,

I've used ffmpeg.exe. I execute this file and it returns a string with duration value inside.
There is ffmpeg version also for Mac and I select to execute ffmpeg.exe or ffmpeg according to os version.
Here the code:




Bye,
andrea
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36453
    
  15
Thank you very much. I have added code tags, which improve your post. Don’t use [b] or similar tags inside code tags.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Calculating video file duration
 
Similar Threads
How to find the duration of the media?
Playing Video in JSP
Playing Video in JSP
How to get Video/Audio File icon?
Simple JMF question - help needed urgently!