前言
利用 ffmpeg 來直接修改影片的對比度、亮度、飽和度
Sample code
透過修改後面的數值,可以直接改變影片的結果 (替影片上一層濾鏡的感覺)。
- contrast:對比度 (default: 1.0)
- Set the contrast expression. The value must be a float value in range -2.0 to 2.0. The default value is “1”.
- brightness:亮度 (default: 0.0)
- Set the brightness expression. The value must be a float value in range -1.0 to 1.0. The default value is “0”.
- saturation:飽和度 (default: 1.0)
- Set the saturation expression. The value must be a float in range 0.0 to 3.0. The default value is “1”.
ffmpeg -y -i input.mp4 -vf "eq=contrast=1:brightness=0:saturation=1" -pix_fmt yuv420p ./output.mp4
Reference
- Difference between FFMPEG eq (brightness / contrast / saturation) and CSS filters?
- ffmpeg Color Correction: Gamma, Brightness and Saturation
- Adjusting video contrast, brightness, saturation, and color balance with FFMPEG
- eq