VideoHelp Forum




+ Reply to Thread
Results 1 to 7 of 7
  1. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    I have an old PAL DVD cartoon, I would like to improve its quality a bit and upscale to FullHD to make it enjoyable on HDTV. The problems that I noticed are that the video is quite noisy and blurry. I have a script that Jagabo compiled for me for another, similar project earlier. I assumed some parts could work here, so I tested it and it seems there is improvement indeed. However that script was originally for solving problems of an NTSC interlaced cartoon, so I am not sure whether the part I implemented for this PAL DVD project is completely okay this way. Could you check it and confirm that the code really matches, or whether some parts could still be improved and fine tuned for the recent video preferences?

    Here is the code I used:

    Code:
    Mpeg2Source("video.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    ColorMatrix(mode="rec.601->rec.709")
    VInverse()
    Santiag() 
    TemporalDegrain2() 
    MergeChroma(aWarpSharp2(depth=5), aWarpSharp(depth=15))
    dehalo_alpha(rx=3.0, ry=2.0)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=800, fheight=720)
    aWarpSharp2(depth=10)
    Sharpen(0.5)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1348, fheight=1080)
    aWarpSharp2(depth=5)
    Sharpen(0.3)
    ChromaShiftSP(x=-1, y=1)
    AddBorders(286,0,286,0)
    An unconverted segment from the DVD is also attached.
    Image Attached Files
    Quote Quote  
  2. Filtering is personal taste, but I'd at least recommend trying Stab in combination with TemporalDegrain for this one (the original, not TemporalDegrain2), as the original will probably remove more noise and help stabilise the picture more. Between Stab and TemporalDegrain, much of the "wobble" should be gone.

    Stab moves the picture around, and it'll add borders to the sides to compensate, so you'll need to crop at least 2 pixels from each edge. If you see any little borders appear at the edges, crop an extra 2 pixels all round, but I think the cropping below was enough for your sample. There's a warning on the Wiki about Stab causing random green frames. I've used it quite a bit recently and I'm yet to see one, so that may be related to an older version of one of the plugins it requires.
    http://avisynth.nl/index.php/Stab

    Other than that I just tried some filtering until I found something I liked. Someone else may have suggestions for improving it. I couldn't decide whether the DVD was supposed to display as exactly 4:3 or with an ITU aspect ratio (slightly wider). Based on the cropping below the width would be either 1480 or 1448. You can decide which to use.

    The following will no doubt be very slow, as TemporalDegrain is slow, and ContraSharpMod will be slow at 1080p, although it's possibly not all that much slower than the script you're using. I tried to add them.... but I couldn't force myself to add borders.
    Of course the filters/functions can be tweaked if you want to play around.

    Code:
    LoadPlugin("C:\Program Files\MeGUI\tools\dgindex\DGDecode.dll")
    DGDecode_mpeg2source("D:\segment.d2v")
    Stab()
    TemporalDegrain()
    ColorMatrix(mode="rec.601->rec.709")
    Crop(2,2,-2,-4, align=true)
    FastLineDarken()
    MergeChroma(aWarpSharp2(Depth=7), aWarpSharp(Depth=20))
    nnedi3_rpow2(4, cshift="Spline36Resize", fwidth=1480, fheight=1080)
    FastLineDarken()
    MAA()
    DeHalo_alpha()
    CSMod()
    Gradfun3()
    There's a zip file attached containing some of the functions I used if it helps. I've also included updated and older versions of some of them if you want to experiment. It might save you some time if any are hard to find.
    Image Attached Files
    Last edited by hello_hello; 9th Mar 2020 at 03:05.
    Quote Quote  
  3. Still not great but here's what I came up with:

    Code:
    Mpeg2Source("sample.d2v", CPU2="ooooxx", Info=3) 
    Crop(8,0,-8,-0, align=true)
    Yadif(mode=1)
    SRestore(frate=23.976)
    Stab(dxmax=4, dymax=4, mirror=15)
    ColorMatrix(mode="rec.601->rec.709")
    VInverse()
    Santiag() 
    TemporalDegrain(SAD1=200, SAD2=150, sigma=8) 
    dehalo_alpha(rx=2.5, ry=2.0)
    dehalo_alpha(rx=1.5, ry=1.0)
    MergeChroma(aWarpSharp2(depth=5), aWarpSharp2(depth=15))
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=960, fheight=720)
    aWarpSharp2(depth=5)
    Sharpen(0.5)
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=1440, fheight=1080)
    aWarpSharp2(depth=5)
    Sharpen(0.3)
    ChromaShiftSP(x=-1, y=1)
    #AddBorders(240,0,240,0) # if you need 1920x1080
    Quote Quote  
  4. Originally Posted by jagabo View Post
    Still not great but here's what I came up with:

    Yadif(mode=1)
    SRestore(frate=23.976)
    Is there blending I'm not seeing or is that just a way to change the frame rate?
    Quote Quote  
  5. Originally Posted by hello_hello View Post
    Originally Posted by jagabo View Post
    Still not great but here's what I came up with:

    Yadif(mode=1)
    SRestore(frate=23.976)
    Is there blending I'm not seeing or is that just a way to change the frame rate?
    Oops, I had downloaded another video shortly before and got the two confused. I was working with the wrong video. Disregard that post.
    Quote Quote  
  6. Member
    Join Date
    Apr 2012
    Location
    Hungary
    Search PM
    Originally Posted by hello_hello View Post
    Filtering is personal taste, but I'd at least recommend trying Stab in combination with TemporalDegrain for this one (the original, not TemporalDegrain2), as the original will probably remove more noise and help stabilise the picture more. Between Stab and TemporalDegrain, much of the "wobble" should be gone...
    Thank you!

    I have checked it, with AVSProMod, the image seems fine this way, however I will need to try and learn how to set up Avisynth in multi-threaded mode, because this script will require too much time on my computer in single threaded mode. It also loads significantly slower in AVSProMod. We'll see if I can achieve some improvement in rendering time.
    Quote Quote  
  7. I don't try to do any multithreading in Avisynth. If encoding jobs are slow due to slow filtering and CPU usage isn't very high, I just run two encodes at a time. You could run more than two if you have lots of CPU cores, although at 1080p, memory might be an issue.

    About the closest I get is MP_Pipeline. It can speed things up a bit when filtering is slow by running a script in two processes and it's very stable. MP_Pipeline doesn't pass variables from one process to the next (only the video output from the first process), and if you're manually loading plugins you have to load the required plugins for each process. I don't think it supports audio, but for a script that's just one function/plugin following another it's easy to use. Try something like this to see if it helps:

    Code:
    MP_Pipeline("""
    
    LoadPlugin("C:\Program Files\MeGUI\tools\dgindex\DGDecode.dll")
    DGDecode_mpeg2source("D:\segment.d2v")
    Stab()
    TemporalDegrain()
    ColorMatrix(mode="rec.601->rec.709")
    Crop(2,2,-2,-4, align=true)
    FastLineDarken()
    MergeChroma(aWarpSharp2(Depth=7), aWarpSharp(Depth=20))
    nnedi3_rpow2(4, cshift="Spline36Resize", fwidth=1480, fheight=1080)
    
    ### prefetch: 16, 0
    ### ###
    """)
    
    FastLineDarken()
    MAA()
    DeHalo_alpha()
    CSMod()
    Gradfun3()
    I'm not sure there'd be much difference upscaling to 720p rather than 1080p, as the main thing is cleaning up the noise and wobble. If 1080 is painfully slow, try 720p instead. Based in the previous cropping:

    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=988, fheight=720)
    or
    nnedi3_rpow2(2, cshift="Spline36Resize", fwidth=964, fheight=720)

    You could also try replacing CSMod with aWarpSharp2. It'll probably thin the lines a bit but it will likely be a lot faster, and you may prefer it. Something like:

    aWarpSharp2(Depth=5)

    PS I just noticed for the following line I used aWarpSharp2 and aWarpSharp. I don't think it makes any difference if you're using the aWarpSharpMT plugin, but I thought I'd mention it as it was a typo.

    MergeChroma(aWarpSharp2(Depth=7), aWarpSharp(Depth=20))
    Last edited by hello_hello; 10th Mar 2020 at 20:12.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!