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

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.