28

How is ffmpeg used with a video filter circa 2017 to adjust gamma/contrast, brightness and saturation?

Stack Exchange resources that are a few years old point to the filter mp=eq2=, but it seems to be deprecated1 and replaced with just eq=. The link does not reveal a good understanding of the setting ranges, however.

How is eq= (or equivalent filters) used? E.g., what is the format and appropriate settings/ranges?

For my personal usage, I'd like to keep gamma where it is, while increasing brightness and saturation a fair bit, for a dark video.


1Throws error message: No such filter: 'mp'

  • 2
    Checks the docs, and look into the curves or pp filter as well. – Gyan Mar 19 '17 at 10:32
  • 4
    The syntax is the same as for all filters. i.e. filtername=option1=value1:option2=value2:option3=value3... These can be in any order. – Gyan Mar 19 '17 at 10:51
  • I don't see any “thank you” to @Gyan — in my humble opinion at least a half of reputation for your own answer to this question belongs to him. – MarianD Jun 27 '19 at 15:42
29

These settings helped me to lighten up a dark video using the filter eq, with some added saturation.

Syntax:

filtername=option1=value1:option2=value2:option3=value3... These can be in any order.

Filter ranges and all options:

https://ffmpeg.org/ffmpeg-filters.html#eq

Preview:

ffplay -vf eq=brightness=0.06:saturation=2 INPUT.MOV

Render:

ffmpeg -i INPUT.MOV -vf eq=brightness=0.06:saturation=2 -c:a copy OUTPUT.MOV


Alternative filters: curves and pp.

| improve this answer | |
  • 3
    the preview ffplay is an awesome added value – Amjo Apr 29 '19 at 7:20
5

Gamma correction is likely to be a better choice than brightness, to stretch the histogram to the right rather than push it over:

# tinker with numbers
ffplay -vf eq=gamma=1.5:saturation=1.3 original.vid 

# render
ffmpeg -i original.vid -vf eq=gamma=1.5:saturation=1.3 \
    -c:a copy  outfile.vid
| improve this answer | |
3

I'd also try curves:

ffmpeg -i input.vid -vf "curves=all='0/0 0.5/1 1/1'" -codec:a copy -codec:v libx264 -y output.vid

The 0.5/1 maps mid-range brightness (0.5) to full bright (1)

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.