From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 4E399403CD for ; Tue, 22 Feb 2022 21:38:24 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 68D2168B14F; Tue, 22 Feb 2022 23:38:23 +0200 (EET) Received: from mail-yw1-f180.google.com (mail-yw1-f180.google.com [209.85.128.180]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 85D6F68AFD2 for ; Tue, 22 Feb 2022 23:38:16 +0200 (EET) Received: by mail-yw1-f180.google.com with SMTP id 00721157ae682-2d6d0cb5da4so135217537b3.10 for ; Tue, 22 Feb 2022 13:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=hPBAhCNBHkq07tl6AhpTNEK+YQndx5SlnoWtGJcWDIw=; b=gaDmJsmbNxxHMtMqjeFMtd15xNiwzddC3yRsu1vuS2eBBHRyBz4e00ej35Xm9CEcb/ lqUStgPtVOjCwYSQPG2eoN92IywwMygOrt+X+UxJTS113Q7Ct0cQqW+9ePjI6PBU0axg KpzZxSKrkYh51RssnvdjIjLG+zCXlyIKLDn+JWLU6IirkdM6Eez62n8lozmbaoggOha8 yZQM+Oy5uieq/nsJ4Hwd1Rk8tZou4nu1fCVukT+ogtweLHx+G0LC+sJi2VKmrBQyrVVq 3rLy6Yrs82bhE7asQRvfRMg2R1ZEJlDD2Qp5N+jHbkFIxCxLr05dkfMdIGGqhpbj1+Sl qGIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=hPBAhCNBHkq07tl6AhpTNEK+YQndx5SlnoWtGJcWDIw=; b=OJdT5L6bbyaSAkgWcQDeaLjb7PBn7FVdqmgccMN1vFT3f9I9c6V7Sn93zus9ztputF FudNzzaHhM7kjaJ7BPSdaigelubGiagDDUyQL67Nl76Ghzg2kk9whLnNQkGDoVkLkSy5 H4wGu5vXL5VVgETAwmwY8ktYNEvSx/ZWQaPEJjdvY6z0hURhHylDqeqC6Qxj/Dvwsbp0 AHspE/hwgR+2/cdbjxwkpWV//V9fbRHXvIFW9QYdDH3V6Ugb1MaKw+I8DKvgu+6KNjaD MoBGfWP1TGCjFKE/YSAbTZx2Tt3XhJgYImVB87UKV5BYZkiKH9pe7Q2qog83LRhWJUBq yNDg== X-Gm-Message-State: AOAM532JuFP0h8NFgfv4DH9uW/WW/csvakbGWGL/BQ91e/FlOsfN1xcb +6Vk03N66Xtd64zCod1UTM0kaF2t7nZoai03zraLVPy7VI0= X-Google-Smtp-Source: ABdhPJzVsUcfOVmiKfW858G8FEdSscNxqxucW6kRWA9pScsQ0KfGHPtN3Oa2KHM5aRs5WlmalRN5p93qcjv6Q7EnXkM= X-Received: by 2002:a81:f08:0:b0:2d0:f8eb:d176 with SMTP id 8-20020a810f08000000b002d0f8ebd176mr25381693ywp.434.1645565894857; Tue, 22 Feb 2022 13:38:14 -0800 (PST) MIME-Version: 1.0 References: <20220217055117.3233501-3-vigneshv@google.com> <20220222184018.2980829-1-vigneshv@google.com> <08d6d16b-1528-6f2d-c96c-c443b9577a2a@gmail.com> In-Reply-To: <08d6d16b-1528-6f2d-c96c-c443b9577a2a@gmail.com> From: Vignesh Venkatasubramanian Date: Tue, 22 Feb 2022 13:38:03 -0800 Message-ID: To: FFmpeg development discussions and patches X-Content-Filtered-By: Mailman/MimeDel 2.1.29 Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On Tue, Feb 22, 2022 at 12:03 PM James Almer wrote: > > > On 2/22/2022 3:40 PM, Vignesh Venkatasubramanian wrote: > > Add an AVIF muxer by re-using the existing the mov/mp4 muxer. > > > > AVIF Specifiation: https://aomediacodec.github.io/av1-avif > > > > Sample usage for still image: > > ffmpeg -i image.png -c:v libaom-av1 -avif-image 1 image.avif > > > > Sample usage for animated AVIF image: > > ffmpeg -i video.mp4 animated.avif > > > > We can re-use any of the AV1 encoding options that will make > > sense for image encoding (like bitrate, tiles, encoding speed, > > etc). > > > > The files generated by this muxer has been verified to be valid > > AVIF files by the following: > > 1) Displays on Chrome (both still and animated images). > > 2) Displays on Firefox (only still images, firefox does not support > > animated AVIF yet). > > 3) Verfied to be valid by Compliance Warden: > > https://github.com/gpac/ComplianceWarden > > > > Fixes the encoder/muxer part of Trac Ticket #7621 > > > > Signed-off-by: Vignesh Venkatasubramanian > > --- > > configure | 1 + > > libavformat/allformats.c | 1 + > > libavformat/movenc.c | 300 +++++++++++++++++++++++++++++++++++---- > > libavformat/movenc.h | 5 + > > 4 files changed, 283 insertions(+), 24 deletions(-) > > > > diff --git a/configure b/configure > > index 1535dc3c5b..87b380fe3a 100755 > > --- a/configure > > +++ b/configure > > @@ -3393,6 +3393,7 @@ asf_stream_muxer_select="asf_muxer" > > av1_demuxer_select="av1_frame_merge_bsf av1_parser" > > avi_demuxer_select="riffdec exif" > > avi_muxer_select="riffenc" > > +avif_muxer_select="mov_muxer" > > caf_demuxer_select="iso_media" > > caf_muxer_select="iso_media" > > dash_muxer_select="mp4_muxer" > > diff --git a/libavformat/allformats.c b/libavformat/allformats.c > > index d066a7745b..400c17afbd 100644 > > --- a/libavformat/allformats.c > > +++ b/libavformat/allformats.c > > @@ -81,6 +81,7 @@ extern const AVOutputFormat ff_au_muxer; > > extern const AVInputFormat ff_av1_demuxer; > > extern const AVInputFormat ff_avi_demuxer; > > extern const AVOutputFormat ff_avi_muxer; > > +extern const AVOutputFormat ff_avif_muxer; > > extern const AVInputFormat ff_avisynth_demuxer; > > extern const AVOutputFormat ff_avm2_muxer; > > extern const AVInputFormat ff_avr_demuxer; > > diff --git a/libavformat/movenc.c b/libavformat/movenc.c > > index 1a746a67fd..05537d1e78 100644 > > --- a/libavformat/movenc.c > > +++ b/libavformat/movenc.c > > @@ -1303,7 +1303,7 @@ static int mov_write_av1c_tag(AVIOContext *pb, > MOVTrack *track) > > > > avio_wb32(pb, 0); > > ffio_wfourcc(pb, "av1C"); > > - ff_isom_write_av1c(pb, track->vos_data, track->vos_len, 1); > > + ff_isom_write_av1c(pb, track->vos_data, track->vos_len, track->mode > != MODE_AVIF); > > return update_size(pb, pos); > > } > > > > @@ -2004,12 +2004,13 @@ static int mov_write_colr_tag(AVIOContext *pb, > MOVTrack *track, int prefer_icc) > > } > > } > > > > - /* We should only ever be called by MOV or MP4. */ > > - av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4); > > + /* We should only ever be called for MOV, MP4 and AVIF. */ > > + av_assert0(track->mode == MODE_MOV || track->mode == MODE_MP4 || > > + track->mode == MODE_AVIF); > > > > avio_wb32(pb, 0); /* size */ > > ffio_wfourcc(pb, "colr"); > > - if (track->mode == MODE_MP4) > > + if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) > > ffio_wfourcc(pb, "nclx"); > > else > > ffio_wfourcc(pb, "nclc"); > > @@ -2019,7 +2020,7 @@ static int mov_write_colr_tag(AVIOContext *pb, > MOVTrack *track, int prefer_icc) > > avio_wb16(pb, track->par->color_primaries); > > avio_wb16(pb, track->par->color_trc); > > avio_wb16(pb, track->par->color_space); > > - if (track->mode == MODE_MP4) { > > + if (track->mode == MODE_MP4 || track->mode == MODE_AVIF) { > > int full_range = track->par->color_range == AVCOL_RANGE_JPEG; > > avio_w8(pb, full_range << 7); > > } > > @@ -2103,6 +2104,8 @@ static void find_compressor(char * > compressor_name, int len, MOVTrack *track) > > av_strlcatf(compressor_name, len, " %d%c", track->par->height, > interlaced ? 'i' : 'p'); > > > > av_strlcatf(compressor_name, len, "%d", rate * (interlaced + > 1)); > > + } else if (track->par->codec_id == AV_CODEC_ID_AV1 && track->mode > == MODE_AVIF) { > > + av_strlcatf(compressor_name, len, "libaom Encoder"); > libaom is not the only AV1 encoder supported by libavcodec, a > libavformat user could even not use a libavcodec based encoder to begin > with, and then there's also the codec copy scenario where no encoder is > used at all. > > This should probably use the same path as MODE_MOV above if there's a > key "encoder" in track->st->metadata, and write it. > Done. > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". > -- Vignesh _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".