[FFmpeg-devel] [PATCH] avformat/matroskaenc: always reserve max aac private data

Andreas Rheinhardt andreas.rheinhardt at gmail.com
Fri May 1 21:03:06 EEST 2020


John Stebbins:
> On Fri, 2020-05-01 at 14:27 -0300, James Almer wrote:
>> On 5/1/2020 2:09 PM, John Stebbins wrote:
>>> When extra data is updated using AV_PKT_DATA_NEW_EXTRADATA, the
>>> data is
>>> written plus extra space is reserved for the max possible size
>>> extradata.
>>> But when extradata is written during mkv_write_header, no extra
>>> space is
>>> reserved. So the side data update overwrites whatever follows the
>>> extradata in the track header and results in an invalid file.
>>
>> In what scenario there's extradata during init() and then new
>> extradata
>> propagated in a packet side data for AAC? And should the side data
>> one
>> take priority over the original one?
>>
> 
> This is partially a HandBrake issue.  Before ffmpeg ever had side data,
> HandBrake parsed the extradata out of the aac stream in TS files
> ourselves before initializing the muxer.  We still do this, so
> extradata is supplied by us when the muxer it initialized and again by
> side data generated in aac_adtstoasc bsf.
> 
Does this mean that HandBrake's extradata and the aac_adtstoasc bsf
side-data extradata are actually one and the same?

- Andreas

> So remuxing ts to mkv with ffmpeg exe does not have this problem.  But
> it is a problem when using the API in valid ways.
> 
> I don't think it matters which takes priority.  If stream parameters
> change, there really is no way to handle in mkv since this is global
> data in mkv.  So perhaps just ignore side data when extradata has
> already been set once?
> 


More information about the ffmpeg-devel mailing list