Skip to content

(FFmpeg) How to Edit the Hue of a Video?

The hue filter allows for modification of the hue and saturation of a video. 

Figure 57.0: applying a hue and saturation

In the example below, the hue is set to 45 degrees with an increased saturation, as seen in figure 57.0:

$ ffmpeg -i input.mp4 -vf "hue=h=45:s=2" output.mp4
Figure 57.1: dynamic hues

The hue filter also has framing and time parameters that allow for great effects like animating through hue colors quickly. Expressions can also be programmed, as seen in figure 57.1:

 $ ffmpeg -i input.mp4 -vf "hue=H=2*PI*t:s=cos(2*PI*t)+10" output.mp4
hue
	Indicates the hue filter name

h
	Indicates the hue angle as a number of degrees (default 0)

s
	Indicates the saturation (10 to -10 with default 1)

H
	Indicates hue angle as a number of radians (default 0)

b
	Indicates the brightness (10 to -10 with default 0)


n
	Indicates frame count of the input frame (starts at 0)

t
	Indicates the timestamp (HH:MM:SS)

Love FFmpeg? Grab a copy of FFmpeg For Beginners on Kindle or Paperback to learn over 120 ways to master FFmpeg!

buy now on amazon