<video autoplay muted loop playsinline> element, keep it short and sized to how it is displayed, and give Safari a separate HEVC-with-alpha file or a still image. In our tests a 720p transparent loop cost 0.07–0.10 MB per second.What it looks like when it works

The HTML
<video src="presenter.webm" autoplay muted loop playsinline width="640" height="360"></video>
mutedis required for autoplay in current browsers.playsinlinestops iPhones opening the video full screen.widthandheightreserve the space, so the page does not jump when the video loads.- Do not set a background colour on the video element or its container unless you want one — the transparency shows whatever is behind the element.
Serving Safari
Safari plays WebM but ignores its alpha, so the background appears. Give Safari a transparent PNG still or an HEVC-with-alpha file instead. HEVC with alpha has to be made with Apple’s tools: FFmpeg’s libx265 encoder has no alpha mode, and in our test it silently wrote an opaque file when asked for one. Listing both files as <source> elements is less predictable than it looks, because some browsers can decode HEVC without its alpha; transparent video in Safari has a small script that picks the right file.
Keep it small, with numbers
Measured on a real 1080p background-removal result, per second of video:
| Encode | MB per second | A 6-second loop |
|---|---|---|
| 1080p, CRF 24 | 0.40 | 2.4 MB |
| 1080p, CRF 32 | 0.23 | 1.4 MB |
| 720p, CRF 32 | 0.10 | 0.6 MB |
| 720p, CRF 36 | 0.07 | 0.4 MB |
- Export at display size. A presenter shown 640 pixels wide does not need 1080p; scaling to 720p cut the file by more than half.
- Raise CRF before anything else. In our test CRF 24 to 40 shrank the file by three quarters while the alpha edges changed by less than 0.1 dB.
- Keep loops short. 3–8 seconds is usually enough for a presenter or product loop.
- Drop the audio with
-anwhen encoding; autoplaying video is muted anyway.
Loading without slowing the page
- Add
preload="none"orpreload="metadata"for videos below the fold, and start them when they scroll into view. - Give the element a
posterwith a transparent PNG of the first frame, so something appears before the video loads. - Serve WebM with the
video/webmcontent type, and with long cache headers if the file name changes when the content does.
Respect reduced motion
Some visitors ask their system to reduce motion. Honour it by pausing the video for them:
if (matchMedia('(prefers-reduced-motion: reduce)').matches) document.querySelector('video').pause();
In React and other frameworks
The same attributes apply. In React, write them in camelCase — autoPlay muted loop playsInline — and note that React sets muted as a property, which some browsers check before allowing autoplay; if autoplay does not start, set video.muted = true in an effect before calling play().
Checking it works
Put the page’s background on something loud — red, as in the screenshot above — and load it in Chrome, Firefox and Safari. If the colour shows around the subject, the alpha is working there. To check the file itself, use the free transparency checker.
Getting the file
Upload a clip to our video background remover for a transparent WebM, or convert an existing alpha export with the free converters. If you start from ProRes 4444, the ProRes to WebM guide has the FFmpeg command.
How we tested
November 7, 2026: FFmpeg 6.1.1 with libvpx 1.14, and headless Chromium 145 via Playwright on Ubuntu. Source: a 1920×1080 background-removal result from this site. The page was a plain HTML file with a red background and two muted, autoplaying, looping videos.
Common questions
How do I add a transparent video to a website?+
Use a WebM with VP9 alpha in a video element with autoplay, muted, loop and playsinline. Chrome, Firefox and Edge show the page through its transparent areas; Safari needs a separate file.
Why does my transparent video show a black box on my site?+
The file is most likely an MP4, which has no alpha: in our Chromium test the MP4 showed a black box where the WebM showed the page. Use a WebM with alpha, and check it with the transparency checker.
How big should a transparent website video be?+
Aim for well under 1 MB for a short loop. In our test a 720p transparent WebM was 0.07 to 0.10 MB per second, so a 6-second loop came to about half a megabyte.
Why doesn't my transparent video autoplay?+
Browsers only autoplay muted video. Add the muted attribute, and playsinline for iPhones. In React, also set the muted property in code if autoplay still does not start.
Does a transparent WebM work in Safari?+
No. Safari plays the video but ignores the alpha. Serve Safari an HEVC file with alpha, made with Apple's tools, or a transparent PNG still.