Articles Technology Blog News Company
Intelligent Brightness

Download now!
VirtualDub plugin
32 and 64 bit versions

(source code)


AVISynth+ plugin

(source code)
This is a free plugin for VirtualDub and Video Enhancer (see AVISynth+ version below) doing automatic brightness and contrast correction intelligently: less noise-induced flickering (by temporally smoothing correction parameters), proper handling of fades and scene changes, smart work with very dark scenes.

Similarly to AutoLevels and some other automatic brightness/contrast filters it analyses the current frame and brings its dynamic range to desired values, amplifying contrast and fixing brightness bias in dark or low contrast videos.

Before | After

However there is a difference in couple of aspects. First, when there is a fade-to-black in the video or just a short very dark scene ordinary automatic contrast filters will keep expanding the contrast, filling the frame with amplified noise:

AutoLevels vs. Intelligent Brightness:

(fireworks)

Here's a video comparison with AutoLevels and MSU Smart Brightness:

Some observations:
  • MSU Smart Brightness is not that adaptive as the other two filters.
  • AutoLevels changes colors (white balance) which is not always desired. Intelligent Brightness only deals brightness/contrast, keeping colors intact.
  • AutoLevels amplifies noise in dark scenes too much, Intelligent Brightness does not.
  • Intelligent Brightness has less flicker (brightness vibrations).

To avoid such noise amplification Intelligent Brightness filter makes target dynamic range (minimum and maximum pixel values) dependent on current frame property P which can be either:

  • Source Average - average brightness of current frame
  • Source Max - maximum value among all pixels of current frame
  • Source Median - median value of pixels of current frame
The upper end of target dynamic range, i.e. maximum pixel value the frame should have after processing, is determined by a curve, so that for all possible valuues of P (0..255) there can be a different target value. In the plugin settings window there is a chart where on horizontal axis is P (average, median or maximum value of current frame pixels) and on vertical axis is the target range for pixels of this frame, for each value of P.

Current value of P (calculated while in Preview or when the plugin worked on actual video) is drawn as a vertical line. Red part of this line is where target range is higher (wider) than original dynamic range of current frame.
The grid marks 10% of total range of values. The curve drawn on this particular image above reads as follows: for all frames minimum values of pixels (lower end of dynamic range) should be 12% of total possible range, and maximum values should be approx. 86% when P is above 35% but for lower values of P dynamic range should shrink, and for P less than 10% target range is as wide as original, so no contrast amplification for such dark frames.

So, overall approach is to not amplify very dark frames as much as lighter frames. In the settings you can select target minimum and maximum brightness values for lighter frames and also control where and how the curve appears that makes target maximum value lower for darker frames. We recommend opening this plugin settings in VirtualDub on a real file and playing with curve parameters to see how they affect the result for different frames of your video.

Second difference from ordinary automatic filters is temporal smoothing of correction parameters, so that in a dark scene there is a flash or some bright noise spot, usually this spot will change source dynamic range and make the contrast amplification factor less for this frame, which means the whole frame will be darker than its neghbor frames just because of one spot of noise or some flash. This causes flickering. Intelligent Brightness filter remembers previous constrast amplification and brightness shift factors and uses some temporal smoothing for them, making changes in brigtness and contrast smoother, not just per-frame decisions. This smoothness is controlled by "Dynamicity parameter": the lower its value, the slower this filter reacts to changes in video. However if there is a scene change, a cut, then such smoothness is bad and can make beginning of a new scene have inadecvate brightness / contrast. To avoid that, plugin can detect scene changes and adapt to new scene parameters instantly. Sensitivity to scene changes is controlled by "scene change threshold" parameter. The higher its value, the less sensitive is the changes detector, the less frames will be considered to be cuts.

This filter works with RGB32 and YV12 uncompressed video formats. In the latter format usual range for brightness is not 0..255 but something like 16..235, keep that in mind. If you switch from RGB to YUV without changing the min/max parameters your video will have higher contrast than you expected.

AVISynth+ plugin

The same Intelligent Brightness plugin is also available for AVISynth+.
In your AVS script load it and use like this:
LoadPlugin("intellibravs.dll")
clip = AVISource("video_yv12.avi")   # RGB32 and YV12 are supported

return clip.Intellibr(p="max", min=0, max=255, dynamicity=5, scene=20, \
  start=0, end=153, start_angle=0.14, end_angle=0.02)
All the parameters are optional and can be skipped. If some parameters are skipped, default values will be used - the ones shown here. So one can just write
return clip.Intellibr()

Parameter p can be either "max", "average" or "median". The meaning of the parameters is described above. Download link is at the top of this page.