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

风格不统一 提交于 2020-01-23 15:51:06

问题


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. Could anyone help me on this?

Thank you


回答1:


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. You would most likely need to prepend the memory buffer with AIFF/WAV/RIFF header bytes that describe the PCM data.




回答2:


You could use the VLCKit library ;)

https://code.videolan.org/videolan/VLCKit/blob/master/README.md



来源:https://stackoverflow.com/questions/52738113/how-to-convert-opus-file-to-mp3-m4a-aac-in-ios-swift

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!