This is my first project in Java.
I’m creating batch FTP video uploader applet in Java.
Before I start uploading videos I need to read the video duration and video bitrate from the video files.
I did some research on Google but I only found some third party libraries (jffmpeg, xugler etc..)
Is there any easier way to get this information using Java?
You’ll need to use a 3rd party tool, like Xuggle or shell out directly to FFmpeg. There is no ‘native’ way in Java to do this. (Java attempts at “media stuff”, like JMF, have never really paned out.) Writing your own media file parser is going to be difficult and time consuming–and that is an understatement.
It doen’t take much effort to shell out to FFmpeg and parse the output. My app does it, although it is only interested in the durration. Here is a simple CLI example:
So, you’ll just need to parse this line-by-line and find this line:
Then chop that up and you are good to go!