VideoHelp Forum
+ Reply to Thread
Results 1 to 16 of 16
Thread
  1. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    I went to look at my old dvds and see that they have a color error
    It seems to me that it was a color pattern error from the VCR to the desktop dvd burner, but now I don't have the vhs tapes anymore, only the dvds.
    The color defect causes the left half of the image to turn green with stripes, especially when the color is red on the left side of the image.
    Is there a way to fix this with Avisynth?
    I transferred the dvd to mpg using Nero
    I'll give you the link to the 2 examples and mediainfo

    https://drive.google.com/drive/folders/1lifkZM6SqARq3xok0SL8ZHXUyJhT3zVY?usp=sharing

    Thank you
    Quote Quote  
  2. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hello, everyone
    Here are some sample videos and MediaInfos
    Image Attached Files
    Quote Quote  
  3. I'm not sure this will work with every shot but there's an improvement:

    before and after:
    Image
    [Attachment 81400 - Click to enlarge]


    Code:
    ######################################################
    
    function GreyRamp()
    {
       BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(last, last.RGBAdjust(rb=1, gb=1, bb=1))
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    ######################################################
    
    LWLibavVideoSource("Sample-01.mpg") 
    Bob(0.0, 1.0)
    
    Y = last
    U = ShowU()
    V = ShowV()
    
    ramp = GreyRamp().Crop(16,0,-16,-0).BilinearResize(U.width, U.height)
    desatU = U.ColorYUV(cont_y=-256)
    desatV = V.ColorYUV(cont_y=-256)
    
    U = Overlay(U, desatU, mask=ramp.FlipHorizontal)
    V = Overlay(V, desatV, mask=ramp)
    
    YtoUV(U, V, Y)
    Tweak(sat=2.0)
    MergeChroma(last, BilinearResize(width,64).Spline36Resize(width,height).aWarpSharp2(depth=30))
    
    Stackhorizontal(Y, last)
    Quote Quote  
  4. Astonishing result & script
    Quote Quote  
  5. Thanks. It's not perfect but it worked a little better than I expected it was going to. I'm not sure if it will work with other shots without some tuning. Applying a gamma curve to the mask might help too.
    Quote Quote  
  6. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    hi Jagabo
    Thank you very much for your reply
    You always save me from trouble in AviSynth
    I'm embarrassed to tell you, because I tried to make your script run but it gives this error below
    I updated LSMASHSource.dll to 2023/2/19
    Thank you


    Code:
    LoadPlugin("F:\Temp2\MaskTools2.dll")
    LoadPlugin("F:\Temp2\Depan.dll")
    LoadPlugin("F:\Temp2\DepanEstimate.dll")
    LoadPlugin("F:\Temp2\MVTools2.dll")
    LoadPlugin("F:\Temp2\LSMASHSource.dll")
    LoadPlugin("F:\Temp2\RgTools.dll")
    LoadPlugin("F:\Temp2\D2VSource.dll")
    LoadPlugin("F:\Temp2\MPEG2DecPlus64.dll")
    Import("F:\Temp2\Zs_RF_Shared.avsi")
    Import("F:\Temp2\LSFMod.avsi")
    Import("F:\Temp2\SetMTMode.avsi")
    Import("F:\Temp2\Stab.avsi")
    
    ######################################################
    
    function GreyRamp()
    {
       BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(last, last.RGBAdjust(rb=1, gb=1, bb=1))
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    ######################################################
    
    LWLibavVideoSource("D:Sample-01.mpg") 
    Bob(0.0, 1.0)
    
    Y = last
    U = ShowU()
    V = ShowV()
    
    ramp = GreyRamp().Crop(16,0,-16,-0).BilinearResize(U.width, U.height)
    desatU = U.ColorYUV(cont_y=-256)
    desatV = V.ColorYUV(cont_y=-256)
    
    U = Overlay(U, desatU, mask=ramp.FlipHorizontal)
    V = Overlay(V, desatV, mask=ramp)
    
    YtoUV(U, V, Y)
    Tweak(sat=2.0)
    MergeChroma(last, BilinearResize(width,64).Spline36Resize(width,height).aWarpSharp2(depth=30))
    
    Stackhorizontal(Y, last)
    Image Attached Images  
    Quote Quote  
  7. With some versions of AviSynth ShowU() and ShowV() return Y8. The version I'm using returns YV24. You can just coerce U and V to YV12 with ConvertToYV12().

    Code:
    U = ShowU().ConvertToYV12()
    V = ShowV().ConvertToYV12()
    Here's a version of the script (with the above change) that returns the original interlaced frames (with the color fix) rather than deinterlacing with bob():

    Code:
    ######################################################
    
    function GreyRamp()
    {
       BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(last, last.RGBAdjust(rb=1, gb=1, bb=1))
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    ######################################################
    
    LWLibavVideoSource("Sample-01.mpg") 
    SeparateFields()
    
    Y = last
    U = ShowU().ConvertToYV12()
    V = ShowV().ConvertToYV12()
    
    ramp = GreyRamp().Crop(16,0,-16,-0).BilinearResize(U.width, U.height)
    desatU = U.ColorYUV(cont_y=-256)
    desatV = V.ColorYUV(cont_y=-256)
    
    U = Overlay(U, desatU, mask=ramp.FlipHorizontal)
    V = Overlay(V, desatV, mask=ramp)
    
    YtoUV(U, V, Y.Spline36Resize(280,height).Spline36Resize(width,height))
    Tweak(sat=2.5)
    MergeChroma(last, BilinearResize(width,64).Spline36Resize(width,height).aWarpSharp2(depth=30))
    #BilinearResize(240, height).Spline36Resize(width,height)
    Weave()
    Quote Quote  
  8. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hi Jagabo
    That's very good, thank you very much
    Would you have a tip to make your script only change 50% of the left side of the video and leave the 50% of the right side unchanged?
    Because all the other dvd's have errors, only in 50% of the left side as in my example-02
    Thank you very much
    Image Attached Files
    Quote Quote  
  9. That an easy change. I'll probably have time to address it tomorrow.
    Quote Quote  
  10. It's hard to tell exactly what's going on with the colors in the second clip because of lack of colors at the left and right of the frame. But here's a modification of the earlier script that only process the left half:

    Code:
    LWLibavVideoSource("Sample-02.mpg", cache=false, prefer_hw=2) 
    src = last
    
    SeparateFields()
    
    Y = last
    U = ShowU().ConvertTOYV12()
    V = ShowV().ConvertTOYV12()
    
    ramp = GreyRamp().Crop(16,0,-16,-0).BilinearResize(U.width, U.height)
    desatU = U.ColorYUV(cont_y=-256)
    desatV = V.ColorYUV(cont_y=-256)
    
    U = Overlay(U, desatU, mask=ramp.FlipHorizontal)
    V = Overlay(V, desatV, mask=ramp)
    
    YtoUV(U, V, Y)
    Tweak(sat=2.0)
    Weave()
    
    Overlay(last, src.Crop(352,0,-0,0), x=352) # restore the right half of the frame
    Quote Quote  
  11. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hello Jagabo
    Thank you very much for helping me
    But I think I have your GreyRamp() function wrong
    In my test there was no change
    Can you check for me if it's right please?
    Thank you

    Code:
    ######################################################
    
    function GreyRamp()   #by jagabo
    {
       BlankClip(color=$000000, width=1, height=256, pixel_type="RGB32")
       StackHorizontal(last, last.RGBAdjust(rb=1, gb=1, bb=1))
       StackHorizontal(last, last.RGBAdjust(rb=2, gb=2, bb=2))
       StackHorizontal(last, last.RGBAdjust(rb=4, gb=4, bb=4))
       StackHorizontal(last, last.RGBAdjust(rb=8, gb=8, bb=8))
       StackHorizontal(last, last.RGBAdjust(rb=16, gb=16, bb=16))
       StackHorizontal(last, last.RGBAdjust(rb=32, gb=32, bb=32))
       StackHorizontal(last, last.RGBAdjust(rb=64, gb=64, bb=64))
       StackHorizontal(last, last.RGBAdjust(rb=128, gb=128, bb=128))
    }
    
    ######################################################
    Quote Quote  
  12. That GreyRamp() is fine. The effect on the girl's face is pretty subtle. Look in the lower left of the frame. The floor turns from purple to grey.
    Quote Quote  
  13. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hi Jagabo
    Thanks for your help
    But I remember seeing this same problem on the forum but I couldn't find it because it was 10 years ago.
    So I did a simulation with my devices and I had defects exactly like the one I'm having now
    Using a Panasonic NVHV60 vcr connected to the Panasonic DMR-ES10 desktop dvd recorder, all set to NTSC, it simulates this color error exactly the same as I have today.
    I don't know why it only works in normal colors when I set the color system on the recorder to Pal-m, then
    it works perfectly in NTSC
    I'll add Sample 3
    Thank you very much Jagabo for your great help
    Image Attached Files
    Quote Quote  
  14. I used the top of frame 3145 to come up with this, original on the left, fixed on the right:

    Image
    [Attachment 81872 - Click to enlarge]


    Code:
    LWLibavVideoSource("Sample 3.mp4", cache=false, prefer_hw=2) 
    
    ramp = GreyRamp().BilinearResize(width,height).ConvertToYV12(matrix="pc.601").ColorYUV(gamma_y=-100)
    h030 = Tweak(Hue=30)
    h320 = Tweak(Hue=320)
    
    Overlay(last, h030, mask=ramp.Invert())
    Overlay(last, h320, mask=ramp)
    It may still need some further tweaking of the colors but at least they're fairly consistent across the frame now.

    BTH, the script works pretty well for the earlier clips too.
    Image Attached Files
    Last edited by jagabo; 31st Aug 2024 at 12:14.
    Quote Quote  
  15. Member
    Join Date
    Sep 2014
    Location
    Italy
    Search PM
    Hi Jagabo
    Your script is so wonderful, it's like magic
    My videos turned out great
    Thank you very much
    Quote Quote  
  16. You're welcome. Glad to help out.
    Quote Quote  



Similar Threads

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