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

James Almer jamrial at gmail.com
Mon Oct 1 00:16:07 EEST 2018


On 9/30/2018 6:01 PM, Jan Ekström wrote:
> 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.

The *_mp4toannexb bitstream filters convert mp4 encapsulated packets
into annex-b, or pass already annex-b formatted packets through.

Assuming ivf is meant to use annex-b, then what this patch is doing is
correct.

> 
> 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).

Yes, a demuxer patch removing the usage of ff_codec_bmp_tags and
replacing it with a custom ivf specific one is needed after, or probably
before this patch.

> 
> Best regards,
> Jan
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> 



More information about the ffmpeg-devel mailing list