Adjust Video Color Temperature with FFmpeg
This article provides a quick guide on how to use the FFmpeg
colortemperature filter to adjust the color temperature of
your videos. You will learn the syntax, key parameters, and practical
command-line examples to either warm up your footage with golden tones
or cool it down with bluish tones to achieve your desired visual
mood.
The colortemperature filter in FFmpeg allows you to
adjust the color temperature of a video source by specifying a
temperature value in Kelvin. The default neutral color temperature is
6500K (representing daylight).
To change the temperature, you adjust this Kelvin value: * Lowering the value (below 6500K) shifts the video toward warmer, yellowish-red tones. * Raising the value (above 6500K) shifts the video toward cooler, bluish tones.
Filter Parameters
The filter accepts the following key parameters: *
temperature (or t): Sets the target color
temperature in Kelvin. The allowed range is from 1000 to
40000. The default is 6500. * pl
(preserve lightness): Controls how much of the original lightness is
preserved when shifting colors. The range is from 0.0 to
1.0. The default is 0.0.
How to Warm Up a Video
To give your video a warmer, sunnier, or more nostalgic look, set the
temperature parameter to a value lower than 6500. A value
between 3000 and 5000 is typically ideal for a noticeable warm
shift.
Run the following command to warm up your video to 4000K:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=4000" -c:a copy output_warm.mp4How to Cool Down a Video
To give your video a colder, sterile, or nighttime look, set the
temperature parameter to a value higher than 6500. A value
between 9000 and 15000 works well for a cooler, blue-tinted look.
Run the following command to cool down your video to 10000K:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=10000" -c:a copy output_cool.mp4Adjusting Lightness Preservation
Sometimes, shifting the color temperature can drastically alter the
perceived brightness of the video. You can use the pl
parameter to preserve the original lightness of the image.
The following command warms the video to 3500K while keeping 50%
(0.5) of the original lightness intact:
ffmpeg -i input.mp4 -vf "colortemperature=temperature=3500:pl=0.5" -c:a copy output_preserved.mp4