How to Use the FFmpeg Colortemperature Filter
Adjusting the color temperature of a video is essential for
correcting improper white balance or establishing a specific artistic
mood, such as a warm sunset or a cold, sterile environment. This guide
provides a straightforward overview of how to use FFmpeg’s built-in
colortemperature video filter, explaining its core
parameters and demonstrating practical command-line examples to warm up
or cool down your footage.
Understanding the Filter Parameters
The colortemperature filter works by adjusting the color
temperature of an image using Kelvin (K) values. The filter accepts two
primary options:
temperature(ort): Sets the temperature in Kelvin. The valid range is from1000to40000. The default value is6500(which represents neutral daylight D65). Lower values (below 6500) shift the video toward warmer, reddish-yellow tones. Higher values (above 6500) shift the video toward cooler, blue tones.pl(preserve lightness): Defines the amount of lightness to preserve when shifting the colors. The value ranges from0.0to1.0, with a default of0.0.
Basic Command Syntax
The basic syntax for applying the filter is as follows:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=VALUE" output.mp4Practical Examples
1. Warming Up a Video (Lowering Kelvin)
To make your video look warmer, reduce the temperature value below the 6500K baseline. This example sets the temperature to 4000 Kelvin:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=4000" output.mp42. Cooling Down a Video (Increasing Kelvin)
To achieve a colder, blue-tinted look, increase the temperature value above 6500K. This example sets the temperature to 9000 Kelvin:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=9000" output.mp43. Adjusting Temperature with Lightness Preservation
If you want to shift the color temperature while maintaining the
original brightness and luminance of the video as much as possible,
enable the pl parameter:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=3500:pl=0.5" output.mp4