How to Extract Y, U, and V Planes Using FFmpeg

This guide explains how to extract and export the individual Y (luma), U (chroma blue), and V (chroma red) components of a video into three separate, playable video files using FFmpeg. By leveraging FFmpeg’s native extractplanes filter, you can isolate each channel in a single execution without needing intermediate files.

The Basic Command

To extract all three planes simultaneously, use the extractplanes filter within a -filter_complex graph and map each stream to an individual output file:

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

How the Command Works

  • -i input.mp4: Specifies your source video file.
  • -filter_complex "extractplanes=y+u+v[y][u][v]": Tells FFmpeg to split the input video into three separate grayscale video streams representing the Y, U, and V planes, tagged internally as [y], [u], and [v].
  • -map "[y]" y_plane.mp4: Directs the [y] stream to the first output file.
  • -map "[u]" u_plane.mp4: Directs the [u] stream to the second output file.
  • -map "[v]" v_plane.mp4: Directs the [v] stream to the third output file.

Controlling Encoding and Codec Settings

By default, FFmpeg will use default encoder settings, which may vary depending on your target container format. To ensure standard compatibility and high quality across all outputs, explicitly define the video codec and pixel format:

ffmpeg -i input.mp4 -filter_complex "extractplanes=y+u+v[y][u][v]" \
  -map "[y]" -c:v libx264 -crf 18 -pix_fmt yuv420p y_plane.mp4 \
  -map "[u]" -c:v libx264 -crf 18 -pix_fmt yuv420p u_plane.mp4 \
  -map "[v]" -c:v libx264 -crf 18 -pix_fmt yuv420p v_plane.mp4

Understanding Resolution and Subsampling

Most standard video files use yuv420p chroma subsampling. In a 4:2:0 subsampled video, chroma information is sampled at half the horizontal and vertical resolution of the luma channel.

Consequently, if your input video is 1920x1080:

  • y_plane.mp4 will be 1920x1080.
  • u_plane.mp4 will be 960x540.
  • v_plane.mp4 will be 960x540.

Each output will appear as a grayscale representation of that specific channel's raw values.