[FFmpeg-devel] [PATCH] avformat/movenc: Support alpha channel for AVIF

Vignesh Venkatasubramanian vigneshv at google.com
Mon Jun 27 20:17:46 EEST 2022


On Mon, Jun 27, 2022 at 9:48 AM James Almer <jamrial at gmail.com> wrote:
>
> On 6/27/2022 1:43 PM, Vignesh Venkatasubramanian wrote:
> > On Tue, Jun 21, 2022 at 10:12 AM Vignesh Venkatasubramanian
> > <vigneshv at google.com> wrote:
> >>
> >> On Mon, Jun 13, 2022 at 10:17 AM James Zern
> >> <jzern-at-google.com at ffmpeg.org> wrote:
> >>>
> >>> On Wed, Jun 1, 2022 at 11:06 AM Vignesh Venkatasubramanian
> >>> <vigneshv-at-google.com at ffmpeg.org> wrote:
> >>>>
> >>>> AVIF specification allows for alpha channel as an auxiliary item (in
> >>>> case of still images) or as an auxiliary track (in case of animated
> >>>> images).  Add support for both of these. The AVIF muxer will take
> >>>> exactly two streams (when alpha is present) as input (first one being
> >>>> the YUV planes and the second one being the alpha plane).
> >>>>
> >>>> The input has to come from two different images (one of it color and
> >>>> the other one being alpha), or it can come from a single file
> >>>> source with the alpha channel extracted using the "alphaextract"
> >>>> filter.
> >>>>
> >>>> Example using alphaextract:
> >>>> ffmpeg -i rgba.png -filter_complex "[0:v]alphaextract[a]" -map 0 -map "[a]" -still-picture 1 avif_with_alpha.avif
> >>>>
> >>>> Example using two sources (first source can be in any pixel format and
> >>>> the second source has to be in monochrome grey pixel format):
> >>>> ffmpeg -i color.avif -i grey.avif -map 0 -map 1 -c copy avif_with_alpha.avif
> >>>>
> >>>> The generated files pass the compliance checks in Compliance Warden:
> >>>> https://github.com/gpac/ComplianceWarden
> >>>>
> >>>> libavif (the reference avif library) is able to decode the files
> >>>> generated using this patch.
> >>>>
> >>>> They also play back properly (with transparent background) in:
> >>>> 1) Chrome
> >>>> 2) Firefox (only still AVIF, no animation support)
> >>>>
> >>>> Signed-off-by: Vignesh Venkatasubramanian <vigneshv at google.com>
> >>>> ---
> >>>>   libavformat/movenc.c | 188 +++++++++++++++++++++++++++++--------------
> >>>>   libavformat/movenc.h |   4 +-
> >>>>   2 files changed, 130 insertions(+), 62 deletions(-)
> >>>>
> >>>
> >>> lgtm.
> >>> _______________________________________________
> >>> ffmpeg-devel mailing list
> >>> ffmpeg-devel at ffmpeg.org
> >>> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
> >>>
> >>> To unsubscribe, visit link above, or email
> >>> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".
> >>
> >> Any more comments on this? If not can this be merged please? :)
> >>
> >
> > Another ping on this please.
> >
> >> --
> >> Vignesh
>
> I thought James Zern had push access, which is why i didn't apply it as
> soon as he reviewed it. Sorry.
>
> Pushed it now.
>

Thanks!
 _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request at ffmpeg.org with subject "unsubscribe".



-- 
Vignesh


More information about the ffmpeg-devel mailing list