简体   繁体   English

如何在android中录制音频m4a格式的音频文件?

[英]How to record audio m4a format audio file in android?

I am able to record audio file as .m4 format using media recorder,but it is not support in all media player.so i want to record audio file in m4a like iOS in android. 我能够使用媒体记录器将音频文件录制为.m4格式,但它并不支持所有媒体播放器。所以我想在m4a中录制音频文件,如iOS中的Android。

    MediaRecorder recorder = new MediaRecorder();

    recorder.setAudioSource(MediaRecorder.AudioSource.MIC);
    recorder.setOutputFormat(MediaRecorder.OutputFormat.MPEG_4);
    recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AMR_NB);
            recorder.setOutputFile("test.mp4");

So, Is there any way i can record audio file in m4a format in android? 那么,有什么方法可以在android中以m4a格式录制音频文件吗?

Please reply if anyone have solution for this issue. 如果有人解决此问题,请回复。 Thanks in advance.. 提前致谢..

i think you have to set the 我想你必须设置

recorder.setAudioEncoder(MediaRecorder.AudioEncoder.AAC);

i've a problem with playing the recorded sound on Windows. 我在Windows上播放录制的声音时遇到问题。 On my Android Smartphone i can load the recorded file und play them. 在我的Android智能手机上,我可以加载录制的文件并播放它们。

Could you jagdish play the recorded sound on Windows? 你可以在Windows上播放录制的声音吗?

I have the same problem, my application writes some files and I try a web portal where it is possible to listen to these audios, for this to work I changed the enconder to AudioEncoder. 我有同样的问题,我的应用程序写了一些文件,我尝试了一个门户网站,可以听到这些音频,为此工作我将enconder更改为AudioEncoder。 AAC and it worked well for me, but the file size is much larger, if you have no problem with the file size, maybe it will work for you, too. AAC对我来说效果很好,但文件大小要大得多,如果你对文件大小没有问题,也许它对你也有用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM