如何使用 Java 将 .wav 转换为 .mp3?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11027496/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to convert .wav to .mp3 using Java?
提问by user1455397
I am looking for a library (.jar) which help me to convert sound file from .wav format to .mp3 format. Infact i want to write an application which reads .wav file from a specified location in linux, convert it to mp3 and save it in DB.
我正在寻找一个库 (.jar),它可以帮助我将声音文件从 .wav 格式转换为 .mp3 格式。事实上,我想编写一个应用程序,它从 linux 中的指定位置读取 .wav 文件,将其转换为 mp3 并将其保存在数据库中。
Kindly suggest any opensource java library which serve this purpose.
请建议任何用于此目的的开源 Java 库。
waiting for your feedback.
等待您的反馈意见。
Regards,
问候,
Amir Iqbal
阿米尔·伊克巴尔
回答by Eng.Fouad
JAVE(Java Audio Video Encoder) libraryis what you are looking for:
JAVE(ĴAVA一UDIO VIDEO Ëncoder)库是你在找什么:
The JAVE (Java Audio Video Encoder) library is Java wrapper on the ffmpeg project. Developers can take take advantage of JAVE to transcode audio and video files from a format to another. In example you can transcode an AVI file to a MPEG one, you can change a DivX video stream into a (youtube like) Flash FLV one, you can convert a WAV audio file to a MP3or a Ogg Vorbis one, you can separate and transcode audio and video tracks, you can resize videos, changing their sizes and proportions and so on. Many other formats, containers and operations are supported by JAVE.
JAVE(Java 音频视频编码器)库是 ffmpeg 项目上的 Java 包装器。开发人员可以利用 JAVE 将音频和视频文件从一种格式转码为另一种格式。例如,您可以将 AVI 文件转码为 MPEG 文件,您可以将 DivX 视频流更改为(类似于 YouTube 的)Flash FLV文件,您可以将 WAV 音频文件转换为 MP3或 Ogg Vorbis文件,您可以将转码音频和视频轨道,您可以调整视频大小,更改其大小和比例等。JAVE 支持许多其他格式、容器和操作。
回答by harsh zalavadiya
https://github.com/adrielcafe/AndroidAudioConverter
https://github.com/adrielcafe/AndroidAudioConverter
One of the easiest API found on github supports almost all formats but it will increase your APK Size
在 github 上找到的最简单的 API 之一几乎支持所有格式,但它会增加您的 APK 大小