本文介绍了我怎么可以录制音频文件作为.M4A格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何可以录制音频文件作为的.m4a格式。
how can i record audio file as .m4a format.
我用下面的code:
public void startRecording() throws IOException {
recorder = new MediaRecorder();
path = "/sdcard/pithysongs_" + System.currentTimeMillis() + ".m4a";
String state = android.os.Environment.getExternalStorageState();
if (!state.equals(android.os.Environment.MEDIA_MOUNTED)) {
throw new IOException("SD Card is not mounted. It is " + state
+ ".");
}
recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
recorder.setOutputFile(path);
recorder.prepare();
recorder.start();
}
感谢..
推荐答案
在这里你设置在你的榜样,输出格式为:
Here's where you set the output format in your example:
recorder.setOutputFormat(MediaRecorder.OutputFormat.THREE_GPP);
和是可用的输出格式列表其中包括:
and here is a list of the available output formats which include:
AMR_WB AMR WB file format
DEFAULT
MPEG_4 MPEG4 media file format
RAW_AMR AMR NB file format
THREE_GPP 3GPP media file format
和这里的支持的格式看起来像它支持MPEG-4音频(M4A),所以我的假设的,你应该选择 MediaRecorder.OutputFormat.MPEG_4
and here's more information about supported formats which looks like it supports MPEG-4 audio (m4a) so I assume that you should choose MediaRecorder.OutputFormat.MPEG_4
这篇关于我怎么可以录制音频文件作为.M4A格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!