Transparency
Codecs
Not many video codecs have native support for transparency / alpha channels. Formats supported by some platforms of AVPro Video are:
- HEVC+Alpha
- Requires macOS 10.15, iOS 13.0 or tvOS 13.0
- Hap
- Only supported in Ultra edition
- Hap Alpha
- Great support on Windows and macOS. Fast and low overhead format, though file size can get large depending on the content. Currently this is the format we recommend for transparent video.
- Hap Q Alpha
- Great support on Windows and macOS. Slightly higher quality and file size compared to Hap Alpha.
- NotchLC
- Only supported in Ultra edition
- Uncompressed RGBA / YUVA
- Uncompressed isn’t ideal for file size or disk bandwidth but can still be used as a fallback
- ProRes 4444
- Best support is on macOS. Files can be huge though.
- VP6
- Legacy format. We support it only via 3rd party DirectShow plugins for Windows (eg LAV Filters)
Alpha Packing
Perhaps the best option is to encode your videos in video formats that don’t support an alpha channel (eg MP4 as H.264 or HEVC) by packing the alpha channel into the same frame. You can double the width for a left-right packing layout, or double the height for a top-bottom packing layout. This packing could be created in software such as AfterEffects, or the command-line FFMPEG tool can be used.
The packing format is then specified either in the MediaReference or MediaPlayer as part of the MediaHints:
Authoring Videos with Alpha Packing
Exporting
Note
Export using the "straight" and not "premultiplied" alpha mode. AVPro Video shaders only support straight alpha.
Note
For best results, pad the video size to a multiple to 16 pixels. This will guarantee accurate alpha channel extraction on all platforms.
Usually you export your transparent video from your favourite software (eg After Effects). A codec that supports transparency such as ProRes4444 can be used. Make sure to use "straight" alpha mode. Then another tool such as FFMPEG can be used to convert that video into the packed alpha layout.
Alpha Packing with FFMPEG
FFMPEG command-line can be used to convert a source video containing a transparency/alpha channel into an alpha packed format:
Left-right alpha packing:
ffmpeg -i input.mov -vf "split [a], pad=iw*2:ih [b], [a] alphaextract, [b] overlay=w" -y output-lr.mp4
Top-bottom alpha packing:
ffmpeg -i input.mov -vf "split [a], pad=iw:ih*2 [b], [a] alphaextract, [b] overlay=0:h" -y output-tb.mp4