Apply 3D LUT to Video with FFmpeg

Applying a custom 3D Color Lookup Table (LUT) to a video is a highly efficient way to color grade or color-correct your footage. This article provides a clear, step-by-step guide on how to use FFmpeg to apply .cube or .3dl LUT files directly to your videos via the command line, ensuring high-quality color transformation without the need for heavy video editing software.

To apply a 3D LUT to a video in FFmpeg, you need to use the lut3d video filter. This filter reads the color transformation coordinates from your LUT file and maps them to the video frames.

The Basic Command

Open your terminal or command prompt and run the following command:

ffmpeg -i input.mp4 -vf "lut3d=preset.cube" -c:v libx264 -pix_fmt yuv420p -c:a copy output.mp4

Command Breakdown

Advanced Options: Choosing Interpolation

3D LUTs rely on interpolation to calculate colors that fall between the defined points in the lookup table. FFmpeg allows you to specify the interpolation method using the interp option.

The command looks like this:

ffmpeg -i input.mp4 -vf "lut3d=file=preset.cube:interp=tetrahedral" -c:v libx264 -pix_fmt yuv420p -c:a copy output.mp4

Available interpolation methods include: * nearest: Fastest processing, but lowest quality (can introduce color banding). * trilinear: Good balance between speed and quality. * tetrahedral: Best quality (default). It provides the smoothest color transitions and minimizes banding artifacts.