Extract Alpha Channel with FFmpeg extractplanes

This guide explains how to use FFmpeg's extractplanes video filter to isolate the alpha (transparency) channel from an RGBA video file. By isolating this channel, you can generate a standalone grayscale video matte where pure white represents complete opacity and pure black represents full transparency.

The Basic Command

To extract the alpha channel, target the a plane using the extractplanes filter. Here is the standard command:

ffmpeg -i input.mov -vf "extractplanes=a" -c:v libx264 -pix_fmt yuv420p alpha_matte.mp4

Breakdown of Parameters

  • -i input.mov: The source video containing an alpha channel (such as Apple ProRes 4444, QuickTime Animation, or VP9/WebM with transparency).
  • -vf "extractplanes=a": The video filter that separates the stream into its constituent components and outputs only the alpha channel (a).
  • -c:v libx264: The output video codec. You can choose any standard codec suited for your destination format.
  • -pix_fmt yuv420p: Converts the resulting single-plane grayscale data into standard 8-bit YUV format for broad playback compatibility.

Handling Different Pixel Formats

The extractplanes filter works with any pixel format that includes an alpha plane, whether it uses an RGB color model (such as rgba, argb, or abgr) or a YUV model with alpha (such as yuva420p or yuva444p). The parameter a universally maps to the transparency layer regardless of whether the color components are RGB or YUV.

If your source file uses non-standard alpha flags, you can explicitly force pixel format decoding before applying the filter:

ffmpeg -vcodec prores -i input.mov -vf "format=rgba,extractplanes=a" -c:v libx264 alpha_matte.mp4

Exporting Lossless Alpha Mattes

For visual effects and compositing workflows where compression artifacts degrade edge quality, output the isolated matte losslessly using a format like PNG sequence or FFV1:

ffmpeg -i input.mov -vf "extractplanes=a" -c:v ffv1 -pix_fmt gray alpha_matte.mkv

Setting -pix_fmt gray ensures the file retains a native single-channel grayscale structure without unnecessary chroma conversion.