---
title: "Encode HEVC video with alpha (ffmpeg, avconvert)"
description: "Encode HEVC video with alpha on a Mac with ffmpeg’s hevc_videotoolbox or avconvert, check the alpha survived, and add a VP9 WebM for Chrome and Firefox."
canonical: "https://setskit.com/guides/encode-hevc-alpha-video"
updated: "2026-11-30"
---

# Encode HEVC video with alpha (ffmpeg, avconvert)

> To encode transparent video for Safari and iOS you need a Mac, because HEVC with alpha comes from Apple’s own encoder. For HEVC alpha with ffmpeg, use hevc_videotoolbox with -alpha_quality above 0 and -tag:v hvc1, or convert a ProRes 4444 master with avconvert and its PresetHEVCHighestQualityWithAlpha. Add a VP9 WebM in yuva420p for Chrome and Firefox, and list the HEVC source first.

Updated 2026-11-30. Source: https://setskit.com/guides/encode-hevc-alpha-video

Apple’s encoder on a Mac, two commands and a check.

Lifts shown: [Barbell lunge](https://setskit.com/exercises/barbell-lunge), [Kettlebell windmill](https://setskit.com/exercises/kettlebell-windmill), [Dumbbell front raise](https://setskit.com/exercises/dumbbell-front-raise)

## What you need

A Mac. HEVC with alpha is written by Apple’s VideoToolbox encoder, which ffmpeg reaches through hevc_videotoolbox, and avconvert ships with macOS.

Start from frames that carry alpha: an RGBA PNG sequence or a ProRes 4444 movie. We ran every command on this page on an M1 Mac with macOS 27.2.1 and FFmpeg 8.0 from Homebrew.

FFmpeg 8.0 also added alpha layer encoding through libx265, but only with an x265 built for it. The Homebrew build we tried refused, and we have not tested how Apple devices play that output.

## HEVC alpha with ffmpeg

-alpha_quality is the flag that matters. It defaults to 0, and at 0 ffmpeg asks VideoToolbox for plain HEVC, so the file plays with an opaque background and no warning.

ffmpeg passes the value to Apple’s TargetQualityForAlpha setting, whose documentation says: "Specify this value as a number in the range of 0.0 for the lowest quality to 1.0 for nearly lossless quality."

-tag:v hvc1 matters as much. Without it ffmpeg writes the hev1 tag into the .mov, and AVFoundation reported our hev1 file as not playable.

-q:v sets constant quality, and the encoder source allows it only on Apple silicon Macs. On an Intel Mac, give a bitrate such as -b:v 2M instead.

```bash
ffmpeg -framerate 30 -i frames/frame_%04d.png \
  -c:v hevc_videotoolbox -alpha_quality 0.75 -q:v 65 \
  -tag:v hvc1 clip.mov
```

## From ProRes 4444 with avconvert

avconvert is Apple’s command-line converter, at /usr/bin/avconvert. Its PresetHEVCHighestQualityWithAlpha mirrors the AVFoundation export preset of the same name, available from iOS 13 and macOS 10.15.

It has no quality setting. The sized presets, such as PresetHEVC1920x1080WithAlpha, did not scale our 720 by 720 clip up, so they gave the same file.

If you only have PNGs, the first command below makes the ProRes 4444 master. The ffmpeg command above also accepts ProRes 4444 in place of the PNG sequence.

```bash
# PNG sequence to a ProRes 4444 master, if you need one
ffmpeg -framerate 30 -i frames/frame_%04d.png \
  -c:v prores_ks -profile:v 4444 -pix_fmt yuva444p10le master.mov

# ProRes 4444 to HEVC with alpha
avconvert --source master.mov --preset PresetHEVCHighestQualityWithAlpha \
  --output clip.mov --replace

# list every preset
avconvert --help
```

## Check that alpha survived

Don’t trust the stream line. ffprobe reported yuv420p for our HEVC files with and without alpha, because the alpha travels as a second layer.

Decode a frame instead. FFmpeg 8.0 decodes the alpha layer, so showinfo prints yuva420p, and alphaextract fails on a file that has no alpha.

On a Mac, AVFoundation has the last word. A track with alpha has the containsAlphaChannel media characteristic, from iOS 13 and macOS 10.15.

For WebM, ffprobe does show it, as an alpha_mode tag of 1. Put -c:v libvpx-vp9 before the input when decoding, because ffmpeg’s built-in VP9 decoder drops the alpha.

```bash
# HEVC: prints fmt:yuva420p when the alpha is there
ffmpeg -i clip.mov -frames:v 1 -vf showinfo -f null - 2>&1 | grep -o 'fmt:[a-z0-9]*'

# HEVC: fails with "Requested planes not available" when it is not
ffmpeg -v error -i clip.mov -frames:v 1 -vf alphaextract -f null -

# WebM: prints 1 when the alpha is there
ffprobe -v error -show_entries stream_tags=alpha_mode -of csv=p=0 clip.webm

# WebM: decode with libvpx to see the alpha plane
ffmpeg -c:v libvpx-vp9 -i clip.webm -frames:v 1 -vf showinfo -f null - 2>&1 | grep -o 'fmt:[a-z0-9]*'
```

## VP9 WebM for Chrome and Firefox

Chrome and Firefox play VP9 with alpha in WebM. Encode with libvpx-vp9 and the yuva420p pixel format, which is what keeps the alpha.

-crf with -b:v 0 is constant quality, as the comment in ffmpeg’s libvpx wrapper says, and -row-mt 1 spreads the work across cores. FFmpeg 8.0 reads the alpha from an HEVC .mov, so the transparent file you already have can be the source.

```bash
ffmpeg -i clip.mov -c:v libvpx-vp9 -pix_fmt yuva420p \
  -crf 32 -b:v 0 -row-mt 1 -an clip.webm
```

## Source order in the video element

MDN’s reference for the source element puts the rule plainly: "It uses the first one it can display."

Safari plays VP9 but not its alpha, so it would happily take the WebM and show an opaque box. List the HEVC first, then the WebM, then an ordinary MP4 for anything else.

Muted and playsinline let the loop autoplay on phones. Test the page in every browser you support, because the type strings decide who takes which file.

```html
<video autoplay muted loop playsinline width="360" height="360" poster="clip-poster.png">
  <source type="video/quicktime; codecs=hvc1.1.6.H120.b0" src="clip.mov">
  <source type="video/webm; codecs=vp09.00.41.08" src="clip.webm">
  <source type="video/mp4" src="clip.mp4">
</video>
```

## Sizes for a 720x720 clip

We encoded one Setskit lift, 720 by 720 at 30 fps and close to the library’s 3-second median, every way on this page. The frames came from an already compressed clip, so read the numbers as a comparison, not a promise.

-alpha_quality alone moves the size a lot. At -q:v 65, our clip was 336 KB at 0.5 and 666 KB at 0.9.

Over a dark background, the avconvert, -q:v 50 and VP9 files all kept clean edges and the soft floor shadow. Judge your own clips the same way, over the darkest background your app uses.

Setskit’s own transparent .mov files average 1,124 KB a lift, against 222 KB for the MP4. Every lift already ships as HEVC with alpha, so for those clips only the WebM is yours to make.

- **222 KB** the average Setskit lift as MP4
- **1,124 KB** the average lift as HEVC with alpha

Our clip at -q:v 65, by -alpha_quality

|  | KB |
| --- | --- |
| -alpha_quality 0.5 | 336 |
| -alpha_quality 0.75 | 460 |
| -alpha_quality 0.9 | 666 |

One 720 by 720 lift, encoded with hevc_videotoolbox on an M1 Mac. 0.75 is the value in this guide’s ffmpeg command.

| File | Settings | Size |
| --- | --- | --- |
| PNG sequence (source) | RGBA frames | 11.3 MB |
| ProRes 4444 master | prores_ks, yuva444p10le | 17.2 MB |
| HEVC with alpha, avconvert | PresetHEVCHighestQualityWithAlpha | 992 KB |
| HEVC with alpha, ffmpeg | -alpha_quality 0.75, default rate | 649 KB |
| HEVC with alpha, ffmpeg | -alpha_quality 0.75 -q:v 65 | 460 KB |
| HEVC with alpha, ffmpeg | -alpha_quality 0.75 -q:v 50 | 326 KB |
| VP9 WebM with alpha | -crf 32 -b:v 0 | 316 KB |

## Known issues

Each of these came up in our own runs or in the ffmpeg source.

- -alpha_quality left at 0 gives opaque HEVC, with no warning.
- Without -tag:v hvc1, ffmpeg writes hev1 and AVFoundation will not play the file.
- -q:v works only on Apple silicon. On an Intel Mac ffmpeg stops and asks for -b:v.
- ffprobe’s stream line shows yuv420p even when the alpha is there.
- ffmpeg’s built-in VP9 decoder ignores alpha, so decode WebM with libvpx-vp9 when checking or converting it.
- libx265 alpha encoding needs an x265 built with alpha support.
- Safari plays VP9 but not VP9 with alpha, and native Android players show no alpha at all.

## Questions

**Can I encode HEVC with alpha on Windows or Linux?**

Not with Apple’s encoder, which runs only on macOS. FFmpeg 8.0 can encode alpha through libx265 when x265 is built with alpha support, but test playback on Apple devices before relying on it.

**Why is my HEVC alpha video opaque?**

Most often -alpha_quality was left at 0, so the encoder wrote plain HEVC. Check the file with alphaextract or AVFoundation’s containsAlphaChannel.

**Does Safari play transparent WebM?**

Safari plays VP9 but not its alpha channel. Give it HEVC with alpha and list that source first.

**Can HEVC with alpha go in an MP4?**

AVFoundation still found the alpha after we remuxed our .mov to .mp4 with -c copy -tag:v hvc1. On the web we keep the .mov with a QuickTime type, so browsers that play HEVC without alpha are less likely to pick it.

## Sources

- [FFmpeg source, libavcodec/videotoolboxenc.c (alpha_quality, -q:v on Apple silicon)](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/videotoolboxenc.c)
- [FFmpeg source, libavcodec/libvpxenc.c (constant quality with -b:v 0)](https://github.com/FFmpeg/FFmpeg/blob/master/libavcodec/libvpxenc.c)
- [FFmpeg Changelog (8.0: libx265 alpha layer encoding)](https://github.com/FFmpeg/FFmpeg/blob/master/Changelog)
- [FFmpeg codecs documentation, libvpx](https://ffmpeg.org/ffmpeg-codecs.html#libvpx)
- [FFmpeg filters documentation, alphaextract](https://ffmpeg.org/ffmpeg-filters.html#alphaextract)
- [Apple, kVTCompressionPropertyKey_TargetQualityForAlpha](https://developer.apple.com/documentation/videotoolbox/kvtcompressionpropertykey_targetqualityforalpha)
- [Apple, AVAssetExportPresetHEVCHighestQualityWithAlpha](https://developer.apple.com/documentation/avfoundation/avassetexportpresethevchighestqualitywithalpha)
- [Apple, containsAlphaChannel](https://developer.apple.com/documentation/avfoundation/avmediacharacteristic/containsalphachannel)
- [Apple, Using HEVC video with alpha](https://developer.apple.com/documentation/avfoundation/using-hevc-video-with-alpha)
- [MDN, the source element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/source)
- [Jake Archibald, Video with alpha transparency on the web](https://jakearchibald.com/2024/video-with-transparency/)
- [androidx/media issue 1388, Support transparent video with ExoPlayer](https://github.com/androidx/media/issues/1388)
