我想要opus解碼成pcm檔案的功能,然后查到https://ffmpeg.org/doxygen/trunk/decode_audio_8c-example.html這個例子。然后跑的時候,我把例子中的編碼器改成了opus的:
codec = avcodec_find_decoder((AV_CODEC_ID_MP2);
codec = avcodec_find_decoder(AV_CODEC_ID_OPUS);
出現了:
./decode_audio ./out.opus ./out.pcm
[opus @ 0x7ff361800000] Error parsing Opus packet header.
[opus @ 0x7ff361800000] Error parsing Opus packet header.
[opus @ 0x7ff361800000] Error parsing Opus packet header.
[opus @ 0x7ff361800000] Error parsing Opus packet header.
[opus @ 0x7ff361800000] Error parsing Opus packet header.
[opus @ 0x7ff361800000] Error parsing Opus packet header.
然后我又把編碼器codec改成AV_CODEC_ID_MP3試試看:
./decode_audio ./out.mp3 ./out.pcm
[mp3float @ 0x7fe564002000] Header missing
Error submitting the packet to the decoder
為什么官方的例子跑不成功呢?我該如何做才能達到我的目的呢?
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/52060.html
標籤:C++ 語言
