(FFmpeg) How to Add Color Balance to a Video?

The color balance filter allows the RGB shadows, midtones, highlights and preserving lightness can be adjusted. This filter can be used to apply very custom color grading or used to create trippy color changes. 

Figure 56.0: green/blue extreme color balance

In this example, the green shadows are increase and the blue highlights are maxed out, as seen in figure 56.0:

  $ ffmpeg -i input.mp4 -vf "colorbalance=gs=.5:bh=1" -pix_fmt yuv420p output.mp4 
colorbalance
	Indicates the color balance filter name

rs, gs, bs
	Indicates adjustments to red, green and blue shadows or darkest pixels (1.0 to -1.0 with default 0.0)

rm, gm, bm
	Indicates adjustments to red, green and blue midtones or medium pixels (1.0 to -1.0 with default 0.0)

rh, gh, bh
	Indicates adjustments to red, green and blue highlights or brightest pixels (1.0 to -1.0 with default 0.0)


pl
	Indicates preserve lightness when changing color balance (1.0 to -1.0 with default 0.0)

Tip: Negative values shift to complementary colors while positive values shift to primary colors.

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

Related Posts