summaryrefslogtreecommitdiff
path: root/libavformat/movenc.h
diff options
context:
space:
mode:
authorVignesh Venkatasubramanian <vigneshv@google.com>2022-06-01 11:05:56 -0700
committerJames Almer <jamrial@gmail.com>2022-06-27 13:46:33 -0300
commit2a3640de84975398b1169d29530274cdd38b3939 (patch)
tree3edc1cea0709d0fbf5cc72a4b41fe45adeb1c6d9 /libavformat/movenc.h
parenta526f0cc3ac938364afe8ce62c4bc47d3b9bb2af (diff)
avformat/movenc: Support alpha channel for AVIF
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) Reviewed-by: James Zern <jzern@google.com> Signed-off-by: Vignesh Venkatasubramanian <vigneshv@google.com>
Diffstat (limited to 'libavformat/movenc.h')
-rw-r--r--libavformat/movenc.h4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/movenc.h b/libavformat/movenc.h
index 281576cc66..e4550f7900 100644
--- a/libavformat/movenc.h
+++ b/libavformat/movenc.h
@@ -246,8 +246,8 @@ typedef struct MOVMuxContext {
int empty_hdlr_name;
int movie_timescale;
- int64_t avif_extent_pos;
- int avif_extent_length;
+ int64_t avif_extent_pos[2]; // index 0 is YUV and 1 is Alpha.
+ int avif_extent_length[2]; // index 0 is YUV and 1 is Alpha.
int is_animated_avif;
} MOVMuxContext;