FFmpeg - How do i get the extradata required to open the ALAC Codec?
<p>I am wondering how to get the extradata from an ALAC media file using the FFmpeg library without having to manually parse the file?</p>

<p>I setup initially with:</p>

<pre><code>avformat_open_input(&amp;formatContext, pszFileName, 0, 0);
avformat_find_stream_info(formatContext, NULL);
av_find_best_stream(formatContext, AVMEDIA_TYPE_AUDIO, -1, -1, &amp;codec, 0);
codecContext = avcodec_alloc_context3(codec);
</code></pre>

<p>Currently I am able to detect and find the ALAC codec but it fails to open the codec returning AVERROR_INVALIDDATA, which comes from the <strong>extradata</strong> and <strong>extradata_size</strong> not being set.</p>

<pre><code>avcodec_open2(codecContext, codec, NULL);
</code></pre>

<p>The FFmpeg documentation states that some codecs require <strong>extradata</strong> and <strong>extradata_size</strong> to be set to the codec's specifications. But shouldn't this data be set by <strong>avformat_find_stream_info</strong>?</p>