<div dir="ltr"><div dir="ltr"><div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Wed, 21 Nov 2018 at 21:31, drwho <<a href="mailto:drwho@infidigm.net">drwho@infidigm.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div bgcolor="#FFFFFF">
<p><br>
</p>
<div class="gmail-m_-8884057417342550928moz-cite-prefix">On 2018-11-21 3:13 p.m., Jaka Bac
wrote:<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div dir="ltr">
<div class="gmail_quote">
<div dir="ltr">On Wed, 21 Nov 2018 at 20:47, drwho <<a href="mailto:drwho@infidigm.net" target="_blank">drwho@infidigm.net</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello,<br>
<br>
The audio decoder example below fails to decode any file
I've tried <br>
(mp3, opus, wav).....<br>
<br>
[mp2 @ 0x55d075c3d780] Header missing<br>
Error submitting the packet to the decoder<br>
<br>
<a href="https://libav.org/documentation/doxygen/master/decode__audio_8c_source.html" rel="noreferrer" target="_blank">https://libav.org/documentation/doxygen/master/decode__audio_8c_source.html</a><br>
<br>
Jon<br>
<br>
</blockquote>
<div><br>
</div>
<div>Hello,</div>
<div><br>
</div>
<div>The audio decoding example specifically uses the MP2
audio codec to decode the audio.</div>
<div>It does this:</div>
codec = avcodec_find_decoder(AV_CODEC_ID_MP2); </div>
</div>
</div>
</blockquote>
<p>Hi Jaka,</p>
<p>I've tried changing it to <br>
</p>
<p>AV_CODEC_ID_MP3</p>
<p>error = [mp3 @ 0x56136ad2f780] Header missing<br>
<br>
</p>
<p>AV_CODEC_ID_OPUS</p>
<p>error = [opus @ 0x55caa0cb7200] Error parsing Opus packet header.<br>
</p>
<p>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.</p>
<p>Jon<br>
</p>
</div><br></blockquote><div><br></div><div>Hi Jon,</div><div><br></div><div>The decode example here: <a href="https://www.ffmpeg.org/doxygen/trunk/decode_audio_8c-example.html">https://www.ffmpeg.org/doxygen/trunk/decode_audio_8c-example.html</a></div><div>uses the new API.</div><div><br></div><div>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.</div><div><br></div><div>The deprecated API will still work. For a working example you need to combine the decode example linked above and the demuxing/decoding example.</div><div>The new API is nothing special, you can find example usage here:</div><div><a href="https://blogs.gentoo.org/lu_zero/2016/03/29/new-avcodec-api/">https://blogs.gentoo.org/lu_zero/2016/03/29/new-avcodec-api/</a></div><div><br></div><div>Jaka </div></div></div></div></div>