Use ffmpeg to render out only single Y-channel - either alpha or grayscale

I'd like to have a ffmpeg command to save only the alpha-channel. All the commands I tried will save a single channel as RGB - with the same values in all 3 channels. Some reference - Want to extract out only alpha using ffmpeg

From my experience, saving only the Y-channel is not possible. This can be used to save single-channel grayscale or alpha-only information.


Use the extractplanes filter.

original image y plane
Original image and extracted Y channel.

Extract Y color channel component:

ffmpeg -i input.jpg -filter_complex "extractplanes=y" y.jpg

Extract Y+U+V:

ffmpeg -i input.mp4 -filter_complex "extractplanes=y+u+v[y][u][v]" -map "[y]" y.mp4 -map "[u]" u.mp4 -map "[v]" v.mp4

Available values:

  • y
  • u
  • v
  • a
  • r
  • g
  • b

Choosing planes not available in the input will result in the error Requested planes not available. That means you cannot select RGB planes from a YUV input and vice-versa.