[FFmpeg-devel] [PATCH] movenc: Try to extract extradata from the first H264/HEVC packet, if none is set

Martin Storsjö martin at martin.st
Wed May 20 00:38:20 EEST 2020


On Tue, 19 May 2020, James Almer wrote:

> On 5/19/2020 5:57 PM, Martin Storsjö wrote:
>> Some encoders don't provide split out extradata directly on init (or
>> at all). In particular, the MediaFoundation encoder wrapper doesn't
>> always (depending on the actual encoder device) - this is the case for
>> Qualcomm's HEVC encoder on SD835, and also on some QSV H264 encoders).
>> 
>> This only works for cases where the moov hasn't already been written
>> (e.g. when not writing fragmented mp4 with empty_moov, unless using
>> the delay_moov option).
>> ---
>>  libavformat/avc.c    | 41 ++++++++++++++++++++++++++++++++++
>>  libavformat/avc.h    |  3 +++
>>  libavformat/hevc.c   | 52 ++++++++++++++++++++++++++++++++++++--------
>>  libavformat/hevc.h   | 16 ++++++++++++++
>>  libavformat/movenc.c | 11 ++++++++++
>>  5 files changed, 114 insertions(+), 9 deletions(-)
>
> Wouldn't copying the first packet into trk->vos_data, like it's done
> with dnxhd, truehd and ac3 in ff_mov_write_packet(), work for these
> codecs as well?

Hmm, yes, that's right - that would actually also work. That's 
significantly simpler...

// Martin


More information about the ffmpeg-devel mailing list