From: Vignesh Venkatasubramanian <vigneshv-at-google.com@ffmpeg.org> To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org> Subject: Re: [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing Date: Tue, 22 Feb 2022 13:38:03 -0800 Message-ID: <CAOJaEPKhsPmiC9zq6gsLCUw-fu7h08B=GuaVA42rjyLs6_rrKg@mail.gmail.com> (raw) In-Reply-To: <08d6d16b-1528-6f2d-c96c-c443b9577a2a@gmail.com> On Tue, Feb 22, 2022 at 12:03 PM James Almer <jamrial@gmail.com> 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 <vigneshv@google.com> > > --- > > 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".
next prev parent reply other threads:[~2022-02-22 21:38 UTC|newest] Thread overview: 71+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-02-17 5:51 [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding Vignesh Venkatasubramanian 2022-02-17 5:51 ` [FFmpeg-devel] [PATCH 2/3] avformat/av1: Add a parameter to av1c to omit seq header Vignesh Venkatasubramanian 2022-03-02 22:57 ` James Almer 2022-03-02 23:22 ` Vignesh Venkatasubramanian 2022-03-02 23:23 ` Vignesh Venkatasubramanian 2022-03-02 23:27 ` James Almer 2022-03-28 20:48 ` Vignesh Venkatasubramanian 2022-04-13 20:40 ` Vignesh Venkatasubramanian 2022-05-02 21:36 ` Vignesh Venkatasubramanian 2022-02-17 5:51 ` [FFmpeg-devel] [PATCH 3/3] avformat/movenc: Add support for AVIF muxing Vignesh Venkatasubramanian 2022-02-22 18:40 ` Vignesh Venkatasubramanian 2022-02-22 20:03 ` James Almer 2022-02-22 21:37 ` Vignesh Venkatasubramanian 2022-02-22 21:38 ` Vignesh Venkatasubramanian [this message] 2022-02-22 21:43 ` Vignesh Venkatasubramanian 2022-02-24 17:34 ` Vignesh Venkatasubramanian 2022-03-01 16:49 ` Vignesh Venkatasubramanian 2022-03-03 15:36 ` James Almer 2022-03-03 19:16 ` Vignesh Venkatasubramanian 2022-03-04 11:24 ` James Almer 2022-03-04 17:52 ` Vignesh Venkatasubramanian 2022-03-04 17:54 ` Vignesh Venkatasubramanian 2022-03-09 19:34 ` Vignesh Venkatasubramanian 2022-03-10 16:01 ` Andreas Rheinhardt 2022-03-10 18:12 ` Vignesh Venkatasubramanian 2022-03-21 20:46 ` Andreas Rheinhardt 2022-03-22 16:45 ` Vignesh Venkatasubramanian 2022-03-22 16:46 ` Vignesh Venkatasubramanian 2022-03-28 17:06 ` Vignesh Venkatasubramanian 2022-03-28 20:49 ` Vignesh Venkatasubramanian 2022-04-07 18:25 ` Vignesh Venkatasubramanian 2022-04-13 17:21 ` James Zern 2022-04-13 20:40 ` Vignesh Venkatasubramanian 2022-04-13 21:01 ` Andreas Rheinhardt 2022-04-13 21:33 ` Vignesh Venkatasubramanian 2022-05-02 17:28 ` James Zern 2022-05-02 21:34 ` Vignesh Venkatasubramanian 2022-05-02 21:35 ` Vignesh Venkatasubramanian 2022-05-03 23:39 ` James Zern 2022-05-04 2:46 ` "zhilizhao(赵志立)" 2022-05-04 16:45 ` Vignesh Venkatasubramanian 2022-05-04 16:48 ` Vignesh Venkatasubramanian 2022-05-04 17:10 ` "zhilizhao(赵志立)" 2022-05-04 17:14 ` Vignesh Venkatasubramanian 2022-05-04 17:15 ` Vignesh Venkatasubramanian 2022-05-11 16:54 ` Vignesh Venkatasubramanian 2022-05-11 17:25 ` Gyan Doshi 2022-05-12 10:26 ` Gyan Doshi 2022-05-12 16:23 ` Vignesh Venkatasubramanian 2022-05-12 16:23 ` Vignesh Venkatasubramanian 2022-05-13 7:22 ` Gyan Doshi 2022-04-13 20:41 ` Vignesh Venkatasubramanian 2022-04-13 21:04 ` Andreas Rheinhardt 2022-04-13 21:35 ` Vignesh Venkatasubramanian 2022-04-21 16:38 ` Vignesh Venkatasubramanian 2022-04-29 16:03 ` Vignesh Venkatasubramanian 2022-03-10 18:14 ` Vignesh Venkatasubramanian 2022-03-15 15:59 ` Vignesh Venkatasubramanian 2022-03-21 17:07 ` Vignesh Venkatasubramanian 2022-03-03 19:20 ` Vignesh Venkatasubramanian 2022-03-03 19:46 ` James Almer 2022-03-03 19:57 ` Vignesh Venkatasubramanian 2022-02-17 18:09 ` [FFmpeg-devel] [PATCH 1/3] avcodec/libaomenc: Add parameter for avif single image encoding James Zern 2022-02-17 19:33 ` Vignesh Venkatasubramanian 2022-02-17 20:59 ` James Almer 2022-02-17 21:18 ` [FFmpeg-devel] [PATCH] " Vignesh Venkatasubramanian 2022-02-17 21:20 ` [FFmpeg-devel] [PATCH 1/3] " Vignesh Venkatasubramanian 2022-02-22 21:36 ` Vignesh Venkatasubramanian 2022-03-28 20:47 ` Vignesh Venkatasubramanian 2022-04-13 20:39 ` Vignesh Venkatasubramanian 2022-05-02 21:37 ` Vignesh Venkatasubramanian
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to='CAOJaEPKhsPmiC9zq6gsLCUw-fu7h08B=GuaVA42rjyLs6_rrKg@mail.gmail.com' \ --to=vigneshv-at-google.com@ffmpeg.org \ --cc=ffmpeg-devel@ffmpeg.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel This inbox may be cloned and mirrored by anyone: git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git # If you have public-inbox 1.1+ installed, you may # initialize and index your mirror using the following commands: public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \ ffmpegdev@gitmailbox.com public-inbox-index ffmpegdev Example config snippet for mirrors. AGPL code for this site: git clone https://public-inbox.org/public-inbox.git