Convert to grayscale
Stripping the color from a video is a stylistic choice for music videos, flashbacks, or text overlays, and a technical one for archival footage or color-blind accessibility. The `format=gray` filter does the work in one line, but you have to chain a second format filter to keep the encoder happy.
The command
ffmpeg -i in.mp4 -vf "format=gray,format=yuv420p" -c:v libx264 -crf 20 out.mp4What it does
`format=gray` tells FFmpeg to convert the pixel format to grayscale, dropping the chroma planes. The second `format=yuv420p` is needed because most encoders (including libx264) require a 4:2:0 chroma subsampled YUV frame as input. The output has the same resolution and frame rate as the input, with no color information.
Requirements
Any video input. The filter is in libavfilter. CPU-only. The encoder does the same work as a normal encode; the file size shrinks because the chroma planes are now constant, so the encoder can compress them trivially.
Things to avoid
- Using a single `format=gray` without the second format filter. The encoder will fail with 'specified pixel format is not supported' or quietly fall back to a non-standard format that some players cannot decode.
- Re-encoding the audio. If the source has a soundtrack, use `-c:a copy` to keep the audio untouched.
- Forgetting that the color is gone, so subtitles, watermarks, and graphics that depend on color for legibility will look different.
- Trying to recover the color later. The chroma data is dropped, not just hidden — re-encoding does not bring it back.