Deflicker Filter for VirtualDub

This filter corrects video that has frame luminance variations over time, what we might generically call flickering. Because a moving-average filter is used instead of a notch filter, this filter can correct both periodic and aperiodic flicker. A major source of video with periodic flicker is the practice of video recording a projected film. When video at one frame rate is projected and then recorded from the projection screen at a different frame rate, a temporal moire pattern, or flicker, is produced. This filter removes the flicker, thereby making this a viable process. For example, it becomes feasible to project 18 fps films and record them with a 25 fps PAL camcorder.

The filter provides a field mode of operation to support interlaced source video.

My friend Jukka Aho writes: "Very impressive. As far as I know, there are two other ways of doing such video transfer at home, and both involve modifying the projector hardware:

1) Buy a special shutter blade for the projector (I do not know if these are available/feasible for PAL transfers at all!)

2) Install a magnetic switch inside the projector. The switch will close the circuit each time the shutter blade rotates. You can then wire the leads to your mouse button. After having done this, point your camcorder at the screen, connect it to the capture card, load a capture program and and put the mouse pointer on a 'single frame capture' button. Then start the projector, which will now automatically press the mouse button each time a new frame is displayed.

Now it seems you can do it without having to go through this kind of hassle at all."

The accompanying help file contains some technical notes on how the filter is implemented.

The second link below provides two AVIs that demonstrate the capabilities of this filter. Note that in addition to deflickering, the unsharp mask filter has been applied and the frame edges were clipped. The improvement over the original is truly stunning.

Thanks to Niels Basjes for providing the test files and suggesting the creation of this filter. Thanks to Jeff Gonion for valuable theoretical discussions on digital filtering. Thanks to Steven Don for writing his DNR filter from which I adapted the final softening phase. Thanks to Jukka Aho for suggesting the field mode. Thanks to Yury Malich for the one-pass implementation and scene change concepts. Finally, thanks to Avery Lee for diverse assistance with technical details on the VirtualDub/filter interface.

Deflicker filter version 1.3. [Source code]

Version 1.3 now works correctly for large image sizes, including HD.

Version 1.3 beta 1 now uses a one-pass algorithm, supports scene change processing, and changes the help file to an HTML file.

Version 1.2 fixed a bug that caused the filter to not work in recent version of VirtualDub.

Deflicker filter version 1.1. [Source code]

Version 1.1 fixed a bug that caused a hang if a value larger than 31 was entered into the softening edit box. The executable was also recompiled as a multithreaded DLL to reduce its size.

Beta 4 fixed a divide by zero error when a frame had zero luminance. Beta 3 added the ability to navigate on the timeline in "Process video mode". Beta 2 added the field mode for interlaced source video.

Deflicker filter demonstration files [884 Kbytes].

Shusaku Tago has created a modified version of this filter. He writes:

I have improved your Deflicker Filter for VirtualDub.

My improvement is to have better processing for highlights. In your original version, when it makes a frame darker, highlights will be made darker. With my improvement, highlights will no longer be made darker, even if it makes a frame darker. My algorithm is very simple but it works very nicely for my timelapse clips taken with auto exposure. But I'm not sure about different style clips.

Here is a sample clip.

The source code for this version is included in the package and is named mainshusaku.cpp. You can rename it as main.cpp to use it.

[up to home page]