开发者

Is there a way to re-encode an MP3 or any other audio file in Android?

开发者 https://www.devze.com 2023-02-13 08:03 出处:网络
I have a source MP3 file, and it\'s unknown how many channels it has, or the sampling rate. I need to re-encode it so that the resulting file is mono and 8kH开发者_运维技巧z samling rate. The format i

I have a source MP3 file, and it's unknown how many channels it has, or the sampling rate. I need to re-encode it so that the resulting file is mono and 8kH开发者_运维技巧z samling rate. The format is unimportant, as long as MediaPlayer can play it. Is there anything in the SDK that allows me to do this.


Are you trying to play it over a bluetooth headset?

I experimented with that a while back, but didn't use the MediaPlayer. Instead, I used an approach more like the one here:

http://mindtherobot.com/blog/580/android-audio-play-a-wav-file-on-an-audiotrack/

I was able to get mono audio over bluetooth working, but it's a real pain. Since the app was just for personal use, I eventually decided to just get a better bluetooth headset that supported the new stereo audio standard. With a stereo headset, you don't have to write any code at all - just turn on bluetooth, sync with the device, and you're done.


AFAIK no.

There doesn't seem to be a way to use MediaPlayer/MediaRecorder to transcode an MP3 (hypothetically... unless you're looking for a low-quality transcoding, i.e. play the MP3 file using MediaPlayer and setup MediaRecorder to record whatever's coming in through the microphone - some of that audio would be the MP3 you're playing).

Transcode the MP3 file on your local desktop computer is your best bet.

0

精彩评论

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