views:

203

answers:

2

Hi,
I'm looking for a minimal way to convert mp4 file to mp3 file programmatically from Java. Ideally I also need an cutting of target file.
Do Java libs support this or only 3th party ones? Like jmf, ffmpeg?

Thanks!

A: 

I assume you're going to strip out the audio from your mp4 file and save it as mp3. I haven't tried to do anything with audio encodings, but I've used Xuggler ( http://www.xuggle.com/xuggler/ ) pretty successfully as a library to access video, and their documentation claims to support audio as well.

Curtis
A: 

The most simple way is to use ffmpeg via a ProcessBuilder using this command

ffmpeg -i input.mp4 -vn -s 00:00:10 -acodec libmp3lame output.mp3

This translates to: read mp4 file, ignore video, output 10 seconds in mp3 format

Mondain