Converting 3gp/amr audio file to mp3 in java

三世轮回 提交于 2019-12-23 04:45:41

问题


I need to convert the recorded audio file which is in 3gp format to mp3 format. Any suggestions pls.


回答1:


Rather messy, but you could try this:

  1. Use isobox4j (see https://contributions.coremedia.com/isobox4j/wiki/IsoParser) to read the AMR audio out of the 3gp file.
  2. Use one of the options listed in How to encode a WAV to a mp3 on a Android device to encode it.

Never used isobox4j: started working with it but moved on to a different project before I was done but it looks like it will give you something that looks like raw PCM that you can encode.

Let me know if it works for you.




回答2:


Converting format may be a difficult thing.

I created a project to make it easy.

https://github.com/dadiyang/jave

English Documentation Here

This tool is mainly used to convert the AMR to MP3 format for playing in the audio tag of HTML5. It wrapper ffmpeg, and make it has cross platform feature.

The only thing you should do is:

Inclue Maven Depandency

<dependency>
    <groupId>com.github.dadiyang</groupId>
    <artifactId>jave</artifactId>
    <version>1.0.0</version>
 </dependency>

And Invoke AudioUtils.amrToMp3 Method Just 3 lines, JAVE make it extraordinary easy.

public void amrToMp3()  {
    File source = new File("testAudio.amr");
    File target = new File("testAudio.mp3");
    AudioUtils.amrToMp3(source, target);
}

It's worth a try. May it helps for you.



来源:https://stackoverflow.com/questions/6080237/converting-3gp-amr-audio-file-to-mp3-in-java

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!