[FFmpeg-devel] [PATCH] mp4toannexb modification / improvement

Luca Abeni lucabe72
Fri Jun 4 13:34:06 CEST 2010


On 06/04/2010 11:15 AM, Luca Abeni wrote:
[...]
>>> why does the bsf not convert the extradata?
>>> i mean it leaves the extradata in "AVC" syntax
>>
>> I do not know... My impression is that since the bsf "inlines"
>> the SPS and PPS (inserting them in the bitstream) it does not care
>> about converting the format of the extradata. But I am not sure;
>> maybe Benoit can clarify this point?
>
> BTW, if modifying the extradata is the right thing to do, I can provide
> a patch doing so.

I tried this approach (and it actually simplifies the code :).
But it causes problems with "-vcodec copy", because the bitstream
filter is passed the output context, which contains a reference to
the input context extradata
(see ffmpeg.c at line 2171: "codec->extradata= icodec->extradata;")

The bitstream filter reallocates the extradata, so the output codec
context contains the new pointer, but the input codec context still
contains a pointer to the "original extradata". As a result,
	 av_close_input_file(input_files[i]);
at line 610 ends up tring to free a wrong pointer.

Which kind of solution do you prefer? Changing line 2171 in something
that allocates memory for the "output extradata", and copies the input
extradata in this new buffer?


			Thanks,
				Luca



More information about the ffmpeg-devel mailing list