A 3D LUT is a file that maps every RGB color to another RGB color via a three-dimensional lookup table. Colorists use them to apply a specific look (filmic, vintage, brand color) to a flat source. FFmpeg can apply a .cube file directly, so the same LUT used in DaVinci or Premiere can be applied during an encode.

The command

ffmpeg -i in.mp4 -vf "lut3d=film.cube" -c:v libx264 -crf 20 out.mp4

What it does

The `lut3d` filter reads the .cube file at startup and applies the per-pixel mapping. The output is a video with the LUT applied; the source frames are not modified on disk. The filter is fast — a 33x33x33 LUT (typical) adds a small fraction of the encode cost. Multiple LUTs can be chained with `lut3d=a.cube,lut3d=b.cube` for a compound look.

Requirements

A valid .cube file (text format, 17x17x17 to 65x65x65 cube size is typical). The filter is in libavfilter, with `luts` support. CPU-only, single-pass. The LUT must match the input color space — an sRGB LUT on a Rec.709 source is correct; a Rec.2020 LUT on an sRGB source will produce wrong colors.

Things to avoid

  • Applying a LUT designed for a different gamma. LUTs are usually tagged in the file name or header; an `sRGB` LUT on a `linear` source will look washed out.
  • Re-encoding the audio. The LUT is a video filter, but the audio is unaffected; use `-c:a copy` to keep the soundtrack untouched.
  • Combining a LUT with a global color filter. The second filter sees the first filter's output as its input, which can compound the look in unexpected ways.
  • Forgetting to bake the LUT into the file. The command above writes the LUT into the encoded video. If you want the source to remain neutral, do the LUT as a separate pass.