ClearScan – AviSynth – color correction software

I’m sharing a small piece of software I tinkered with over the past few days after the difficulties a user ran into on this forum. I figured that getting acceptable, consistent color settings across an entire film is really a job in which each of us has lost a few hairs.

This software uses AviSynth and a color-correction filter, GamMac, along with a few other basic filters. Let it be said that I’m not a specialist in writing the scripts needed to make these filters work properly, and some of you certainly do it much better—your suggestions for improvement will be welcome.

This tool has the special feature of offering a script/VirtualDub interface that makes it easier to use.

The application folder contains all the required DLLs as well as the latest version of VirtualDub. The user’s only task will be to install AviSynth+ on their workstation (very simple—default options only). AviSynth is detected automatically, and if it isn’t found on your computer, you’ll be given a link to download it.

The color correction isn’t perfect, but it already prepares the footage very nicely for grading in DaVinci Resolve.

All DLLs are x64, which allows good processing speed and no limitation on image resolution (you still need to be reasonable, but it’s OK for 4K).
There’s no installation required. Just unzip it to the folder of your choice and run CleanScan.exe.

Software:

edit :
Beta version 1.1 – bug fixes:

  • The application wouldn’t open if AviSynth wasn’t detected.

  • Warning messages are now displayed in the OS language from installation.

Improvement:

  • Improved the file selection logic in the form.
2 Likes

Short presentation video :slightly_smiling_face:

1 Like

Hi Roland,
I’ve now finished my restorations, but I’ve used AviSynth extensively. You can always find interesting filters, for example, GamMac for severe color cast or other noise reduction filters. However, it must be said that choosing, implementing, and configuring AviSynth filters isn’t particularly easy! To add to what Roland said about VirtualDub, I think it’s more interesting to use ffmpeg, which can perfectly open an AviSynth script, allowing freedom in choosing the input and output codec, as well as other processing options. Then the processing can be automated with batch scripts. In my case, I use a series of steps: stabilization, noise reduction, color and level adjustment, and final encoding (HEVC, AV1, etc.), with lossless encoding between each step. Now, perhaps it’s easier and more modern with DaVinci Resolve?

1 Like

Hi Dominique,

The goal is indeed to allow a user to use these filters without having to absorb the rather tedious knowledge of AviSynth, hunt down hard-to-find DLLs, and struggle with finicky script writing. Here, only the installation of AviSynth+ is required.

I’ve always wondered how many users give up along the way.

I use VirtualDub as the player because it’s stable, fast, and it already has tools for compiling. That makes the application lighter.

But this is only a first draft—there’s still a lot of work to do…

1 Like

For me, using an executable file and VirtualDub to run an Avisynth script is unnecessarily complicated. It’s much simpler to use ffmpeg.

It’s very simple: a script and a batch file for one step of the processing, for example, for a cleaning step :

Avisynth script clean.avs


film = GetSystemEnv(“input”)
source= AviSource(film,audio=false)
cleaned=source.RemovedirtMC(30,false)
denoised=cleaned.TemporalDegrain(sad1=400,sad2=300,degrain=2,blksize=16)
Eval(“denoised”)
Prefetch(8)

Calling batch procedure clean.cmd

set input=…
set output=…
echo Cleaning %input% %output%
ffmpeg -i clean.avs -c:v magicyuv -pix_fmt yuv420p -y %output%

Here the output is encoded with a lossless codec magicyuv for further processing

1 Like

That is interesting indeed. So FFMPEG runs an instance of AviSynth?

Using multiple executables within the same application is not an unnecessary complication. If you look at the DaVinci Resolve application, for example, you’ll see that it shares 5 .exe files. Many applications do this—it’s a common practice. In our case, VirtualDub is portable and doesn’t require installation. You just need to include it with the solution.

In the very simple example you gave, a lot of things are missing that would have to be programmed: displaying the preview window, the code to manage the preview buttons (play, rewind, stop, etc.), programming the “slider” to move through the video, handling the encoding to create an output file… and I’m forgetting many more.

In this case, it’s exactly what VirtualDub already does very well on its own, reliably and quickly. Why rewrite what already exists?

Also, having tested ffmpeg, there’s one function I didn’t find (but maybe you have a solution) in the workflow that exists in VirtualDub: script refreshing. Once the original images or the video file is loaded, you don’t close VirtualDub anymore. Every time the user changes a parameter, you simply refresh the display. It’s faster and visually more comfortable than closing and reopening a window.

But if you have a concrete example of software you’ve programmed, I’d be very happy to look at how you approached it. I don’t claim to know everything or to always adopt only good solutions.

@PM490
The executables are indeed VirtualDub, FFMPEG, or others, but reading an AVS script will be handled by the Avisynth DLLs within the executable’s process.

@Roland

The question is whether we need a GUI like with VirtualDub or not like with FFMPEG. These are two different things, each with its own purpose.

A GUI is useful for testing, seeing the effect of Avisynth settings, displaying two comparison windows, etc …

But then it involves a lot of time spent in preferences, menus, etc., and repeating this process every time when there are dozens of movies!

My simple example with ffmpeg is complete because no GUI functionality is required.

It’s simply a matter of running a pre-existing Avisynth script; the output encoding is done by FFmpeg according to the chosen codec.

So, I do use VirtualDub to develop the Avisynth scripts, but then batch-running the script on all my movies is very convenient. I start it in the evening and come back the next day or even later!

Furthermore, FFmpeg is very feature-rich: creating the movie from the images, running Avisynth scripts, various encodings, etc.

In my case, all the steps from the images to the final encoding are handled by FFmpeg/Avisynth. Now, perhaps some steps could be better handled with tools like DaVinci Resolve?

1 Like

The presence of a graphical interface is, for me, inseparable from a video program. And whether that interface is visible or hidden doesn’t change anything. Whether it exists or not, it won’t really make things worse in terms of processing time or stability—especially since you have to rely on VirtualDub anyway for your script settings.

In this small piece of software (which is only at beta 1), the preset function already makes it possible to apply the same settings to as many clips as you want, without having to dive into the filter parameters every time. Batch processing of video files isn’t very hard to implement in my application; it will be done later.

Still in my opinion, VirtualDub is far from being outdated when it comes to final encoding of a file—whether it’s a video file or an image sequence—and it can be configured either from within VirtualDub or from the application.

As a reminder, the goal is to allow any user to use filters like Gammac or RemoveDirt, which don’t yet have equivalents in DaVinci Resolve. But over the years it’s clear that AviSynth will disappear—just not right away.

A new beta 2 version is available.

There are so many changes that I’ll give up trying to list them all, and some of them are truly innovative.

The program is now even simpler and more intuitive to use.

A user guide and tooltips will help you whenever needed.

Let me just remind you that no installation is required. Simply unzip the folder and click on CleanScan.exe.

If Avisynth+ 64 is not installed on your computer, the software will let you know and tell you where to download it.

No other software or DLLs are required — everything is already included in the folder.

1 Like

I think it would be extremely valuable for users to be able to add filters of their own.

Another thing you might want to add is True/False switches and Sliders like in AvsPmod

Also Directshowsource and Avisource are outdated, you should only rely on FFMS2 or Lsmash

You can manually add whatever filters you want to ScriptMaster.avs. This script will be duplicated as ScriptUser.avs, and your changes will be included there. However, the application does not dynamically handle the addition of controls based on the filters you add. So you won’t be able to adjust your filter settings from within CleanScan.

There will be major changes in the next version to improve the handling of the RemoveDirt, Degrain, and Sharp filters. But I’m not an Avisynth specialist, so you can always give me tips to improve the corrections.

I don’t see what you mean by a True/False switch. For each parameter?
For the sliders, the difficulty is coding the minimum and maximum values for each parameter, but I’m thinking about it.

The difficulty is providing the widest possible compatibility with the greatest number of files, since I have some files that only open with AviSource.

You can manually add whatever filters you want to ScriptMaster.avs. This script will be duplicated as ScriptUser.avs, and your changes will be included there. However, the application does not dynamically handle the addition of controls based on the filters you add. So you won’t be able to adjust your filter settings from within CleanScan.

I think there should maybe a + button in cleanscan that the user can press to add a filter, the user can then add what that filter is e.g keepgrain() and then enter the parameters

I don’t see what you mean by a True/False switch. For each parameter?
For the sliders, the difficulty is coding the minimum and maximum values for each parameter, but I’m thinking about it.

A True/False switch that when flipped translates to either a true or false in the script

Beta 3.0: a major step forward

This new Beta 3.0 introduces numerous improvements and significantly expands the application’s capabilities:

  • Built-in video player

  • Drag-and-drop support for all video files and image sequences

  • Extensive compatibility with a wide range of video formats

  • New filters and many improvements

  • Easier parameter adjustment with sliders and mouse wheel input

  • Preconfigured presets for Denoise, Degrain, and Sharp filters

  • Ability to display multiple filters simultaneously, depending on the user’s needs

  • Significant optimizations for faster processing and smoother playback

  • One-click selection between FFMS2, L-Smash, and LWLibav

  • Output file creation directly from the application, with several codecs and containers to choose from

  • Export of image sequences in various formats

Features carried over from previous versions:

  • No DLLs to install, only AviSynth+ if required

  • All application settings can be fully saved and recalled through an unlimited number of presets

  • Simple and intuitive interface

  • 4 available languages

  • Complete documentation

  • Detailed tooltips for every setting

2 Likes

ClearScan Beta 4.00

Here is yet another new version, this time featuring:

  • No more third-party installation required: everything is now fully integrated into the application. No more installation hassles related to Avisynth, its DLLs, or its player.

  • Batch processing for your clips.

  • Drag-and-drop loading of as many clips as you want, whether they are TIF image sequences or video clips with different characteristics, even mixed together.

  • A global or individual configuration (preset) can be applied to each clip or to all clips.

  • Each clip stores its own settings, offering complete flexibility.

  • The encoding settings now let you choose the resolution, chroma subsampling, bitrate, or adjust the final output quality (CRF).

  • Encoding can be performed either in batch mode or individually.

  • All settings and loaded clips are saved so they can be restored when the application is restarted.

  • The executable no longer triggers false positives in malware detection.

  • A user manual in PDF format, available in 4 languages, describes the application in detail.

  • A built-in form lets you report bugs, difficulties encountered, or requested improvements.

Download : kDrive

1 Like

This looks great Roland!! I have an advanced cleaning script that im interested in integrating, how would we go about adding this to the gui

Tell me more about your script: where does it come from? Did you write it yourself? What film formats do you work with?

Also, let me know what is missing from the currently proposed version of the script. And above all, share your script!

I am absolutely open to anything that could improve processing in Avisynth.

1 Like

It’s a dirt removal script that doesn’t effect grain and has professional results

If you drip-feed me bits of information, it will take forever before our exchanges become genuinely constructive. I’ve asked you several questions, and you’re only giving a partial answer to one of them :slightly_smiling_face:

would it be possible to discuss in DMs?