[FFmpeg-devel] [PATCH] avformat: add H264 and HEVC support in IVF muxer

Jan Ekström jeebjp at gmail.com
Mon Oct 1 00:01:29 EEST 2018


Sn Sun, Sep 30, 2018 at 8:56 PM <alx.sukhanov at gmail.com> wrote:
>
>  ...
> +    if (st->codecpar->codec_id == AV_CODEC_ID_H264) {
> +        if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
> +                             (AV_RB24(pkt->data) != 0x000001 ||
> +                              (st->codecpar->extradata_size > 0 &&
> +                               st->codecpar->extradata[0] == 1)))
> +            ret = ff_stream_add_bitstream_filter(st, "h264_mp4toannexb", NULL);
> +    } else if (st->codecpar->codec_id == AV_CODEC_ID_HEVC) {
> +        if (pkt->size >= 5 && AV_RB32(pkt->data) != 0x0000001 &&
> +                             (AV_RB24(pkt->data) != 0x000001 ||
> +                              (st->codecpar->extradata_size > 0 &&
> +                               st->codecpar->extradata[0] == 1)))
> +            ret = ff_stream_add_bitstream_filter(st, "hevc_mp4toannexb", NULL);

Please verify that there is no AVCc/Annex B deciding helper function
within lavf/lavc that could be used here. I tried to ask about this on
IRC but didn't get responses so I can't straight up note you a
function name. If there's none, then it might be worth making a lavf
helper for that since I think at least movenc/matroskaenc try to
figure out if the input bit stream is Annex B and convert it the other
way.

Additionally, please make sure that the files created with these
changes can be demuxed with the FFmpeg IVF demuxer (ivfdec.c). I would
guess the H.264 stuff would work, but since the IVF demuxer utilizes
the ff_codec_bmp_tags list, which doesn't seem to contain HEVC entries
I would guess additional stuff would be required there.

That of course doesn't have to be within this patch, but just within
this patch set (one patch for demuxer, one for muxer).

Best regards,
Jan


More information about the ffmpeg-devel mailing list