How to use Avisynth+ to remove mains flicker Dec. 22, 2023 in Text
Earlier this month I recorded the BathTub Orchestra performing at Christ Church in Bath, but when I went to edit the video so I could upload it to YouTube, there was a distracting flickering in the top left and top right of the screen! I’ve been using the powerful Davinci Resolve, and while it does have a deflickering filter, it unfortunately is a paid feature.
Fortunately, the free and open-source Avisynth+ can be used to quickly remove the flicker. These are the steps that worked for me, and I’m writing them down in case I ever need to make use of the them again. Hopefully someone out there finds them helpful.
- Download and install the latest version of ffmpeg from https://www.ffmpeg.org/download.html
- Download and install the latest version of Avisynth+ from https://github.com/AviSynth/AviSynthPlus/releases
- Download and copy the latest version of the Avisynth+ ReduceFlicker plugin from https://github.com/Asd-g/ReduceFlicker/releases into AviSynth+’s
plugins64+
folder - (Optionally) download and install the latest version of AvsPmod from https://github.com/gispos/AvsPmod/releases, the AviSynth+ and plugins folders may need to be updated
- Using AvsPmod or any text editor to create a file named
deflicker.avs
containing something like:
DirectShowSource("video.mp4")
ConvertToYUV420()
ReduceFlicker(aggressive = true, strength = 3)
More information about the ReduceFlicker plugin can be found at http://avisynth.nl/index.php/ReduceFlicker.
- Using the command line, run the following command
ffmpeg.exe -i deflicker.avs -vcodec libx264 -vb 20M -acodec libfaac deflickered.mp4
Consider adjusting the bitrate to something sensible, and changing the video/audio codec to match the input.
And that’s it, hope it helped! Here’s the final result:
And here’s a YouTube playlist.