VideoHelp Forum
+ Reply to Thread
Results 1 to 26 of 26
Thread
  1. Hi everybody,

    I live France (hooray to Secam stupidity!)
    I use a JVC HR-S9850 with ADVC110. Software : Virtualdub

    Main problem with Secam is the red/purple mark on the right of tape.
    Commercial vhs or tv recording, same problem.

    JFK documentary (Secam)

    How can I "delete" that ? I don't know how to use avisynth.
    There's a way to do it with a filter on Virtualdub ?

    Thank you all
    Quote Quote  
  2. There is also color moments in the film.
    If it was an entire black&white documentary, I will not ask the question and disturb
    Quote Quote  
  3. You should have pointed that out in the first post. I'm not aware of anything in VirtualDub that will fix that problem. Long ago I wrote an AviSynth function that duplicates colors near the edge to cover the discoloration. It's in these forums somewhere.

    Found it: https://forum.videohelp.com/threads/354425-Hi8-capture-using-Digital8-camcorder-Edge-c...ge#post2227582
    Quote Quote  
  4. Oh, thanks ! Now I need to learn about avisynth.
    Quote Quote  
  5. I'm sorry to bother you, what is the exactly code I need to put in the script ?
    Can you adapt it with the picture I showed here ? Thank you a lot

    Code:
    AVISource("jfk05.avi") 
    ConvertToYUY2(interlaced=true)
    
    U = UtoY() # separate U channel
    V = VtoY() # seprate V channel
    
    V = Crop(V,0,0,-16,-0) #remove discolore portion and black border
    extra=FlipHorizontal(V).Crop(0,0,12,-0) # the last 12 pixels of the V channel reflected
    V=StackHorizontal(V,extra).AddBorders(0,0,4,0,$808080) # add the extra, pad to 720 with grey
    
    YtoUV(U, V, last) # mix the separate U and V with the original Y
    Quote Quote  
  6. Upload a color frame that has the same problem. Even better, a short video clip. If your video is DV AVI you can use VirtualDub in Direct Stream Copy mode to trim out a short sample with no reencoding.

    Using your sample image and a minor adjustment:

    Code:
    ImageSource("jfk.png", start=0, end=23, fps=23.976) 
    ConvertToYUY2(interlaced=true)
    
    U = UtoY() # separate U channel
    V = VtoY() # seprate V channel
    
    V = Crop(V,0,0,-24,-0) #remove discolore portion and black border
    extra=FlipHorizontal(V).Crop(0,0,16,-0) # the last 20 pixels of the V channel reflected
    V=StackHorizontal(V,extra).AddBorders(0,0,8,0,$808080) # add the extra, pad to 720 with grey
    
    YtoUV(U, V, last) # mix the separate U and V with the original Y
    Click image for larger version

Name:	fixed.jpg
Views:	163
Size:	42.2 KB
ID:	43551
    Last edited by jagabo; 30th Oct 2017 at 19:31.
    Quote Quote  
  7. https://youtu.be/yGmjpqP-UaU
    (direct link to the video : https://we.tl/gEyWeBTqls)

    I want to understand the code. To re-use it later with other videos. Not just this one.
    How can I change the width of the filter ? Which line ?
    Last edited by TONYFRANCE; 30th Oct 2017 at 20:40.
    Quote Quote  
  8. I tried, like a blind guy to change two things : V=Crop and extra

    Code:
    AVISource("jfk05.avi") 
    ConvertToYUY2(interlaced=true)
    
    U = UtoY() # separate U channel
    V = VtoY() # seprate V channel
    
    V = Crop(V,0,0,-24,-0) #remove discolore portion and black border
    extra=FlipHorizontal(V).Crop(0,0,20,-0) # the last 12 pixels of the V channel reflected
    V=StackHorizontal(V,extra).AddBorders(0,0,4,0,$808080) # add the extra, pad to 720 with grey
    
    YtoUV(U, V, last) # mix the separate U and V with the original Y
    With your code :
    Before
    Mine :
    After

    First problem of the filter, how can you deal when there's a red element on the right ?
    See, the grey area is visible. Can we reduce it or make it invisible ?
    Last edited by TONYFRANCE; 30th Oct 2017 at 20:35.
    Quote Quote  
  9. One thing you should know about AviSynth: when you don't specify a clip by name the name "last" is used instead. So "AviSource("filename.avi")" is equivalent to "last = AviSource("filename.avi")". And many functions take an input clip and produce and output clip: "ColorYUV(cont_y=400)" is the same as "last = ColorYUV(last, cont_y=400)". And for our purposes here, the input video can be piped the the filter like "last = cropped.FlipHorizontal()" or specified within the filter with "last = FlipHorizontal(cropped)".

    There's not a lot of color in that clip so I'm going to crank up the saturation to make it more visible.

    Frame 1935:
    Click image for larger version

Name:	orig.jpg
Views:	181
Size:	63.6 KB
ID:	43554

    Looking at the Y, U, and V channels separately (all as greyscale):
    Click image for larger version

Name:	yuv.jpg
Views:	197
Size:	77.7 KB
ID:	43555

    PAL DVD use 4:2:0 chroma subsampling so the U and V channels are half the width and height of the Y channel. You can see that the Y channel doesn't have a problem at the right edge, the U channel has a minor rise, and the V channel has a major rise. To make this simpler we'll fix both U and V.

    Click image for larger version

Name:	fixed.jpg
Views:	173
Size:	63.6 KB
ID:	43556

    The AviSynth script:

    Code:
    # the width of the discolored right edge -- in Y pixels
    EDGE_SIZE = 48
    
    AviSource("jfk05.avi") 
    
    ColorYUV(cont_u=400, cont_v=400) # bump up saturation, about 2.5x
    
    cropped = Crop(0,0,-EDGE_SIZE,-0)
    extra = cropped.FlipHorizontal().Crop(0,0,EDGE_SIZE,-0)
    chroma = StackHorizontal(cropped, extra)
    MergeChroma(last, chroma)
    First we define a constant called EDGE_SIZE that's the width of the discolored portion of the frmae -- 48 pixels of the 720 pixel wide image. Then we load the video with AVISource(). We cut EDGE_SIZE pixels off the right edge of the frame. We now have a video called "cropped" that has the discolored portion removed. We flip that video horizontally (mirror image) and then crop an EDGE_SIZE strip from the left edge, callled "extra" -- this is a mirror image of the right edge of "cropped". We add "extra" to the right edge of "cropped", restoring the original 720 pixels, and call it chroma. We only want to take the colors from this new video, so we merge the colors of the new video with the luma of the original video.

    This works well for this particular shot but will have problems with other shots. For example in this shot:

    Click image for larger version

Name:	bad.jpg
Views:	189
Size:	40.1 KB
ID:	43558

    It looks like there are more red flowers at the right edge of the frame.
    Last edited by jagabo; 30th Oct 2017 at 20:48.
    Quote Quote  
  10. Thank you so much for all the detail about it.
    The new version of the filter is better. Blue tint is gone. Great improvement.

    I don't see a problem for 2/3 seconds (like the flower shot).
    It's not something you see when your soul is in the film, right ?

    Bef/Aft comparision :
    https://files.videohelp.com/u/272945/bef3.png
    https://files.videohelp.com/u/272945/after3.png
    Quote Quote  
  11. It's certainly less noticeable than the original grossly discolored edge.
    Quote Quote  
  12. Thank you for your time and your speed
    Quote Quote  
  13. Member
    Join Date
    Aug 2010
    Location
    San Francisco, California
    Search PM
    Originally Posted by jagabo View Post
    PAL DVD use 4:2:0 chroma subsampling so the U and V channels are half the width and height of the Y channel. You can see that the Y channel doesn't have a problem at the right edge, the U channel has a minor rise, and the V channel has a major rise. To make this simpler we'll fix both U and V.
    Instead of replacement, could you reduce the intensity of the U and especially V channels just in that area?
    Quote Quote  
  14. Originally Posted by JVRaines View Post
    Originally Posted by jagabo View Post
    PAL DVD use 4:2:0 chroma subsampling so the U and V channels are half the width and height of the Y channel. You can see that the Y channel doesn't have a problem at the right edge, the U channel has a minor rise, and the V channel has a major rise. To make this simpler we'll fix both U and V.
    Instead of replacement, could you reduce the intensity of the U and especially V channels just in that area?
    I thought about that but there weren't enough colors at the edge of the video to tell if it was working properly. I was afraid it would just reduce the video to greyscale in that area. Maybe I'll try it anyway and see what happens.
    Quote Quote  
  15. It was pretty easy to subtract the purple strip at the edge. But for the most part, the purple strip isn't added to the existing color, it replaced the existing color. So subtracting it leaves the edge greyscale. But that's still better than purple. And in some cases better than the reflected colors.

    The clip starts out with a b/w clip so I averaged the first 8 frames together (noise reduction) to get the bad chroma. I also set the luma to zero so it wouldn't effect the cleaned clip.

    Code:
    Function GetBadChroma(clip c)
    {
        c
        Merge(SelectEven(), SelectOdd())
        Merge(SelectEven(), SelectOdd())
        Merge(SelectEven(), SelectOdd())
        Trim(0,length=1)
        ColorYUV(off_y=-255, off_u=5, off_v=1) # all Y to superblack, minor U and V white balance
    }
    
    AviSource("jfk05.avi") 
    ColorYUV(cont_u=400, cont_v=400) # bump up saturation, about 2.5x
    
    BadChroma = GetBadChroma()
    Overlay(last, BadChroma, mode="subtract")
    Click image for larger version

Name:	subtract.jpg
Views:	165
Size:	63.7 KB
ID:	43575

    A few places had a little real color at the edge of the frame after this. Overall I'd probably use this for the clip.
    Last edited by jagabo; 1st Nov 2017 at 07:25.
    Quote Quote  
  16. jagabo,

    That is really good stuff. Well done!
    Quote Quote  
  17. Thanks. It took me a while to figure out how to subtract the purple bar but it turned out to be very simple.
    Quote Quote  
  18. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Yes, jagabo, good job indeed.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  
  19. I used that code

    Code:
    Function GetBadChroma(clip c)
    {
        c
        Merge(SelectEven(), SelectOdd())
        Merge(SelectEven(), SelectOdd())
        Merge(SelectEven(), SelectOdd())
        Trim(0,length=1)
    }
    
    AviSource("file.avi") 
    
    BadChroma = GetBadChroma()
    Overlay(last, BadChroma, mode="subtract")
    What happened ?
    Looks like it kept the shadow from the first frame ?

    EDIT : I created a new avs file, and everything is ok !
    Image Attached Thumbnails Click image for larger version

Name:	rabid.png
Views:	142
Size:	386.2 KB
ID:	45154  

    Last edited by TONYFRANCE; 12th Apr 2018 at 05:02.
    Quote Quote  
  20. How can I use a filter, just on the right ?
    Can I use NeatVideo or another filter on a specific area ?

    The film itself is pretty dark... that's why it's not perfect, I don't see that problem when it's daylight.
    Image Attached Thumbnails Click image for larger version

Name:	rabid2.png
Views:	133
Size:	627.6 KB
ID:	45156  

    Quote Quote  
  21. One way is to create two different videos, one filtered, the other not, then crop and stack them:

    Code:
    source = ImageSource("rabid2.png").ConvertToYV12()
    
    STRIP_WIDTH = 44
    filtered = source.GreyScale()
    
    StackHorizontal(source.Crop(0,0,-STRIP_WIDTH,-0), filtered.Crop(filtered.width-STRIP_WIDTH,0,-0,-0))
    Depending on the filters used, that may leave a sharp demarcation between the original and filtered part of the frame. To get smoother blending you can overlay with an alpha mask instead of cropping and stacking. There are many ways of building a mask. Complex shapes can be created in an image editor and imported into AviSynth. But since we're dealing with a rectangular area we can build the mask in AviSynth:

    Code:
    source = ImageSource("rabid2.png").ConvertToYV12()
    
    STRIP_WIDTH = 44
    filtered = source.GreyScale()
    
    blackmask = source.ColorYUV(off_y=-256).Crop(0,0,-STRIP_WIDTH,-0) # make a black video
    whitemask = source.ColorYUV(off_y=256).Crop(source.width-STRIP_WIDTH,0,-0,-0) # make a white video
    fullmask = StackHorizontal(blackmask, whitemask) # stack them to make mask that's the full width of the source video
    fullmask = fullmask.BilinearResize(source.width/4, source.height).BilinearResize(source.width, source.height) # blur the boundary between black and white
    
    Overlay(source, filtered, mask=fullmask)
    Quote Quote  
  22. Both the original problem from last fall, as well as this new problem, would be a lot easier to fix in Vegas. Other NLEs may also have this feature. In Vegas, you use the Secondary Color Corrector. It lets you choose any color, or range of colors. You can then further modify your selection by the saturation and brightness. Finally, you can add a mask, so the correction only gets applied to the right edge of your video.

    Once you've made your selection, you can desaturate it (i.e., turn it to B&W) or you can apply the opposing color which is another way to remove a color.

    I do this all the time and it is very useful for captures of VHS camcorder tapes that were taken with the wrong color balance. I first do a color correction using standard color wheel techniques, but after those have been applied, there are often residual color casts on neutral-colored objects. The most recent was a wedding where the first dance had been filmed with outdoor lighting settings. I re-balanced the shot, and faces look much closer, but the bride's dress had a residual blue. I selected that and was able to get it pretty pure white. As she danced, the color correction "tracked" (there is no actual tracking, of course), and it came out near-perfect.

    Years ago I posted in another forum about how to do the opposite: punch up just a selected color. Here is the before pic:



    and here is the "after" pic where I bumped up the saturation for the sky and stop sign, but left everything else the same. Remember, this is a still from a video clip, and the adjustments, once made, were automatically applied to all frames in the clip.

    Last edited by johnmeyer; 12th Apr 2018 at 10:54.
    Quote Quote  
  23. xxx
    Last edited by TONYFRANCE; 21st Jul 2018 at 06:50.
    Quote Quote  
  24. xxx
    Last edited by TONYFRANCE; 21st Jul 2018 at 06:50.
    Quote Quote  
  25. Video Restorer lordsmurf's Avatar
    Join Date
    Jun 2003
    Location
    dFAQ.us/lordsmurf
    Search Comp PM
    Originally Posted by johnmeyer View Post
    and here is the "after" pic
    That looks really unnatural.
    Want my help? Ask here! (not via PM!)
    FAQs: Best Blank DiscsBest TBCsBest VCRs for captureRestore VHS
    Quote Quote  



Similar Threads

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