Log in

View Full Version : Correcting a film that was developed with a colour fault


Doorn9
19th July 2019, 20:47
Hello all,

First post - please be gentle...

I've been lurking on this forum for nine years now, lured in by videoFred's impressive early results. I want that, I thought, and got going getting my workflow together. Now, after many successfully restored super-8 films, I've run into the first clip that I can't get right whatever I do, and I'd appreciate help.

The clip concerned is an almost 40-second super-8 film scene with very little movement of either camera or subject, and with plenty of issues that I can work out - but one that I cannot. The original is here:
clip 1: original
http://www.vandoorn.tv/doom9/022.avi

The problem gets more pronounced after I run my usual set of correction tools over it. The original has a lot of yellow discolouration, for instance, and removing that alone already makes the problem more obvious. For the sake of completeness, this is the clip of the original and (currently) final versions side-by-side:
clip 2: original vs final
https://youtu.be/Zojgq3XvAMM

It seems like the sun appears and disappears several times. That, however, is not so. The change in colour from cold to warm and back affects the entire image; it's not as if clouds were moving. What happened is, in fact, an error during film development. I looking to even it out over the entire run. And I don't know how to go about it.

What follows is where I've come to (which may be a wrong way to go about it, but if it usable then I'm stuck anyway). My thinking was that I'd create a clip in parallel that contains an averaged-out colour (which I made in Photoshop). The changes in that average should then be a measure of the correction I need to apply. The average-clip was made in Photoshop, using the median noise-suppression filter with maximum radius (500) and some extra averaging and evening-out trickery. The result is here, next to the original:
clip 3: original vs average
https://youtu.be/7Mc_UM74DAI

I then asked a friend who is not (as I am) colourblind to choose a reference frame - he chose 831. Even though I'd have been happier with one from the non-sunny seeming range - but oh, well. I then made a second parallel (average) clip that contained just instances of frame 831 for the entire
length. Below: those averages next to one another. It seems that the colour problem (and, for that matter, the flickering in the original) are present in that new clip as I think I need them.
clip 4: reference average vs per-frame average
https://youtu.be/PYcsHdk4Eqc

From there, I was hoping that the following steps would be easy using the avisynth overlay function, but - no. What I tried with no luck at all was:

create a clip with the difference between reference average and average
invert the difference
apply the inverted difference to the original

I won't bore you with all the things that went wrong, suffice to say: I got nowhere.

Anyone know how to make this work?
Anyone know a better way?

I have more clips with this type of problem, so I hope there's a method that can be automated (i.e. within avisynth/virtualdub(mod) in the versions I have and need - see below)!

Thanks for looking,
Wouter van Doorn

==============================
If it is of any interest, my setup is:
- Linux Mint 18.3-64 laptop Dell XPS13
- VirtualDub 1.10.4 (build 35491) 32 bit under Wine 1.6.2
* Plugin: DeShaker 3.1
- VirtualDubMod 1.5.10.2 (build 2542) 32 bit under Wine 1.6.2
* Plugin: DeShaker 3.1
- AviSynth 2.6 32 bit under Wine 1.6.2
* Plugin: deflicker
* Plugin: TCPDeliverffms2
* Plugin: ffavisynth
* Plugin: mvtools2
* Plugin: TTempSmooth
* Plugin: mvtools
* Plugin: ffavisynth
* Plugin: degrainmedian
* Plugin: mt-masktools-25
* Plugin: warpsharp
* Plugin: DirectShowSource
* Plugin: hqn3d
* Plugin: colors_rgb
* Plugin: despot
- Photoshop CS6 64 bit under PlayOnLinux 4.2.10
* Plugin: iCorrect EditLab Pro 6.0 plugin for colour correction
- ffdshow rev 4532
- ffmpeg 4.1.3-0york1~16.04
- xvid 1.3.2

videoFred
20th July 2019, 11:27
Hello Wouter and welcome here! ;)

Please upload an original not manipulated example somewhere so we can download it.

Fred.

Doorn9
20th July 2019, 14:12
Hi Fred,

The first link is the original. Nothing done to it at all.

Thanks for looking!
Wouter

ChaosKing
20th July 2019, 15:41
Could you identify which plugin is causing this color/brightness changes? A script would be good to reproduce the results...

Doorn9
20th July 2019, 17:09
The problem is in the original. Cleaning the clip up makes it stand out more - the yellow cast on the original hides quite a bit of the issue. Remove that (I do that in Photoshop with the iCorrect EditLab 6 plugin, not with an avisynth script) and the *real* problem shows up.

wonkey_monkey
20th July 2019, 19:17
Hi Fred,

The first link is the original. Nothing done to it at all.

Thanks for looking!
Wouter

Uploading to YouTube will recompress it and possibly change the colour matrix - not by a great amount, but an unaltered cut from the original file may be preferable.

ChaosKing
20th July 2019, 19:53
Maybe AutoAdjust() with a high temporal radius could help https://forum.doom9.org/showthread.php?t=167573

Asmodian
20th July 2019, 20:44
Nothing done to it at all.

Uploaded to Youtube and nothing done to it at all are mutually exclusive realities.

Doorn9
20th July 2019, 22:28
Uploading to YouTube will recompress it and possibly change the colour matrix - not by a great amount, but an unaltered cut from the original file may be preferable.

Ah. That shows what I know. I didn't care about the compression, but mucking about with the colours is exactly what I wouldn't want here. So this is the original - as far as we can speak of an original considering it's super-8!
https://www.vandoorn.tv/doom9/022.avi

Thanks for explaining,
Wouter

Doorn9
20th July 2019, 22:29
Uploaded to Youtube and nothing done to it at all are mutually exclusive realities.

Learning all the time!
http://www.vandoorn.tv/doom9/022.avi

Doorn9
20th July 2019, 22:30
Maybe AutoAdjust() with a high temporal radius could help https://forum.doom9.org/showthread.php?t=167573

Something to look into; I do not know autoAdjust, so there's something to look at.

Thanks!
Wouter

videoFred
21st July 2019, 10:05
Learning all the time!
http://www.vandoorn.tv/022.avi

The requested URL /022.avi was not found on this server.
Oops....... sorry now it works :D

Fred.

videoFred
21st July 2019, 11:20
The original file is low resolution and low bitrate.(mpeg4). I see lots of block artefacts caused by compression. Is this how the original scans where delivered?

This is what I can make from it: stabilized, cleaned with RemoveDirtSMC(), Gammac() to remove the yellow cast, sharpened and finaly some minor RGB color correction (a bit less blue and a bit more red)

https://www.dropbox.com/s/fkeoi0bgojgseb1/260_Van_Doorn.avi?dl=0

But to have realy good results, you need a better scan from the original 8mm film.

PS: your corrected example is pretty good. The brightness change is probably caused by the borders.
This is why I have used a cropped clip for the Gammac detect clip.

Fred.

videoFred
21st July 2019, 12:53
Ok, I was not awake this morning :D

The brightness change is on the original indeed.
Fortunately, Gammac() in modus -1 can deal with this:

https://www.dropbox.com/s/rh6gwq3qfjsd751/260_Van_Doorn_01.avi?dl=0

Please look at the histograms at frames 565, 572, 579 and 735.

I doubt ........ is this brightness change or compression block artefact change? Or both?

Fred.

Doorn9
21st July 2019, 15:47
Hello videoFred!

I was already very impressed by the first effort (when you were asleep...??) because it was already a lot better. Then this one came along, and it seems you have simply completely solved the problem! At least to my not very colour-sensitive eyes it seems so. Anyway - SO much better than the original, that I will now have to find out all I can about this gammac thing - whatever it is - so I can build it into my workflow. I hope I can do it under Linux/wine (it can be tricky) but I'll give it the best go I can.

What's the best resource for me to visit for learning about installation, settings, function parameters and all that?

Wouter

PS: all those many years ago it was actually you who encouraged me to start looking into digital film processing with the huge script you then had on this forum. It was the basis for all I do now (so far: thirteen stages for a piece of super-8 film, soon to be fourteen I hope!). Glad of the opportunity to thank you very much for what you published then, in addition to your response here!

StainlessS
21st July 2019, 16:46
I thought that I had seen something about noisy 'sparkles' in this thread, maybe its was in some other thread, but anyway,
suggest do an eg Blur(0.2) on GamMac DC detect clip, just in case, no real downside to doing that.

videoFred
21st July 2019, 18:56
What's the best resource for me to visit for learning about installation, settings, function parameters and all that?

Hi Wouter,

Gammac thread:
https://forum.doom9.org/showthread.php?t=173695&highlight=gammac

And Johnmeyer has made a version of my film restoring script with Gammac included. You can do a search here for this.


Glad of the opportunity to thank you very much for what you published then, in addition to your response here!

You are welcome! :)

Fred.

videoFred
21st July 2019, 18:59
I thought that I had seen something about noisy 'sparkles' in this thread, maybe its was in some other thread, but anyway,
suggest do an eg Blur(0.2) on GamMac DC detect clip, just in case, no real downside to doing that.

Good idea as usual! :)

Fred.

StainlessS
21st July 2019, 19:38
Hi Fred.
I'm still a bit stuck on AutoLevels, when I get the frame radius smoothing thing sorted out[well actualy that part pretty much done], I'll add it and scene change detection part to GamMac.

EDIT: Should not slow it down much, had it [AutoLevels] doing something like 560 FPS on STD Def clip on my crap machine. [Same clip with Autogain I was getting more like 68FPS].

Bernardd
22nd July 2019, 11:17
Hi,

022.avi is better clip source.

I have try this source only with Automatic white balance with RGBAdapt plugin, post https://forum.doom9.org/showthread.php?p=1878904#post1878904

With only gain and contrast, we can get a readable white balance. Note this way have no issue with frame 102 with her big black dust. Two samples bellow.

AWB_Func(matrix="Rec601",show_scrutinized=false,x=0.04,y=0.04,w=0.04,h=0.04,threshold=0.1,show_info=false,
\ gain = truee, cont = true, g_c_decrease = 0.0, bias = false, rpow = false, spow = false, gamma_bias_mix = 0.5)

https://www.dropbox.com/s/5mxr9gwd5cbbaem/gain%20and%20cont%20min.mkv?dl=0

AWB_Func(matrix="Rec601",show_scrutinized=false,x=0.04,y=0.04,w=0.04,h=0.04,threshold=0.1,show_info=false,
\ gain = truee, cont = true, g_c_decrease = 1.0, bias = false, rpow = false, spow = false, gamma_bias_mix = 0.5)

https://www.dropbox.com/s/hc82aqn22k5oh5y/gain%20and%20cont%20max.mkv?dl=0

videoFred
22nd July 2019, 12:34
Hi Fred.
I'm still a bit stuck on AutoLevels, when I get the frame radius smoothing thing sorted out[well actualy that part pretty much done], I'll add it and scene change detection part to GamMac.

Looking forwards :)

Fred.

Doorn9
22nd July 2019, 14:31
Hello Bernardd,

Thank you for taking the time to look into this.

I've looked at the two samples, but to be honest I don't see much (any!) improvement in the problem area. Was this meant as an intermediate clip leading to some sort of exciting combination with the original (or, or, or)? I'm a bit lost, I'm afraid... BTW: the source for the second clip contains what looks like a typo: 'truee' instead of 'true' - which may (or may not) have had an effect on the outcome.

For now, the GamMac approach seems the one that leads to success. I'm following that up now, trying to get it going.

Fingers crossed!
Wouter

Doorn9
22nd July 2019, 15:00
Hello Fred,

Before I go and do a lot of things with wrong inputs... are these the right dlls for me to attempt to run 'the script'?

GRunT101.zip
RT_Stats_25&26_dll_v1.43_20141008.zip
RgbAdapt_25&26_x86_x64_dll_v0.05_20190303.zip
GScript_11.zip
GamMac_x86_x64_v1.10_dll_20180615.zip
FredAverage_25&26_x86_x64_dll_v0.03_20190115.zip

And is this the correct post to cut the script source from?
https://forum.doom9.org/showthread.php?p=1800097

Last but not least: what arguments to the script did you use to get the result you showed?

It looks daunting, but I'm game!
Wouter

StainlessS
22nd July 2019, 16:59
Bernardd example requires his script(AWB):- https://forum.doom9.org/showthread.php?t=174411

I'm not sure if it uses GamMac or not (It can, but dont know if settings use it).

To use GamMac alone, see example avs file in AVS folder of the dll zip.

Bernardd
23rd July 2019, 09:33
Hello Doorn,
I apologize for my mistake "truee". It has no effect, because i use the AvsPmod and their user sliders. My mistake is only during copiing on forum.
My RGBAdapt based script works only on white balance. It mix or not gain, contrast, bias, rpow and spow (gamma).
It do not use gammac.

For your problem, have you try DRN2 plugin, http://www.avisynth.nl/users/warpenterprises/files/dnr2_5F25_dll_20021225.zip ?
It has one little correction action. But also it can help you to see the bad aeras.
In fact with threshY_hi, threshU_hi and threshV_hi decreased to 0, the output show the bad aeras, with one color, by channel.

Doorn9
23rd July 2019, 10:59
For your problem, have you try DRN2 plugin, http://www.avisynth.nl/users/warpenterprises/files/dnr2_5F25_dll_20021225.zip ?

Every day I hear of things that I had no idea about! That is yet another one. Sounds like a very useful analysis tool. For now, I'm concentrating on getting gammac working for me, hoping to get anywhere near what vFred managed. But all suggestions are gratefully received, and not forgotten!
Wouter

Doorn9
25th July 2019, 18:29
Hi Fred, and others.

GamMac was immediately totally brilliant at getting the colour consistent! The example script was very helpful, and quite easy to adapt to my needs. I had already read warnings that scale=2 was too aggressive in most cases, so I changed it to scale=1. And I chose the green channel as lock channel.

What I could not get right was the deflickering, which is apparently a side-effect of this filter if used right. Obviously, I didn't get it *quite* right, but my normal method worked well - Fizik's deflicker filter on a manipulated source, where I choose a reference frame, insert that 5 times before every image, deflicker and remove the helper frames again.

So, many thanks to all who responded, and the final result can be seen here, on the right, in comparison with the best I had so far on the left (*).
http://www.vandoorn.tv/doom9/022-without-and-with-gammac.avi
Very happy with the result. Better than all my tries at getting it watchable!

(*) with too garish colours; pushing saturation sometimes helps in disguising flaws, that's why it was overdone.

johnmeyer
25th July 2019, 19:38
Some links to posts where I explored the flicker problems with GamMac:

https://forum.doom9.org/showthread.php?p=1818369#post1818369

I used Deflicker after GamMac to reduce the flicker, in addition to things described in the posts which follow the post in the link above.

videoFred
26th July 2019, 15:15
Some links to posts where I explored the flicker problems with GamMac:

Hi John, :)

Perhaps this is of interest for you too:


What I could not get right was the deflickering, which is apparently a side-effect of this filter if used right.

Flickering is not a side-effect of Gammac() when good used.

Flickering after Gammac() can be caused by dirt spots, moving black borders, compression artefacts etc....

So it is very important to clean the source file before using Gammac().
RemoveDirtSMC() is my favorite cleaner for this.

I advice to use the "DC" option in Gammac. You can prepare a special cleaned and cropped clip, name it "detect" for example and then use Gammac(DC=detect).

Also, on your example clip I have used Gammac(LockChan= -1).
This is very helpful to remove flickering. But then you must work scene by scene because you will have to set Lockval also. And Lockval will change from scene to scene.

And I always use ignore low and ignore high pixels with loTH and hiTh, always the same settings: 0.2 and 0.04.
This helps a lot to avoid unwanted effects.

The complete Gammac() code for your example clip was:

Gammac(DC=detect, x=0, y=0, w=0, h=0, LockChan= -1,\
Lockval= 83, RedMul= 1.02, GrnMul= 1.02, BluMul= 0.98,\
Show= false, Verbosity=3, th=0, LoTh= 0.2, hiTh= 0.04,\
SCALE=2, oMin=5, oMax=250)

I hope this is clear? :)

Fred.

Doorn9
27th July 2019, 09:34
Thank you, it is clear. The thresholds are ging to be very helpful. I'll try out the lockchan=-1 - that's what I had not yet found at the time.

I didn't mean to write that gammac introduced flickering! I hoped to say that gammac, if used right, could be used for DEflickering. I knew I'd read that *somewhere*, but couldn't find it at the time.

I always work scene by scene (I don't need the problems caused by various scene change detectors, and I also like to feed in extra frames at beginning and end of each clip. At the beginning I add the beginning, reversed, and at the end I add the end, also reversed. That often helps the stabiliser and also temporal passes that otherwise sometimes struggle at begin and end of clips.

For gammac, I do use a cleaned and cropped detect clip (I quickly found I had to!), and it works phenomenally well! I'll be using it a lot - initially for all clips, though for quite a few there are other ways I sometimes get better results.

It's all about the right tool for the right problem, and this is a tool I'll enjoy using! There's still a lot of experimenting to do with values for lockchan and lockval. The multipliers for the various colours I'll have to leave well alone as a consequence of colourblindness. Tweaking of colours is possible for me only by working with known grey points. That comes at a later stage, and works pretty well (though I still need someone to tell me if I make mistakes!).
:thanks:
Thank you (and StainlesS) so much for providing it!