简体   繁体   English

如何在 iOS swift 中将 .opus 文件转换为 .mp3/.m4a/.aac?

[英]How to convert .opus file to .mp3/.m4a/.aac in iOS swift?

I want to play .opus file using AVAudioPlayer, since AVAudioPlayer doesn't support .opus file, I am trying to find a way to convert .opus to any other audio format so that I can play using AVAudioPlayer .我想使用 AVAudioPlayer 播放.opus文件,因为 AVAudioPlayer 不支持.opus文件,我试图找到一种方法将.opus转换为任何其他音频格式,以便我可以使用AVAudioPlayer播放。 Could anyone help me on this?有人可以帮我吗?

Thank you谢谢

You could use libopus or libopusfile C libraries to dynamically decode Opus files to raw PCM audio and feed that to a memory buffer that AVAudioPlayer could decode.您可以使用libopuslibopusfile C 库将 Opus 文件动态解码为原始 PCM 音频,并将其提供给 AVAudioPlayer 可以解码的内存缓冲区。 You would most likely need to prepend the memory buffer with AIFF/WAV/RIFF header bytes that describe the PCM data.您很可能需要在内存缓冲区中添加描述 PCM 数据的 AIFF/WAV/RIFF 标头字节。

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

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