Extract Alpha Channel from RGBA Video using FFmpeg

Isolating the alpha (transparency) channel from an RGBA video is a common task in video post-production, compositing, and web development. This article provides a direct, step-by-step guide on how to use FFmpeg’s extractplanes filter to isolate the alpha channel and export it as a standalone grayscale video mask.

The Basic Command

To extract the alpha channel, you need to use the extractplanes video filter and specify the a (alpha) plane.

Here is the standard command to perform this extraction:

ffmpeg -i input_rgba.mov -vf "extractplanes=a" alpha_mask.mp4

Command Breakdown

  • -i input_rgba.mov: Specifies the input video file that contains an alpha channel (such as Apple ProRes 4444, QuickTime Animation, or VP9 WebM).
  • -vf "extractplanes=a": Applies the video filter. The extractplanes filter splits the input video into its component color channels. Setting it to a tells FFmpeg to output only the alpha channel.
  • alpha_mask.mp4: The output video file. The resulting video will be a grayscale representation of the transparency, where white represents fully opaque areas, black represents fully transparent areas, and shades of gray represent semi-transparency.

Ensuring Proper Pixel Format

By default, the extracted alpha plane is output as a grayscale pixel format (typically gray or yuv400p). If your target player or editor requires a specific pixel format, you can force it using the -pix_fmt flag:

ffmpeg -i input_rgba.mov -vf "extractplanes=a" -pix_fmt yuv420p alpha_mask.mp4

Using -pix_fmt yuv420p ensures wide compatibility with standard web browsers and hardware decoders, while still retaining the black-and-white visual mask of the original alpha channel.