Replaces each pixel with its distance from one source color (black by default): areas close to that color go dark and everything else brightens. The result is a grayscale "how different is this from X" map, useful as a matte or for a ghostly, solarized look.
frei0r: if ffmpeg reports "Could not find module", point it at the plugin folder. Homebrew on Apple Silicon installs them where ffmpeg doesn't look by default: export FREI0R_PATH=/opt/homebrew/lib/frei0r-1
The command
ffmpeg -i input.mp4 \
-vf "frei0r=colordistance" \
-c:v libx264 -pix_fmt yuv420p \
output.mp4 What each part does
frei0r=colordistance distance from the default source color; pass a
color to compare against something else, e.g.
frei0r=colordistance:0.2/0.6/0.9 (r/g/b, 0–1)
-c:v libx264 -pix_fmt yuv420p When to use it
This is used when you want a grayscale map of how far each pixel is from one color: as a matte for later compositing, or for a ghostly, solarized look. With the default source color (black), shadows stay dark and everything else brightens. The header explains each flag.
It isn't an edge detector. If you want outlines rather than tonal distance, try frei0r-sobel-edges.sh or sobel-edge-glitch.sh instead.
The most useful variation is changing the source color, as the header shows with frei0r=colordistance:0.2/0.6/0.9. Pick the dominant color of whatever you want to suppress, such as a sky or a backdrop, so it goes dark and the subject stands out.
If the output looks wrong, check these:
- "Could not find module": set
FREI0R_PATHas described in the header. - Almost everything is dark: your source color is too close to most of the frame. Move it away from the dominant tones.
- Almost everything is bright: nothing in the footage is near the source color. Sample a color that actually appears in the shot.
Notes
- Source
- ffmpeg-utilities/notes/commands2.txt
- Changed
- -vcodec → -c:v; output path proc/… → output.mp4