使用AmrInputStream将PCM编码的wav文件转换为amr文件,但无法使用MediaPlayer播放它
我正在使用 AmrInputStream 将 PCM 编码的 wav 文件转换为 Android 中的 amr 文件。我使用了下面帖子中的代码:
使用 AmrInputStream 将 PCM-16 转换为 AMR
一切正常,amr 文件也是生成的。然而,当我尝试用 MeidaPlayer 播放它时,它抛出了以下异常:
java.io.IOException: Prepare failed.: status=0xFFFFFFFC
at android.media.MediaPlayer.prepare(Native Method)
我注意到在上面的帖子中,它提到:“需要将 #AMR!\n 标签添加到输出文件中进行播放。”。但我不知道到底该怎么做。请帮忙!
I am converting a PCM encoded wav file to amr file in Android using AmrInputStream. I used the code from below post:
converting PCM-16 to AMR using AmrInputStream
Everything works fine, and the amr file is also generated. However, when I tried to play it with MeidaPlayer, it thrown following exception:
java.io.IOException: Prepare failed.: status=0xFFFFFFFC
at android.media.MediaPlayer.prepare(Native Method)
I noticed that in the above post, it mentioned: "requiring adding the #AMR!\n tag to the output file for playing.". but I don't know how to do it exactly. Please help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我成功了。需要在输出文件的前6个字节中添加标签:
Ok, I made it working. need to add the tag in the first 6 bytes of the output file: