How to convert mp4 to mp3 in java

I am looking for a minimal way to convert mp4 file to mp3 file programmatically with Java. Ideally, I also need to cut the target file.
Do Java libraries support these or only 3 party ones? How jmf, ffmpeg?

Thanks!

+4
source share
3 answers

The easiest way is to use ffmpeg via ProcessBuilder with this command

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

This means: reading mp4 file, ignoring video, output 10 seconds in mp3 format

+6
source

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

+5
source

I assume that you are going to cut the audio from your mp4 file and save it as mp3. I did not try to do anything with sound encodings, but I pretty well used Xuggler ( http://www.xuggle.com/xuggler/ ) as a library for accessing videos and their documentation to support audio.

+2
source

Source: https://habr.com/ru/post/1312682/


All Articles