[FFmpeg-user] How to brighten part of a dark video?

Moritz Barsnick barsnick at gmx.net
Fri Sep 18 11:44:29 CEST 2015


On Fri, Sep 18, 2015 at 11:25:35 +0200, Gilles wrote:
> Can ffmpeg brighten up only the dark part of the video without
> increasing the brightness of the screen that's already too bright?

Sure. You can use a complex filter to crop one section out, apply
different brightness changes to the original and the cropped part, and
reoverlay to cropped part onto the original.

Something like:

$ ffmpep -i vlcsnap_2015_09_18_11h21m29s599.png -filter_complex "split=2[v1][v2]; [v1]crop=200:300:520:0,mpblablabla[brightpart]; [v2]mpbablabla[darkpart]; [darkpart][brightpart]overlay=x=520:y=0[v]" -map "[v]" corrected.png

I don't know if the mp filter or on of the lut filters is best.
Whatever you use, insert it instead of "mpblablabla" above.

What that filter chain does: It duplicate the input. It uses [v2] as
the base, where you would increase the brightness or whatever. [v1]
crops out the very bright section, optionally decreasing its
brightness. It reassembles them by overlaying the corrected bright part
over the corrected base (at the same position as before, hopefully).

Good luck!

Moritz


More information about the ffmpeg-user mailing list