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 A9FA74095E for ; Thu, 3 Mar 2022 19:58:07 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 244E368AF8D; Thu, 3 Mar 2022 21:58:05 +0200 (EET) Received: from mail-yb1-f169.google.com (mail-yb1-f169.google.com [209.85.219.169]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 9CE7B68A4C5 for ; Thu, 3 Mar 2022 21:57:58 +0200 (EET) Received: by mail-yb1-f169.google.com with SMTP id h126so12528878ybc.1 for ; Thu, 03 Mar 2022 11:57:58 -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=NhsiltPFX97nRrLZX0lfKOJvToslj+llpbS+xWKhc84=; b=KICRTB1eip7jqgpiWPNa5Zk1n0qWLCVhnBQCSJiAAepCpAB8Hy5jQaeCmx5/kcPaFn dqk7bnxuZvHtiwHiL/E4H1Ngir3d3HsT+kVMnm1J0qLn3o1jtV9WdEDZT2kb7nk+eOo0 MboPBGzkUylyCP2MKgJGsnBqmwQfE/bN6ZDKPHuVCv2jtFivpObmsJhx4r8JURVQ6Unh tagO29H8PC77rPG3fWOjD/pPGZhBXajeQObeNvhBII1ziPkpquKW66AdKgNoSWKd8cNq lr+0cs2sUdbee3SS05RgbRhbtQKYagKLyE6HZf3uX678R4gQncFekCcXQbBoX6eUso/O PZAA== 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=NhsiltPFX97nRrLZX0lfKOJvToslj+llpbS+xWKhc84=; b=1rQY5TU0LGfB71LTzyBFBAA2pEniuJ3vWiFFO3A2fT3BID1eU7IF5NuIClHyRNm711 zJ3n1bidHe0z+nc5hC3I64OnIK1rVthfSrRymlqnjIaU0HXriPSfz4BFGP2/ZvVNoXBC +L8kA0V3LwBcunnkugr03+so2bnV79YFCsGTsdnrVVbBYA3hHuM72W0p/69NVdy3dFC3 RAs3Ak6NL4msIGsJ8+w4ULNG4Hd20YL7sMzQB3Lane1AWF0cWiplKMKMUBiUxEgD8C// Lg9NG9YOYKZpv2wv6rz5QK0P9RoFooWxtqGdrjl8pe2YihN89nFIsJbix1rG3iYfiQ84 ms6Q== X-Gm-Message-State: AOAM530sVCOgjEpujhODoe1hxp3Z5M6MwhlP1Idn5begGUllWZO8Tsx4 ShfMKTwDiJLeJMvZhcK8SQIRls+ETNt/k1MEePEdlbNeVuoCzQ== X-Google-Smtp-Source: ABdhPJxJEkizQEK3cvf+99lejhTXcdpw7X7oU8K7oASOJY17mxkQ/6msPivjNfy9iMY8UgCLpjHxNCw1xdauc0iNh7U= X-Received: by 2002:a25:9742:0:b0:61d:9526:ebc3 with SMTP id h2-20020a259742000000b0061d9526ebc3mr36223614ybo.578.1646337476763; Thu, 03 Mar 2022 11:57:56 -0800 (PST) MIME-Version: 1.0 References: <20220222214318.3053157-1-vigneshv@google.com> <53482b5b-9293-65c5-a9e7-88f28d30353d@gmail.com> <31f915b6-2a02-545c-eb88-d2b764e7a1d1@gmail.com> In-Reply-To: <31f915b6-2a02-545c-eb88-d2b764e7a1d1@gmail.com> From: Vignesh Venkatasubramanian Date: Thu, 3 Mar 2022 11:57:45 -0800 Message-ID: To: FFmpeg development discussions and patches 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 Thu, Mar 3, 2022 at 11:46 AM James Almer wrote: > > > > On 3/3/2022 4:20 PM, Vignesh Venkatasubramanian wrote: > > On Thu, Mar 3, 2022 at 7:36 AM James Almer wrote: > >> > >> On 2/22/2022 6:43 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, 282 insertions(+), 25 deletions(-) > >> > >> With a single frame i get no errors in that compliance tool, but when i > >> encode an animated AVIF i get the following: > >> > >> [heif][Rule #12] Error: CodingConstraintsBox ('ccst') shall be present once > >> [heif][Rule #28] Error: Wrong arity for boxes { ccst } in parents { avc1 > >> avc2 avc3 avc4 hev1 hev2 hvc1 hvc2 av01 }: expected in range [1-1], found 0 > >> [heif][Rule #31] Error: 'msf1' brand: this file shall conform to HEIF > >> (section 7.2) > >> [heif][Rule #31] Error: 'msf1' brand: 'iso8' shall be present among the > >> compatible brands array > >> [heif][Rule #32] Error: 'mif1' brand: this file shall conform to HEIF > >> section 6, check the other errors for details > >> [heif][Rule #33] Error: 'msf1' brand: this file shall conform to HEIF > >> section 7, check the other errors for details > >> > >> All but one of these should be solved by writing a ccst box after the > >> av1C box in the sample entry. The missing one should be solved by > >> writing the iso8 compatible brand. > >> > >> The ccst box looks like it would need some bitstream information, so > >> either you parse the packets to get it, or just hardcode sane defaults, > >> considering it's used as a hint and it's not required for demuxing. > > > > I recently fixed these errors in libavif [1][2] (the reference AVIF > > encoder). I was hoping to have a follow-up patch since i already > > uploaded the existing patches. Since you have pointed this out now, i > > have included the fix in this patch itself. The new patch will now > > write the iso8 compatible brand and the ccst box with sane default > > values. The file produced is now identical to the file produced by > > libavif in terms of box structure. > > > > Also, notice that the compliance tool still shows the following error > > for animated avif: > > > > [avif][Rule #3] Warning: [ItemId=1] still_picture flag set to 0 > > [avif][Rule #4] Warning: [ItemId=1] reduced_still_picture_header flag set to 0 > > > > I believe these are incorrect since it does not make sense to set > > these flag to 0 for animated avif sequences. These warnings also show > > up with files produced by libavif. So it is okay to ignore them. I > > will file an issue with the compliance tool separately. > > The compliance tool uses the 1.0.0 revision of the spec, and what you > mentioned was removed in the current unfinished draft: > https://github.com/AOMediaCodec/av1-avif/pull/112 > > I assume the tool will be updated once a new revision is released, so > yes, we can ignore them. > > > > > Please take another look, thanks! > > I noticed that using -still-picture 1 and passing more than one frame to > the libaom encoder will succeed, despite you setting enccfg.g_limit to > 1, and encode every frame as key frames. > I'd expect the encoder would error out if you try to feed it more > frames. Is it a libaom bug? > Hmm yeah it seems like libaom only uses the value to set the still-picture sequence header values in 1-pass mode. I think in a way it may be useful for us to be able to use AVIF output with the image2 muxer. For example, something like: ffmpeg -i video.mp4 -still-picture 1 -c:v libaom-av1 -an -f image2 image-%02d.avif This command does not work as of now, but I have some follow-up patches to make the image2 muxer work with AVIF images. > > > > [1] https://github.com/AOMediaCodec/libavif/pull/855 > > [2] https://github.com/AOMediaCodec/libavif/pull/856 > >> _______________________________________________ > >> 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". > > > > > > > _______________________________________________ > 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".