Web engineering · Dual-codec alpha

How to Embed a Transparent Video on a Website (Chrome, Firefox & Safari)

Updated November 21, 2026

No single transparent video codec works across every browser today. Reliable transparent video on the web pairs an HEVC-with-alpha source for Safari with a VP9-with-alpha WebM source for Chrome, Edge, and Firefox inside one standard HTML <video> element—backed by a transparent WebP or PNG poster.

Transparent VP9 WebM overlay rendered cleanly against a website page surface
Test live VP9 WebM transparency over white, dark, and brand-colored surfaces in the interactive checker below.
Dual-source HTML5 <video>
Chrome/Edge/Firefox VP9 WebM
Safari HEVC (hvc1) alpha
Core Web Vitals safe
Core architecture

Why one file fails—and why MIME type and <source> order matter

Browsers pick the first `<source>` entry whose MIME type and `codecs` parameter they claim to support. Putting Safari’s HEVC-with-alpha QuickTime source (`type='video/quicktime; codecs="hvc1"'`) first and Chrome/Firefox’s VP9 WebM (`type='video/webm; codecs="vp9"'`) second lets Safari grab its hardware-accelerated alpha track while Chromium and Firefox skip straight to VP9 WebM.

Watch out for a subtle Chrome-on-macOS trap: modern Chrome supports hardware-decoded HEVC (`video/mp4; codecs="hvc1"`), so labeling the first source `video/mp4; codecs="hvc1"` can trick Chrome into picking the HEVC track and playing it WITHOUT the Apple auxiliary alpha layer (producing a solid black box). Using a `.mov` container declared as `video/quicktime; codecs="hvc1"` prevents Chrome and Firefox from matching it, while ensuring Safari recognizes the `hvc1` tag (never `hev1`).

Generate transparent WebM with AIDiagnose black backgrounds

Compare the actual files

Two WebM files. Only one lets the background through.

Play the clips, then change the background beneath them. The transparent result should reveal your chosen color; the flattened version should keep its dark rectangle. Posters appear until playback starts, so evaluate the moving video before drawing a conclusion.

Transparent export

Checkerboard selected in the local tool; transparent WebM downloaded.

Download alpha.webm

Press Play to load the video before inspecting its pixels.

Flattened export

Black selected in the same tool; the background becomes part of the frames.

Download flattened.webm

Press Play to load the video before inspecting its pixels.

Test your own video locally

Check whether your exported file still has an alpha channel

Drop or select a local WebM, MOV, or MP4 clip. Pixels are scanned automatically inside your browser tab—no file upload.

Both clips use the same synthetic 640 × 360, three-second moving graphic and color-key settings. These are actual VideoCutout local-tool exports made October 26, 2026, not filmed subjects or an AI-removal quality comparison. They contain a quiet test tone and start muted.

The pixel check samples (20, 20), a known background point in these clips. It checks one decoded frame in this browser; it does not certify every frame, edge, or receiving editor. Changing the comparison background does not change the downloaded files.

Format references checked October 26, 2026: Chrome: alpha video playback · Apple: ProRes codecs · Apple: HEVC with alpha · MDN: reading decoded pixels.

Implementation order

Ship cross-browser transparent video in four steps

01

Create a clean transparent master

Start from a transparent WebM (for example, exported from VideoCutout AI removal or local chroma key) or a ProRes 4444 master from your desktop editor. Keep dimensions realistic for the rendered CSS slot—typically 480–960 px wide for floating UI callouts.

02

Prepare both browser delivery encodes + a transparent poster

Encode VP9 WebM (`yuva420p`) for Chromium/Firefox and HEVC with alpha (`hvc1`) for Safari/iOS. Export the first frame as a compressed transparent WebP (or PNG) for the `poster` attribute so the element never flashes an empty box before playback.

03

Embed with muted, playsInline, and explicit codec strings

Include `muted`, `playsInline`, `autoPlay`, and `loop` for ambient UI animations, set explicit `width` and `height` to prevent Cumulative Layout Shift (CLS), and keep `hvc1` listed before `vp9` inside `<video>`.

04

Verify over both light and dark themes + reduced motion

Check the live page in Chrome, Firefox, and Safari on both desktop and iOS. Confirm edges show no dark halo on light backgrounds, pause offscreen clips with `IntersectionObserver`, and respect `prefers-reduced-motion` by showing the static transparent poster.

Cross-browser matrix

Alpha video codec support across major web browsers

Decision pointWebM VP9 (yuva420p)HEVC with Alpha (hvc1)
Chrome & Edge (Desktop/Android)Supported (native alpha playback)Alpha track not reliably decoded across platforms
Firefox (Desktop)Supported (native alpha playback)Not supported for HEVC alpha
Safari (macOS & iOS)Not supported for VP9 alphaSupported natively (macOS Catalina+ / iOS 13+)
Typical file size vs animated GIFUsually 70–90% smaller with smooth 8-bit alphaComparable compact size with smooth 8-bit alpha
Fallback when unsupportedTransparent WebP/PNG poster or Animated WebPTransparent WebP/PNG poster or Animated WebP
Copy-paste markup

Production HTML5 <video> element for transparent web overlays

Set `background: transparent` explicitly on the `<video>` element and avoid CSS `box-shadow` on the rectangle container (use CSS `filter: drop-shadow(...)` instead if you want a shadow that follows the cutout silhouette rather than the rectangular video frame).

Always declare `width` and `height` attributes matching the encoded aspect ratio so the browser reserves layout space immediately and protects Cumulative Layout Shift (CLS).

Cross-browser transparent HTML5 <video>
<video
  width="640"
  height="360"
  poster="/media/hero-cutout-poster.webp"
  autoplay
  loop
  muted
  playsinline
  preload="metadata"
  style="background: transparent;"
>
  <source src="/media/hero-cutout-hevc.mov" type='video/quicktime; codecs="hvc1"' />
  <source src="/media/hero-cutout-vp9.webm" type='video/webm; codecs="vp9"' />
</video>
Keep `video/quicktime; codecs="hvc1"` first so Safari plays HEVC alpha while Chrome (including macOS builds with hardware HEVC), Edge, and Firefox ignore QuickTime and fall cleanly to VP9 WebM.
Encoding recipe

Convert a ProRes 4444 master to web-ready VP9 WebM with alpha

If you start from a transparent WebM already exported by VideoCutout, it is already VP9 alpha ready for Chrome, Edge, and Firefox. If you are converting a large ProRes 4444 MOV from After Effects or Final Cut Pro, use FFmpeg with `libvpx-vp9` and `-pix_fmt yuva420p`—omitting `yuva420p` drops the alpha plane silently.

For Safari’s HEVC-with-alpha `.mov`, Apple’s `avconvert` command on macOS (for example `avconvert --preset PresetHEVC1920x1080WithAlpha`) or Compressor encodes a compliant `hvc1` alpha stream directly from a ProRes 4444 master.

FFmpeg ProRes 4444 → Transparent VP9 WebM
ffmpeg -i master-prores4444.mov \
  -c:v libvpx-vp9 -pix_fmt yuva420p \
  -crf 32 -b:v 0 -auto-alt-ref 0 \
  -an hero-cutout-vp9.webm
Setting `-auto-alt-ref 0` prevents libvpx-vp9 from dropping alpha frames in some encoder builds; `-an` strips unused audio tracks to save bytes on muted web loops.
Core Web Vitals

Keep transparent video from hurting LCP, battery, and SEO

A 15 MB transparent hero loop can easily stall mobile networks and delay Largest Contentful Paint (LCP). Keep looping UI overlays short (2–6 seconds), crop tightly around the subject instead of encoding huge empty transparent margins, cap frame rate at 24–30 fps, and target under 1–2 MB per clip.

For above-the-fold elements, preload the lightweight transparent WebP `poster` so LCP paints instantly from the static image while the video streams asynchronously. For below-the-fold animations, use `preload="none"` and start/pause playback with `IntersectionObserver` so offscreen videos consume zero GPU or bandwidth.

Extract a crisp WebP poster with Video to Image ConverterCompare transparent WebM vs GIF

  • Crop dead transparent margins to reduce decoded pixel area and file size
  • Strip audio (`-an`) on muted UI loops to cut bitrate and decoding work
  • Use a compressed transparent WebP poster for instant LCP paint
  • Pause offscreen videos via IntersectionObserver and honor `prefers-reduced-motion`
Questions

Transparent website video FAQ

Why not just use an animated GIF or animated WebP on a website?+

GIF only supports 256 colors and jagged 1-bit binary transparency, and files grow huge at high resolution. Animated WebP supports smooth alpha and works well for tiny UI icons (under ~300 px), while dual-source WebM VP9 + HEVC alpha stays much smaller and smoother for larger 480–960 px motion overlays.

Does `autoplay` work on mobile iOS and Android browsers?+

Yes, provided the `<video>` element includes both `muted` and `playsinline` attributes. Without `playsinline`, iOS Safari attempts to open the video in a fullscreen opaque player.

How do I add a drop shadow around the cutout subject instead of the rectangle?+

Apply CSS `filter: drop-shadow(0 12px 24px rgba(0,0,0,0.22))` to the `<video>` element. Unlike `box-shadow`, `drop-shadow` traces the alpha silhouette of the decoded video frame.

Can VideoCutout generate the transparent WebM for my website directly?+

Yes. Upload ordinary MP4, MOV, WebM, or GIF footage to VideoCutout AI background removal for transparent WebM output, or use the free local Green Screen Remover when your clip was filmed against a solid green or blue backdrop.

What if I only have WebM VP9 and cannot encode HEVC for Safari yet?+

On Safari, a WebM-only `<video>` element will fall back to the `poster` image if Safari cannot decode the source. Supplying a clean transparent WebP poster ensures Safari users still see a crisp transparent visual instead of a black box while you prepare an HEVC alpha encode.