本文介绍了如何在iOS Swift中将.opus文件转换为.mp3/.m4a/.aac?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用AVAudioPlayer播放 .opus 文件,因为AVAudioPlayer不支持 .opus 文件,所以我试图找到一种转换的方法. opus ,以便可以使用 AVAudioPlayer 播放.有人可以帮我吗?

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?

谢谢

推荐答案

您可以使用libopuslibopusfile C库将Opus文件动态解码为原始PCM音频,并将其馈送到AVAudioPlayer可以解码的内存缓冲区.您很可能需要在存储缓冲区之前添加描述PCM数据的AIFF/WAV/RIFF标头字节.

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.

这篇关于如何在iOS Swift中将.opus文件转换为.mp3/.m4a/.aac?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 06:07