Convert Video to Grayscale with FFmpeg lutyuv
This guide explains how to convert a video to black and white using
FFmpeg's lutyuv filter by setting the chrominance channels
(U and V) to 128. You will learn the exact command syntax required,
understand how the YUV color space processes neutral color values, and
see how to execute the command without altering your original audio
stream.
Understanding the YUV Neutral Value
In digital video using standard 8-bit YUV color spaces (such as
yuv420p), the color information is split into three
planes:
- Y: Luminance (brightness, ranging from 0 to 255)
- U: Chrominance (blue-difference projection, ranging from 0 to 255)
- V: Chrominance (red-difference projection, ranging from 0 to 255)
The midpoint value of 128 represents zero color saturation for both the U and V planes. By forcing both U and V to evaluate to 128 across all pixels while leaving the Y channel untouched, all color information is removed, resulting in a true grayscale image.
The FFmpeg Command
To apply this filter, pass lutyuv=u=128:v=128 to the
-vf (video filter) argument:
ffmpeg -i input.mp4 -vf "lutyuv=u=128:v=128" -c:a copy output.mp4Parameter Breakdown
-i input.mp4: Specifies the source video file.-vf "lutyuv=u=128:v=128": Applies the lookup table filter. Because theyparameter is omitted, the luminance values pass through unmodified, while every pixel'suandvvalues are rewritten to constant128.-c:a copy: Copies the audio stream directly without re-encoding, preserving audio quality and speeding up the render.output.mp4: Designates the output filename for the grayscale video.
Higher Bit-Depth Note
If you are working with 10-bit YUV video (such as
yuv420p10le), the neutral chroma value shifts from 128 to
512 (half of the 10-bit range of 1024). In that scenario, adjust the
parameters accordingly:
ffmpeg -i input.mp4 -vf "lutyuv=u=512:v=512" -c:a copy output.mp4