Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
28th June 2014, 22:18 | #1 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
very bad chroma artefact on poor video
I have a very old clip that has a very bad chroma artefact (I don't know how to name it).
https://www.sendspace.com/file/7o757g What can be done to make it better? |
28th June 2014, 23:04 | #2 | Link |
Registered User
Join Date: Sep 2005
Location: Vancouver
Posts: 600
|
The chroma is flickering between two very different hues, back and forth, 25 times per second. Half of the frames are purple-tinted and the other half are green-tinted.
If the entire clip has this little motion, you can simply throw away half of the chroma frames and duplicate the others, such that chroma is now running at 12.5 fps. Like this: Code:
AVISource("videoExample_BADChroma.avi") Even = SelectEven() Odd = SelectOdd() Even = MergeChroma(Even,Odd) Interleave(Even,Odd) Code:
AVISource("videoExample_BADChroma.avi") Even = SelectEven().Tweak(hue=50,sat=0.7,coring=false) Odd = SelectOdd().Tweak(hue=-5,sat=0.9,coring=false) Interleave(Even,Odd) |
29th June 2014, 01:37 | #3 | Link |
Retried Guesser
Join Date: Jun 2012
Posts: 1,373
|
I like the first idea, it's nice and simple. But here's @LemMotlow's post with a more advanced solution if it's needed:
http://forum.doom9.org/showthread.ph...22#post1641322 |
29th June 2014, 14:09 | #4 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
Ok, now I see some hope to restore it.
But the first approach doesn't work for all the clip, as from some frames on, it has this repeating pattern: (Assuming r=reddish frame, y=yellowish frame) ryrrryryyyryrrry So the result of mergechroma at some point is 2r8y frames. Also the second approach with colourlike has the same problem of 1y4r frames. The ideal should be analyze each field and determine if hue is in range yellowish --> correct the hue, else is reddish --> so correct in other way, then interleave. EDIT: maybe I must tweak a bit more the colourlike settings, but I'm no expert at all in this hue thing... is there some tut/guide to correct yellowish/reddish? EDIT2: corrected pattern Last edited by franketto; 29th June 2014 at 21:19. |
29th June 2014, 21:48 | #6 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
As never said... I discovered the pattern changes...
So, I think the only way is to detect if frame is greenish or purplish and make different hue adjustments. I'll have no time to test in the next 2 weeks, so I'll return to discuss later. Thank you. Last edited by franketto; 29th June 2014 at 21:50. |
30th June 2014, 03:56 | #8 | Link |
Registered User
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
|
to me, that pattern looks like telecined video that has been improperly deinterlaced instead of inverse-telecined. I do not know why people insist on deinterlacing everything in sight -- especially film-source video that isn't interlaced to begin with.
|
13th July 2014, 16:01 | #9 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
I'm here.
I tried this script: Code:
ConditionalFilter(v0, purplish(v0,-25) , greenish(v0,35), "AverageChromaU()", ">", "116.5") function purplish(clip c, int value){ # c = c.ScriptClip("""subtitle("purplish " + String(AverageChromaU) )""").subtitle(string(value),200 ) c.Tweak(hue= value,sat=1.1,coring=false) ColorYUV(Autowhite=true) WriteHistogram("E:\test\p_hist.txt",1) } function greenish(clip c, int value){ # c = c.ScriptClip("""subtitle("greenish " + String(AverageChromaU) )""").subtitle(string(value),200 ) c.Tweak(hue= value,sat=0.9,coring=false) ColorYUV(Autowhite=true) WriteHistogram("E:\test\g_hist.txt",1) } return colourlike("E:\test\p_hist.txt", "E:\test\g_hist.txt") It's a lot better than original, but there are still some chroma issues like green "splashes" in the image (fixed at left+top and also around the pic): https://www.mediafire.com/?nclxpb48tpfml8c Could they be removed? EDIT: I added a clip with subtitles overimpressed to detect which was original purplish/greenish frames: https://www.mediafire.com/?g3ydgcq7r30w7ug Last edited by franketto; 13th July 2014 at 16:21. |
13th July 2014, 16:42 | #11 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Another method is to smooth out the fluctuations using a temporal smoother on the u, v channels. Works ok on a static "talking heads" scene like your sample - but in a clip with lots of motion, you might get chroma ghosting artifacts
Code:
main=AVISource("videoExample_BADChroma.avi") u=main.utoy().ttempsmooth(maxr=3, lthresh=200, strength=8) v=main.vtoy().ttempsmooth(maxr=3, lthresh=200, strength=8) ytouv(u,v) mergeluma(main) EDIT: oops, I missed that temporalsoften was suggested in that other thread Last edited by poisondeathray; 13th July 2014 at 16:54. |
14th July 2014, 09:05 | #12 | Link | |
Registered User
Join Date: May 2014
Posts: 74
|
Quote:
Thank you: your code is better than mine in the clip I uploaded, but in other parts is worse. Like i.e. this one: https://www.mediafire.com/?afyrc2s1exu2i2a Infact I get flashing purple on face like this: But there is no green splashes like in mine... |
|
14th July 2014, 14:36 | #13 | Link | |
Registered User
Join Date: Sep 2007
Posts: 5,346
|
Quote:
e.g Code:
main=AVISource() u=main.utoy().ttempsmooth(maxr=3, lthresh=256, strength=8).ttempsmooth(maxr=5, lthresh=256, strength=8) v=main.vtoy().ttempsmooth(maxr=3, lthresh=256, strength=8).ttempsmooth(maxr=5, lthresh=256, strength=8) ytouv(u,v) mergeluma(main) |
|
16th July 2014, 04:19 | #16 | Link | |
Registered User
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
|
Quote:
I made color corrections two ways. First I used the ColourLike method referred to in raffriff42's earlier post. Next, I tweaked with image color controls in TVMW5's encoder, which work in YUV and RGB. If you're trying to clean up specific discolored skin tones, you'll need to work in RGB. You can try ColorMill, but gradation curves would be more precise. Seems like a lot of detail overkill for a video that was thoroughly wrecked by whoever made it. I think the purple frame that's out of place might be frame 29 in your sample. I replaced it with ReplaceFramesMC. Here's an mp4 with color corrections. Other than calming the flicker, there's no hope for anything else. Denoise attempts just make it worse: https://www.mediafire.com/?e6uor93h4rn3q6b . Its small, ~2MB. Sorry for the offsite link, but a 300kb limit for doom9 attachments is a pretty clear message that uploads aren't welcome. Rules are rules. Last edited by LemMotlow; 16th July 2014 at 04:39. |
|
16th July 2014, 09:15 | #17 | Link |
Registered User
Join Date: May 2014
Posts: 74
|
I quite got it.
It was ColorYUV(Autowhite=true) that changed hue too much. So I made all tweak manual corrections and got some little yellow variations on faces' edges. I corrected them with: Code:
Tweak(StartHue=130, endHue=200, hue=20 ,sat=0.8) I used also Mdegrain1, a dehalo and nnedi3 to reach the 480x360 resolution that's little better on diagonal lines instead of the 320x240 (especially in other frames I haven't uploaded). The drawback is a washing in the details of the jacket, regards your take and banding. Maybe it's ttsmooth. I used dither to compensate a bit. In every case, now it's watchable, the original was so much terrible. EDIT: What should you use to deflicker? Last edited by franketto; 16th July 2014 at 09:22. |
16th July 2014, 13:50 | #18 | Link | |
Registered User
Join Date: Jul 2011
Location: Tennessee, USA
Posts: 266
|
I confess, my script for the linked sample is a mess. I gave up on denoising, had a big project running on another PC and had to keep an eye on it. DeBlock() and GradFun3() was about all the denoising I did, and I tried that last.
Quote:
Overall the images are beyond the desired RGB 16-240 range. I started by working with Even fields, where bright red is off the charts but darker colors and most midtones look fairly correct. I named the resulting Even fields as "Reds". Code:
source=last source.SelectEven() ColorYUV(off_y=-6,gain_v=-5,cont_v=-150,cont_u=-30,gain_u=3) SmoothLevels(16,1.0,255,15,245,chroma=200,limiter=0,tvrange=true,dither=100,protect=6) Reds=last Code:
Source.SelectOdd() ColorYUV(Autowhite=true) ColorYUV(cont_y=-10,off_y=-8,cont_v=-20,off_v=5,cont_u=-180,gain_u=-10) Grns=last Code:
RedsHist="E:\forum\franketto\B\RedsHist.txt" GrnsHist="E:\forum\franketto\B\GrnsHist.txt" Code:
Reds.WriteHistogram(RedsHist) Grns.WriteHistogram(GrnsHist) Grns.ColourLike(GrnsHist,RedsHist) Code:
Interleave(Reds,Grns) ReplaceFramesMC(29,1) new1=last Code:
new1 Crop(2,2,-6,-4).AddBorders(4,2,4,4) MergeChroma(MCTemporalDenoise(settings="high")) DeBlock() MergeChroma(aWarpSharp2(depth=30)) GradFun3(thr=1.2) LimitedSharpenFaster() SMoothTweak(contrast=1.2,saturation=1.4) SmoothLevels(16,0.95,255,14,240,chroma=200,limiter=0,tvrange=true,dither=100,protect=6) Dither_convert_yuv_to_rgb(matrix="601",interlaced=false,tv_range=true,cplace="MPEG2",lsb_in=false,output="rgb32") return last There must be 50 other ways. At least. |
|
Thread Tools | Search this Thread |
Display Modes | |
|
|