开发者

how to convert mp4 to mp3 in java

开发者 https://www.devze.com 2023-01-03 12:46 出处:网络
I\'m looking for a minimal way to convert mp4 file to mp3 file programmatically from开发者_如何学JAVA Java. Ideally I also need an cutting of target file.

I'm looking for a minimal way to convert mp4 file to mp3 file programmatically from开发者_如何学JAVA Java. Ideally I also need an cutting of target file.

Do Java libs support this or only 3th party ones? Like jmf, ffmpeg?

Thanks!


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


JAVE it is very simple to convert media file to another format media. http://www.sauronsoftware.it/projects/jave/manual.php


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消