About
音频转码工具,主要用于将微信语音 amr 格式转换为 mp3 格式以便在 html5 的 audio 标签中进行播放
Design & MediaMeasured star growth
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- -1
- in 1 month
- Collecting history
Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.
README-en.md
OriginalJave, An Audio Transcoding Tool
This tool is mainly used to convert the AMR to MP3 format for playing in the audio tag of HTML5.
Linux, Windows and Mac is all supported.
Based on a well known project, named JAVE which relies on ffmpeg, this tool can be used to all ffmpeg supported format conversion. See JAVE official documentation for details.
USE EXAMPLE
Inclue Maven Depandency
<dependency>
<groupId>com.github.dadiyang</groupId>
<artifactId>jave</artifactId>
<version>1.0.6</version>
</dependency>
Invoke AudioUtils.amrToMp3 Method
Just 3 lines, JAVE make it extraordinary easy.
public void amrToMp3() {
File source = new File("target/test-classes/material/testAudio.amr");
File target = new File("testAudio.mp3");
AudioUtils.amrToMp3(source, target);
}
HOW IT WORKS
- Determine the current running environment when initializing and copy the corresponding ffmpeg executable file in classpath:bin directory to a temporary directory
- Invoke Runtime.getRuntime().exec(cmd) to execute ffmpeg's transcode command according to the format and configuration.
PROBLEMS OF THE OLD JAVE PROJECT
Ffmpeg is dependent on runtime platform, and JAVE project encapsulation the ffmpeg, it make ffmpeg has cross-platform features by the above mechanism. However, the old JAVE project has the following problems:
- It's too old. The latest time they release it was 2009. The ffmpeg it involved was outdated and didn't work in many conditions.
- EncoderException: Stream mapping somethings occur.
- It didn't publish to Maven Central Repository. Besides, JAVE itself is not a maven project.
- Mac was not supported.
Therefore, I created this project to solve the above problems.
FEATURE OF THIS NEW JAVE
- This is a maven project and has published to Maven Central Repository.
- The ffmpeg was updated and verified. (The project provided an unit test to easily verified)
- Avoid the EncoderException: Stream mapping.
- Linux, Windows and Mac is all supported.
EXTENSION
Set System.setProperty("ffmpeg.home", "your ffmpeg executable file's path") to specify your own ffmpeg executable when the provided one doesn't match your runtime.
eg. System.setProperty("ffmpeg.home", "/usr/local/bin/")
REFERENCES
LICENSE
JAVE project is open source following GPL License, and this new JAVE project is modified and enhanced on the basis of JAVE, hence GPL License is adopted.
Explore related projects
Loading…