[FFmpeg-user] How to correct dark video with bright background

Gerardo Ballabio gerardo.ballabio at gmail.com
Sun Mar 10 22:33:18 EET 2019

Thank you Michael -- but that means I still have to find good values
of brightness, contrast, gamma, saturation and hue to use with Gimp.
When I've done that, then couldn't I just apply the same values in
ffmpeg using the "eq" filter?

Or are you saying that Gimp has effects that ffmpeg doesn't have? If
so, could you please give some advice on that too? I'm afraid I'm not
better at correcting images with Gimp than with ffmpeg.


Il giorno sab 9 mar 2019 alle ore 21:01 Michael Koch
<astroelectronic at t-online.de> ha scritto:
> Am 09.03.2019 um 19:14 schrieb Gerardo Ballabio:
> > Hello all,
> > I have a video that was filmed under bad lighting conditions, the
> > background is too bright and people in the foreground are dark. I'm
> > trying to use ffmpeg to correct it. Please kindly help me.
> For video processing like this you best use the haldclut filter, which
> is a 3D color-look-up-table.The workflow is as follows.
> Step 1:
> Extract one frame from your video and add a color-look-up-table to it.
> -ss 0.5 is the time where the frame is extracted from the video.
> ffmpeg -ss 0.5 -i video1.mts -f lavfi -i haldclutsrc=8 -filter_complex
> "[1]format=pix_fmts=rgb24[a];[a][0]xstack=inputs=2:layout=0_0|w0_0"
> -frames 1 -y image_with_clut.png
> Step 2:
> Open the image_with_clut.png with a image processing program of your
> choice, for example IrfanView or Gimp. Edit brightness, contrast, gamma,
> saturation and hue. You can also adjust the curves. In your example,
> especially a high gamma value is required, and a little bit more
> saturation. Then save the image using the same filename.
> Of course, all modifications must be applied to the whole image
> consisting of the video frame and the clut. Filters like noise
> reduction, sharpening or sofening are not allowed.
> Step 3:
> Cut away the video frame, so that only the 512x512 clut remains:
> ffmpeg -i image_with_clut.png -vf crop=512:512:0:0 -y clut.png
> Step 4:
> Apply the clut to your video with the haldclut filter:
> ffmpeg -i video1.mts -i clut.png -filter_complex haldclut -y out.mts
> Michael
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list