[FFmpeg-devel] [PATCH v2] movenc: Use first H264/HEVC frame as extradata, if it is missing

Jan Ekström jeebjp at gmail.com
Thu May 21 14:32:13 EEST 2020


On Thu, May 21, 2020 at 2:00 PM Martin Storsjö <martin at martin.st> wrote:
>
> Oh, indeed, you're right.
>
> However wrong that is from the mov/mp4 point of view, it may very well be
> that AVC intra is supposed to be written like this in mov/mp4 files - but
> we'd need a word from somebody who actually knows that case.
>

The best way to figure out if a user wants to do AVC Intra muxing
would be to either a) require specific codec_tag/muxing mode be set by
user or b) attempt to somehow properly check the actual bit stream
within `mov_get_h264_codec_tag` to make the selection proper. Right
now the system seems to base that if you are doing H.264, and have no
codec_tag set already, then `mov_get_h264_codec_tag` attempts to set
an AVC Intra codec_tag (which hits TAG_IS_AVCI), which then attempts
to mux things in that proprietary way. Currently the check only checks
for 10bit 4:2:0/4:2:2 or specific resolutions (which include 1080p and
such). And I'm not sure if even the fallback there is a standard
codec_tag, since it is not one of those I remember from 14496-15
(although my memory might just be bad).

By default, and if the output got written with a standard 14496-15 etc
codec_tag, then AVC intra muxing mode should not utilized.

And just a note for the record, the logic in `mov_get_h264_codec_tag`
seems to already be somewhat imperfect, as I've seen users attempting
to encode 10bit H.264 normally into MOV, and one had to force a
codec_tag to be avc1 for a non-broken file to be generated (as in,
even FFmpeg itself couldn't read the file after muxing with the
default selected codec_tag).

Just my two cents,
Jan


More information about the ffmpeg-devel mailing list