[Libav-user] decode audio example broken
Jaka Bac
jakabac at gmail.com
Wed Nov 21 22:40:48 EET 2018
On Wed, 21 Nov 2018 at 21:31, drwho <drwho at infidigm.net> wrote:
>
> On 2018-11-21 3:13 p.m., Jaka Bac wrote:
>
> On Wed, 21 Nov 2018 at 20:47, drwho <drwho at infidigm.net> wrote:
>
>> Hello,
>>
>> The audio decoder example below fails to decode any file I've tried
>> (mp3, opus, wav).....
>>
>> [mp2 @ 0x55d075c3d780] Header missing
>> Error submitting the packet to the decoder
>>
>>
>> https://libav.org/documentation/doxygen/master/decode__audio_8c_source.html
>>
>> Jon
>>
>>
> Hello,
>
> The audio decoding example specifically uses the MP2 audio codec to decode
> the audio.
> It does this:
> codec = avcodec_find_decoder(AV_CODEC_ID_MP2);
>
> Hi Jaka,
>
> I've tried changing it to
>
> AV_CODEC_ID_MP3
>
> error = [mp3 @ 0x56136ad2f780] Header missing
>
> AV_CODEC_ID_OPUS
>
> error = [opus @ 0x55caa0cb7200] Error parsing Opus packet header.
>
> I've noticed that the packet size is always 0 after calling
> av_parser_parse2(). It would be nice to have an example for
> avcodec_send_packet() and avcodec_receive_frame() that works.
>
> Jon
>
>
Hi Jon,
The decode example here:
https://www.ffmpeg.org/doxygen/trunk/decode_audio_8c-example.html
uses the new API.
But you have to be aware that it does not involve libavformat for demuxing
and it expects the "raw" bitstream for the specified codec, if you are
opening a file which has a wrapper, you should use libavformat to first
extract the packets and then just send the packets to the codec.
The deprecated API will still work. For a working example you need to
combine the decode example linked above and the demuxing/decoding example.
The new API is nothing special, you can find example usage here:
https://blogs.gentoo.org/lu_zero/2016/03/29/new-avcodec-api/
Jaka
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://ffmpeg.org/pipermail/libav-user/attachments/20181121/19123019/attachment.html>
More information about the Libav-user
mailing list