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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 15th November 2015, 13:18   #1  |  Link
FlaShow
Registered User
 
Join Date: Aug 2010
Posts: 47
Restore Old VHS anime. How ?

Hello,

I have an old VHS Jap anime and has some artifact at the top as you can see in the images below.
Can you explain to me what is the problem exactly and how i can fix it ?



Attached Images
  
FlaShow is offline   Reply With Quote
Old 15th November 2015, 18:11   #2  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Looks like dotcrawl?
creaothceann is offline   Reply With Quote
Old 16th November 2015, 11:32   #3  |  Link
~ VEGETA ~
The cult of personality
 
~ VEGETA ~'s Avatar
 
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
it looks like dotcrawl, but you may try denoising filters (spatial for example). They can be useful as I tried one in the deep past and worked well.
~ VEGETA ~ is offline   Reply With Quote
Old 16th November 2015, 11:44   #4  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
I did see some kind of analog noise but I just don't think it's dot crawl...
feisty2 is offline   Reply With Quote
Old 16th November 2015, 11:54   #5  |  Link
feisty2
I'm Siri
 
feisty2's Avatar
 
Join Date: Oct 2012
Location: void
Posts: 2,633
http://forum.doom9.org/showthread.php?t=172490
guess the problem is the same like this
feisty2 is offline   Reply With Quote
Old 16th November 2015, 13:34   #6  |  Link
JReiginsei
Registered User
 
Join Date: Apr 2002
Posts: 74
For the Chroma bands you may be able to make a mask so you can desaturate those areas.
__________________
Intel Core i5-4250U, 8 GB Ram, Intel HD 5000
JReiginsei is offline   Reply With Quote
Old 16th November 2015, 15:29   #7  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
Code:
## requires MaskTools2
## http://manao4.free.fr/mt_masktools.html

## kill color streaking at top of a VHS transfer
## http://forum.doom9.org/showthread.php?p=1647675#post1647675
ChromaDestripe(top=80, blur=6)

## Masked smoother for anime
## http://avisynth.nl/index.php/Msmooth
MSmooth(threshold=10, strength=2)
I'm using Msmooth for block smoothing, but it helps the RF noise (post #5) too.

EDIT those links again:
http://manao4.free.fr/mt_masktools.html
http://forum.doom9.org/showthread.ph...75#post1647675
http://avisynth.nl/index.php/Msmooth

Last edited by raffriff42; 16th November 2015 at 15:34.
raffriff42 is offline   Reply With Quote
Old 16th November 2015, 19:11   #8  |  Link
FlaShow
Registered User
 
Join Date: Aug 2010
Posts: 47
Thanks for the help

@raffriff42 I try to use your code but i can't get it to work even if i load Masktools2 ( )manually.
It says "There is no function named ChromaDestripe". I'm using MaskTools 2.0a48 ?
FlaShow is offline   Reply With Quote
Old 16th November 2015, 21:28   #9  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
RaffRiff already gave you the link:- http://forum.doom9.org/showthread.ph...75#post1647675
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???
StainlessS is offline   Reply With Quote
Old 17th November 2015, 03:10   #10  |  Link
JReiginsei
Registered User
 
Join Date: Apr 2002
Posts: 74
Yuy2

raffriff42, do you have a YUY2 version of ChromaDestripe?

This ChromaDestripe function makes me want to re-do my VHS transfers since they all have the same problems with the stripes at the top.
__________________
Intel Core i5-4250U, 8 GB Ram, Intel HD 5000
JReiginsei is offline   Reply With Quote
Old 17th November 2015, 05:26   #11  |  Link
raffriff42
Retried Guesser
 
raffriff42's Avatar
 
Join Date: Jun 2012
Posts: 1,373
OK this seems to work:
Code:
#######################################
## try to remove horizontal chroma stripes
##
## @ top - number of pixels (from top) to process (default 160)
## @ blur - vertical chroma blur radius (default 12)
## @ thresh - ignore smaller chroma changes (default 6)
##
## v0.42.02 16-Nov-2015 support YV24, YV16 and YUY2
##
function ChromaDestripe(clip C, int "top", int "blur", int "thresh")
{
    Assert(C.IsYV12 || C.IsYV24 || C.IsYV16 || C.IsYUY2,
    \  "ChromaDestripe: source must be YV12, YV24, YV16 or YUY2")

    top    = Max(0, Default(top, 160))
    blur   = Min(Max(2, Default(blur,  12)), 16)
    thresh = Min(Max(0, Default(thresh, 6)), 32)
    isYV12 = C.IsYV12

    U = C.UToY8
    V = C.VToY8
    Y = C.ConvertToY8
#return U

    tw = V.Width
    th = V.Height

    ## X = (highpass blurred anti-signal)

    xh = Max(1, Round(th / (isYV12 ? 4 : 16)))
    XU=U.BilinearResize(tw, xh, src_top=1, src_height=(th-2))
    \   .BilinearResize(tw, th) 
    XV=V.BilinearResize(tw, xh, src_top=1, src_height=(th-2))
    \   .BilinearResize(tw, th)
#return XU

    ## H = highpass - find bold horizontal U & V edges

    HU=U.Subtract(XU).Invert.ColorYUV(cont_y=98)
    HV=V.Subtract(XV).Invert.ColorYUV(cont_y=98)
#return HU.Histogram

    ## M = mask - pass only areas with bold hor. U & V edges

    MU=HU.mt_lut("x 128 - abs " + String(thresh) + " - 512 * ")
    MV=HV.mt_lut("x 128 - abs " + String(thresh) + " - 512 * ")
#return MU

    MU=MU.mt_expand
    \    .BilinearResize(tw/4, th/4)
    \    .mt_expand.mt_expand
    \    .BilinearResize(tw, th) 
    MV=MV.mt_expand 
    \    .BilinearResize(tw/4, th/4)
    \    .mt_expand.mt_expand
    \    .BilinearResize(tw, th) 
#return MU

    ## restrict mask to "top" pixels

    top = (isYV12 ? top / 2 : top)
    MU = (top<=0 || top>=th) 
    \       ? MU 
    \       : MU.Crop(0, 0, -0, top).AddBorders(0, 0, 0, (th-top))  
    MV = (top<=0 || top>=th) 
    \       ? MV 
    \       : MV.Crop(0, 0, -0, top).AddBorders(0, 0, 0, (th-top))
#return MU

    ## B = chroma blur

    nh = Max(1, Round(th / blur))  / (isYV12 ? 1 : 2) 
    BU=U.BilinearResize(tw, nh, src_top=1, src_height=(th-2))
    \   .BilinearResize(tw, th) 
    BV=V.BilinearResize(tw, nh, src_top=1, src_height=(th-2))
    \   .BilinearResize(tw, th)
#return BU

    ## use blurred chroma in areas of high variation

    U=U.Overlay(BU, mode="blend", opacity=1.0, mask=MU)
#return U
    V=V.Overlay(BV, mode="blend", opacity=1.0, mask=MV)

    YToUV(U, V, Y)
    return (C.IsYUY2) ? ConvertToYUY2 : Last
}
The final Convert statement is needed because the output is otherwise YV16, which (if I am not mistaken), can be losslessly converted to YUY2 (and back). The chroma sampling is the same, it's just the arrangement in memory that's different (planar YV16 vs. interleaved YUY2)
raffriff42 is offline   Reply With Quote
Old 17th November 2015, 18:03   #12  |  Link
FlaShow
Registered User
 
Join Date: Aug 2010
Posts: 47
@StainlessS sorry my bad

Thanks raffriff42. I have add this ChromaDestripe to plugin directory as avsi file but now it display
there is no function named "UtoY8" even after i used ConvertToYV12 after using AVISource ?

video info:
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
FlaShow is offline   Reply With Quote
Old 17th November 2015, 18:33   #13  |  Link
ChiDragon
Registered User
 
ChiDragon's Avatar
 
Join Date: Sep 2005
Location: Vancouver
Posts: 600
Quote:
Originally Posted by FlaShow View Post
there is no function named "UtoY8"
Y8 was added with Avisynth v2.60, so upgrade.
ChiDragon is offline   Reply With Quote
Old 17th November 2015, 18:42   #14  |  Link
FlaShow
Registered User
 
Join Date: Aug 2010
Posts: 47
@ChiDragon Thanks

@raffriff42 Thanks for the code it is awesome
FlaShow is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 11:56.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.