[FFmpeg-devel] [PATCH 2/2] Provided support for MPEG-5 EVC (Essential Video Coding) codec

James Almer jamrial at gmail.com
Mon Aug 1 17:04:49 EEST 2022


On 8/1/2022 6:29 AM, Dawid Kozinski wrote:
> diff --git a/libavformat/movenc.c b/libavformat/movenc.c
> index 5608afde42..d0b094c30d 100644
> --- a/libavformat/movenc.c
> +++ b/libavformat/movenc.c
> @@ -1392,6 +1392,16 @@ static int mov_write_hvcc_tag(AVIOContext *pb, MOVTrack *track)
>       return update_size(pb, pos);
>   }
>   
> +static int mov_write_evcc_tag(AVIOContext *pb, MOVTrack *track)
> +{
> +    int64_t pos = avio_tell(pb);
> +
> +    avio_wb32(pb, 0);
> +    ffio_wfourcc(pb, "evcC");

Is that it? That's all this atom contains? No structure containing a 
global SPS/PPS?
Is there a spec anywhere defining this?

> +
> +    return update_size(pb, pos);
> +}
> +
>   /* also used by all avid codecs (dv, imx, meridien) and their variants */
>   static int mov_write_avid_tag(AVIOContext *pb, MOVTrack *track)
>   {
> @@ -1641,6 +1651,16 @@ static int mov_get_h264_codec_tag(AVFormatContext *s, MOVTrack *track)
>       return tag;
>   }
>   
> +static int mov_get_evc_codec_tag(AVFormatContext *s, MOVTrack *track)
> +{
> +    int tag = track->par->codec_tag;
> +
> +    if (!tag)
> +        tag = MKTAG('e', 'v', 'c', 'i');
> +
> +    return tag;
> +}
> +
>   static const struct {
>       enum AVPixelFormat pix_fmt;
>       uint32_t tag;
> @@ -1722,6 +1742,8 @@ static unsigned int mov_get_codec_tag(AVFormatContext *s, MOVTrack *track)
>               tag = mov_get_mpeg2_xdcam_codec_tag(s, track);
>           else if (track->par->codec_id == AV_CODEC_ID_H264)
>               tag = mov_get_h264_codec_tag(s, track);
> +        else if (track->par->codec_id == AV_CODEC_ID_EVC)
> +            tag = mov_get_evc_codec_tag(s, track);
>           else if (track->par->codec_id == AV_CODEC_ID_DNXHD)
>               tag = mov_get_dnxhd_codec_tag(s, track);
>           else if (track->par->codec_type == AVMEDIA_TYPE_VIDEO) {
> @@ -2280,6 +2302,9 @@ static int mov_write_video_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
>           mov_write_avcc_tag(pb, track);
>           if (track->mode == MODE_IPOD)
>               mov_write_uuid_tag_ipod(pb);
> +    }
> +    else if (track->par->codec_id ==AV_CODEC_ID_EVC) {
> +        mov_write_evcc_tag(pb, track);
>       } else if (track->par->codec_id == AV_CODEC_ID_VP9) {
>           mov_write_vpcc_tag(mov->fc, pb, track);
>       } else if (track->par->codec_id == AV_CODEC_ID_AV1) {
> @@ -6030,7 +6055,8 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
>       if ((par->codec_id == AV_CODEC_ID_DNXHD ||
>            par->codec_id == AV_CODEC_ID_H264 ||
>            par->codec_id == AV_CODEC_ID_HEVC ||
> -         par->codec_id == AV_CODEC_ID_TRUEHD) && !trk->vos_len &&
> +         par->codec_id == AV_CODEC_ID_TRUEHD ||
> +         par->codec_id == AV_CODEC_ID_EVC) && !trk->vos_len &&

Why are you copying the first muxed packet's data (in the absence of 
extradata) into vos_data if you're seemingly doing nothing with it? I'd 
expect that's what the evcC tag should contain.

>            !TAG_IS_AVCI(trk->tag)) {
>           /* copy frame to create needed atoms */
>           trk->vos_len  = size;
> @@ -7689,6 +7715,7 @@ static const AVCodecTag codec_mp4_tags[] = {
>       { AV_CODEC_ID_H264,            MKTAG('a', 'v', 'c', '3') },
>       { AV_CODEC_ID_HEVC,            MKTAG('h', 'e', 'v', '1') },
>       { AV_CODEC_ID_HEVC,            MKTAG('h', 'v', 'c', '1') },
> +    { AV_CODEC_ID_EVC,             MKTAG('e', 'v', 'c', '1') },
>       { AV_CODEC_ID_MPEG2VIDEO,      MKTAG('m', 'p', '4', 'v') },
>       { AV_CODEC_ID_MPEG1VIDEO,      MKTAG('m', 'p', '4', 'v') },
>       { AV_CODEC_ID_MJPEG,           MKTAG('m', 'p', '4', 'v') },


More information about the ffmpeg-devel mailing list