Skip to content
Limited timeStarter is now $9 a month instead of $20.See plans
charmotion

How to Serve Transparent WebM with HEVC Alpha .mov Fallback for Safari & iOS

By the Charmotion team · Updated · How we write guides

Cover illustration for the guide: How to Serve Transparent WebM with HEVC Alpha .mov Fallback for Safari & iOS, with Charmotion demo characters

Serve a transparent WebM fallback pair: a VP9 WebM with an alpha channel for Chrome, Edge and Firefox, and an HEVC with alpha .mov for Safari and iOS. Choose the source order by browser, because Safari can play WebM but has been reported to ignore its transparency, so a plain source list would lose the alpha.

Key takeaways

  • Publish two files: a VP9 WebM with alpha for Chrome, Edge and Firefox, and an HEVC with alpha .mov for Safari and iOS.
  • Safari has been reported to ignore WebM alpha, so the source order has to change by browser.
  • Encode the WebM with yuva420p and -auto-alt-ref 0, and encode the .mov with FFmpeg's hvc1 command or Apple's export preset.
  • Apple's HEVC alpha material dates from WWDC19, so test on real Safari, iPhone and iPad devices before launch.

Why does Safari need a different file from Chrome?

Transparent video needs a file format that stores the alpha channel, and the two common options split along browser lines. WebM encoded with VP8 or VP9 can carry a per-pixel alpha channel. Google's Chrome team says Chrome 31 added alpha transparency support for WebM video, and Svgator's guide reports that Chrome, Edge and Firefox show the alpha of a VP8 or VP9 WebM.

Safari is the exception. Svgator's guide says Safari ignores the alpha channel in these files, and Apple does not document WebM alpha for Safari (as of December 2026). A transparent WebM therefore looks correct in Chrome and wrong in Safari.

Apple's route is HEVC with alpha. Apple introduced it for Safari on iOS 13 and macOS Catalina, according to WWDC19 session 506. The alpha layer sits in the same video track as the picture. A player that does not understand the alpha layer displays only the base video layer, so a browser that plays the .mov without alpha support shows no transparency.

The fix is to publish both files and let each browser take the one that keeps transparency for it. The rest of this guide covers encoding, the markup and script that choose the file, and testing. For a wider comparison of MP4 and HEVC options, read transparent MP4 and HEVC with alpha. For AI-generated clips, which often arrive without alpha at all, see AI video generators with a transparent background.

How do you encode a transparent WebM with VP9?

Start from a source file that already has an alpha channel, such as a transparent MOV or an export from your animation tool. Then encode with FFmpeg's libvpx-vp9 encoder and an alpha-capable pixel format. This recipe is a commonly shared one, and it gives a file that plays with transparency in Chrome, Edge and Firefox.

ffmpeg -i input.mov -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M output.webm
  • -c:v libvpx-vp9 selects the VP9 encoder. VP8 WebM can also carry alpha, but this recipe targets VP9.
  • -pix_fmt yuva420p keeps the alpha plane. Without an alpha-capable format, the transparent layer is discarded and replaced with a black or white background.
  • -auto-alt-ref 0 turns off alternate reference frames. Enabled alt-ref frames can cause rendering glitches or strip the alpha channel.
  • -b:v 2M sets a target bitrate of 2 Mbps. Raise it for detailed artwork and lower it for flat shapes.

When you read a transparent WebM back into FFmpeg, for example to convert it into another format, place -c:v libvpx-vp9 before -i. FFmpeg's native VP9 decoder drops the alpha, and a decoded PNG comes out on solid black.

Do not rely on the browser to create alpha. Chrome's WebCodecs VideoEncoder rejects the keep alpha setting for every codec, including VP9, so encode the WebM ahead of time with FFmpeg. If you need to turn a finished clip into other sizes or frame rates, the steps in how to convert a video without losing quality apply here too.

How do you encode the HEVC with alpha .mov for Safari?

On macOS, FFmpeg 4.4.1 or newer can write HEVC with alpha using Apple's hardware encoder, according to the DeNA HEVCPlayerView README. The command below is the one that README gives, with the input and output names changed to match the WebM example.

ffmpeg -i input.mov -c:v hevc_videotoolbox -require_sw 1 -allow_sw 1 -alpha_quality 0.5 -vtag hvc1 hevc.mov

Keep the flags as written. The -vtag hvc1 option sets the tag that Apple software looks for on HEVC files, and without it Safari may not treat the file as HEVC. The output is a QuickTime .mov, which you serve with a video/quicktime source type.

Apple also offers two other routes on a Mac. The AVFoundation export preset AVAssetExportPresetHEVC1920x1080WithAlpha writes a 1920 by 1080 movie that contains HEVC video with alpha and AAC audio. Apple ships the avconvert command-line tool for the same job, which the DeNA README names; read its options from the tool's own help on your Mac, because this guide does not list its flags.

The alpha layer is stored with the picture in one video track, so there is only one file to host for Safari. Keep its dimensions, frame rate and timing identical to the WebM. Then the switch between the two files is invisible to the viewer.

Charmotion exports the same pair for its characters: transparent WebM (VP9 alpha) and transparent MOV (HEVC alpha), on demand from the character page or with the export_videos MCP tool, in about a minute. Exports do not use credits. For the page-level side of placing a transparent clip, see transparent video on websites, Safari included.

How to make transparent WebM video work on Safari with HEVC alpha fallback?

Use one video element with playsinline and muted, as the DeNA README does for Safari playback. Then add the two sources in an order chosen by browser. Chrome, Edge and Firefox get the WebM first. Safari gets the .mov first, so it never starts with the WebM it would play without transparency.

A static list of source elements cannot make that choice, because the browser takes the first source it can play, and Safari can play WebM. A short script sets the order at load time.

<video id='hero' playsinline muted loop autoplay width='512' height='512'></video>
<script>
const isSafari = /^((?!chrome|chromium|android|crios|fxios|edg).)*safari/i.test(navigator.userAgent);
const webm = ['/video/mascot.webm', 'video/webm'];
const hevc = ['/video/mascot-hevc.mov', 'video/quicktime'];
const sources = isSafari ? [hevc, webm] : [webm, hevc];
const video = document.getElementById('hero');
for (const [src, type] of sources) {
  const source = document.createElement('source');
  source.src = src;
  source.type = type;
  video.appendChild(source);
}
</script>
  • The Safari test is a user agent check. It excludes Chrome, Chromium, Android, CriOS, FxiOS and Edg, so Chrome and Edge on iOS and desktop are not treated as Safari. Apple does not document a feature test for HEVC alpha that a page could use instead (as of December 2026).
  • Only the order changes between browsers. The files, the markup and the attributes stay the same.
  • If the first source fails to load, the browser moves to the second one, so the fallback still plays.
  • Use the same dimensions and frame rate in both files, so the swap does not change the layout. This is a practical recommendation, not a documented requirement.

Do not add the .mov as a plain second source in a static list and expect Safari to pick it. Safari plays WebM, so it would take the WebM and lose its transparency. For a broader look at how transparent clips behave across hosts and formats, see what actually works for transparent MP4 and HEVC.

How do you test the fallback on Safari, iOS and other browsers?

Test on real devices. A desktop Safari window confirms the macOS decode path, but iPhone and iPad need their own check. Place each file on a page with a strong background colour, such as bright magenta, so a black, white or grey box is easy to see.

Browser or deviceFile it should playWhat to look for
Safari on macOSHEVC .movNo box around the character; the page colour shows through the edges
Safari on iPhone and iPadHEVC .movThe same check, playing inline because of playsinline
Chrome on desktopWebMTransparent edges over the page colour
Firefox and Edge on desktopWebMThe same result as Chrome
Chrome on iOS and in-app browsersWhichever source loadsTest each one you support; Apple's HEVC alpha documentation covers Safari only
  • If the background turns black or white in Chrome, check the WebM pixel format first and re-encode with yuva420p.
  • If Safari shows a box, confirm that the .mov is first in its source order. Then confirm the .mov was encoded with the alpha option.
  • To test the fallback, block the first source in your browser's developer tools network panel, reload, and confirm that the second source plays.

Apple's HEVC alpha documentation and the WWDC19 session date from 2019. Apple does not document the file size, resolution, frame rate or bitrate limits for HEVC with alpha (as of December 2026), so test your own file on the current Safari and iOS releases you can get. The transparent video checker on this site is a quick way to review a file before you deploy it.

Which mistakes break transparency in these files?

Most failures come from a short list of causes. Check these before you blame the browser.

  • Missing yuva420p. The transparent layer is replaced with a black or white background.
  • Alternate reference frames left on. They can strip the alpha channel or cause glitches, so keep -auto-alt-ref 0.
  • The .mov listed second for everyone. Safari plays the WebM and ignores its alpha.
  • The WebM listed first for everyone. Safari is reported to ignore WebM alpha, so Safari users lose transparency.
  • Missing -vtag hvc1. Apple software looks for that tag on HEVC files.
  • Encoding alpha in the browser. Chrome's WebCodecs VideoEncoder rejects the keep alpha setting for every codec.
  • Assuming HEVC alpha plays everywhere. Apple documents it for Safari, and other browsers generally do not render the alpha layer, so Chrome and Firefox need the WebM.

Keep the two files in one folder with matching names, such as mascot.webm and mascot-hevc.mov, and reuse them wherever the character appears. For a wider set of motion options on mascots, see how to make an animated mascot for your app.

Serve transparent WebM with an HEVC alpha .mov fallback

  1. Encode the WebM with VP9 and alpha. Run FFmpeg with -c:v libvpx-vp9, -pix_fmt yuva420p, -auto-alt-ref 0 and a bitrate such as -b:v 2M to produce output.webm from a source that has an alpha channel.
  2. Encode the HEVC with alpha .mov. On macOS, run FFmpeg 4.4.1 or newer with hevc_videotoolbox, -alpha_quality 0.5 and -vtag hvc1 to produce hevc.mov, or use Apple's AVAssetExportPresetHEVC1920x1080WithAlpha preset.
  3. Match the two files. Keep the same dimensions, frame rate and timing in the WebM and the .mov so the switch between them is invisible.
  4. Add the video element and the browser-based source order. Use a video element with playsinline and muted, then append the WebM first for most browsers and the .mov first for Safari using the short script in the guide.
  5. Test on real devices. Place each file on a bright background and check Safari on macOS, iPhone and iPad, and Chrome, Firefox and Edge for black or white boxes, then block the first source to confirm the fallback plays.

Frequently asked questions

Can I serve only the HEVC .mov and skip the WebM?

Not for most visitors. Apple documents HEVC with alpha for Safari, and other browsers generally do not render its alpha layer, so Chrome, Edge and Firefox need the WebM. Keep both files and choose between them by browser.

Does the Apple export preset keep audio?

Apple's documentation for AVAssetExportPresetHEVC1920x1080WithAlpha says it exports a 1920 by 1080 movie with HEVC video with alpha and AAC audio. The FFmpeg command in this guide sets only video options, so check the audio in the output file.

Is WebM transparency supported in Safari?

Apple does not document WebM alpha for Safari (as of December 2026). Svgator's guide reports that Safari ignores the alpha channel in VP8 and VP9 WebM files. Keep the HEVC .mov for Safari and test on the versions your audience uses.

Why does my transparent WebM show a black box?

A common cause is a missing or wrong pixel format. Without yuva420p in the FFmpeg command, the transparent layer is replaced with a black or white background. Re-encode with that flag and check the result in Chrome before you publish.

Sources

Related guides