[Libav-user] decode audio example broken
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:
>> 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
> 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
> error = [mp3 @ 0x56136ad2f780] Header missing
> 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.
The decode example here:
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:
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Libav-user