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 C9EEA4233C for ; Wed, 13 Apr 2022 21:33:22 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 242D268B46B; Thu, 14 Apr 2022 00:33:20 +0300 (EEST) 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 68B7968B419 for ; Thu, 14 Apr 2022 00:33:13 +0300 (EEST) Received: by mail-yb1-f169.google.com with SMTP id m132so6132145ybm.4 for ; Wed, 13 Apr 2022 14:33:13 -0700 (PDT) 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=EjB79PZEP0YAEHoe822rcbJEXBGf6DkSs4loFBnMh14=; b=SRHdLCOHWTUBWrWfJo06/BuQWECeh2BevCHOgDy7RzwaD8vndvODTwALJa1/klJJr3 0F9O2rpkNRZjf8k0DrejrNHoxUMSGvvcOp6joONZINSfFRaaFXmhrB3uYNR3gQpsUw8J EZwnkzeDJRFoF34jO1hU8A5m/8zneeoQSUCuci1hmQkVA5C+LQ4eyK7tYB1QTlQRZpfP ymb3nsZjAzB3EDIXY2Q8mdjhn55eJdWdWAwU5Pm8WNA/yeH2B+3HKhSp4g1pipUrrJi9 +WOZAIqbahOAdqIj5bVLmTFnegNGehs/fYUMAN/6eW0BB9CpfSw+M+khtvcQ3DCnFdpC 4rQQ== 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=EjB79PZEP0YAEHoe822rcbJEXBGf6DkSs4loFBnMh14=; b=TOz3mqt64iEnv8W72S6vgXW4AZGeIwM8Qb7JRWWiXOm7T4q81aGxsbjH9raNBtAo9O y7SIDLOsoA5Jk73EKBqnEx60f9sF5F92BO+uN2aLlXR6SLb7dD4ZOtMwCl0wQI+oQBZo Iy0ZPuH/zwgU50ExIIY+BXoc+DbOXYzjZIghEjmHukpkm4UdF6HdaQI0cHP3YpjlUAWZ uAC6XUqZBG2MPY1ZLg+HnL6aNX45KULpzt9b2ufTHPx//PGI8ZKitGOtj5g+CZlZAHyQ IO2v1n+PHjepYBwAJwj1C8LHLvZcakEqhS0JYNDLLaQUjCrHNGfKHzs77meJUKyvCdq6 d2MA== X-Gm-Message-State: AOAM530NpNQVrNWOPh+mkMdTMkiVV+K52LmWau1fEok3b/dCeiYyOOI3 dC28rOKANfMU8NE+7HmXyad1No4Y4jXt/RqOwYZxljJUDak= X-Google-Smtp-Source: ABdhPJwiFe6X8dRBUIjrISkkUaKWLzUAHMvA8BV4qzAAAD6iIG3IZbKLCvX9BFoU1Dg1pxywjDbT+xB2LX+19UcHP+g= X-Received: by 2002:a25:6143:0:b0:641:17e7:616b with SMTP id v64-20020a256143000000b0064117e7616bmr732281ybb.41.1649885591338; Wed, 13 Apr 2022 14:33:11 -0700 (PDT) MIME-Version: 1.0 References: <20220413204028.3696947-1-vigneshv@google.com> In-Reply-To: From: Vignesh Venkatasubramanian Date: Wed, 13 Apr 2022 14:33:00 -0700 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 Wed, Apr 13, 2022 at 2:01 PM Andreas Rheinhardt wrote: > > Vignesh Venkatasubramanian: > > Add an AVIF muxer by re-using the existing the mov/mp4 muxer. > > > > AVIF Specification: 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) Verified 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 | 337 ++++++++++++++++++++++++++++++++++++--- > > libavformat/movenc.h | 5 + > > 4 files changed, 319 insertions(+), 25 deletions(-) > > > > +static int avif_write_trailer(AVFormatContext *s) > > +{ > > + AVIOContext *pb = s->pb; > > + MOVMuxContext *mov = s->priv_data; > > + int64_t pos_backup, mdat_pos; > > + uint8_t *buf; > > + int buf_size, moov_size; > > + > > + if (mov->moov_written) return 0; > > Can it happen that moov_written is true? What happens if it is? (I > presume the file to be invalid.) > This is more of a sanity check. I don't think this will ever happen (as long as write_trailer is not called more than once). If you prefer, i can remove it. > > + > > + mov->is_animated_avif = s->streams[0]->nb_frames > 1; > > + mov_write_identification(pb, s); > > + mov_write_meta_tag(pb, mov, s); > > + > > + moov_size = get_moov_size(s); > > + mov->tracks[0].data_offset = avio_tell(pb) + moov_size + 8; > > + > > + if (mov->is_animated_avif) { > > + int ret; > > + if ((ret = mov_write_moov_tag(pb, mov, s)) < 0) > > + return ret; > > + } > > + > > + buf_size = avio_get_dyn_buf(mov->mdat_buf, &buf); > > + avio_wb32(pb, buf_size + 8); > > + ffio_wfourcc(pb, "mdat"); > > + mdat_pos = avio_tell(pb); > > + > > + if (mdat_pos != (uint32_t)mdat_pos) { > > + av_log(s, AV_LOG_ERROR, "mdat offset does not fit in 32 bits\n"); > > + return AVERROR_INVALIDDATA; > > + } > > + > > + avio_write(pb, buf, buf_size); > > + > > + // write extent offset. > > + pos_backup = avio_tell(pb); > > + avio_seek(pb, mov->avif_extent_pos, SEEK_SET); > > + avio_wb32(pb, mdat_pos); /* rewrite offset */ > > + avio_seek(pb, pos_backup, SEEK_SET); > > + > > + return 0; > > +} > > + > > - Andreas > _______________________________________________ > 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".