VideoHelp Forum
+ Reply to Thread
Results 1 to 9 of 9
Thread
  1. I'm not sure whats going on exactly, but when I use AddBorders(2,0,2,0) there's something annoying happening.

    The left 2 are always perfect, but the right 2 are bleeding over into a third row and kind of adding black over the chroma or something.

    Have a look at the images.

    Left = https://i.imgur.com/2m6841K.png

    Right = https://i.imgur.com/1J6uVb6.png


    Why is it doing this, and how can I keep it confined to only the two rows?
    Quote Quote  
  2. The only idea I could come up with was use boxfill to overlay the chroma on top of it since I have used that before to fix random overly bright stripes with help from Jagabo.
    https://forum.videohelp.com/threads/407770-Making-dull-colors-levels-look-brighter#post2674462

    I tried overlaying the chroma from before the borders were added using boxfill that was 1 row wide and placing it in the third row to cover up that bleed like thing I was talking about, but I couldn't figure out how to do it.

    Current script is

    Code:
    spline36resize(1916,1080)
    AddBorders(2,0,2,0,color=$000000)
    Last edited by killerteengohan; 5th Apr 2024 at 14:20.
    Quote Quote  
  3. Alternatively you may try to use 444 instead 420 (my assumption) so perhaps later in conversion back from 444 chroma will be averaged or brute force - repeat chroma value for black luma (it will be not visible as luma is black) but should replace "null chroma" (ie for today 16,128,128)
    Quote Quote  
  4. I even tried using an overlay of the image from before addborders was even used, and also tried to place it on top of a solid black background and it still has that black bleeding.

    Code:
    spline36resize(1916,1080)
    preborder = last
    AddBorders(2,0,2,0)
    overlay(last, preborder, 2, 0)
    Code:
    spline36resize(1916,1080)
    preborder = last
    AddBorders(2,0,2,0)
    ColorYUV(gain_y=-256, off_y=16, cont_u=-256, cont_v=-256)
    overlay(last, preborder, 2, 0)

    No matter what I try, as soon as I add black to the right side of the image, no matter the method so far, it does that bleeding thing to the left direction again.

    If I crop the 2 black bars from addborders back off of the right side, the bleeding effect is gone. Almost as if it doesn't really exist or something, but you can clearly see it when the black is there. It's really weird.


    It looks like any black bar is bleeding to the left for me no matter what. I placed a 2 pixel wide black bar over the middle of the video with BoxFill(1200, 0, 2, height, $000000) and the black bar was also slightly bleeding to the left 1 row of pixels.


    I rotated the image 180 degrees with turnleft().turnleft() and the bleeding effect is still only on the right side, yet before it was rotated, this side of the image was fine before when it was on the left.


    EDIT: I discovered 2 things.
    1. ChromaShifting to the right seems to get rid of it, but that shift throws everything else off and out of place.

    2. It doesn't even have to be black bars. Any color of added border does this.
    Last edited by killerteengohan; 5th Apr 2024 at 15:53.
    Quote Quote  
  5. It is probably related to chroma samples location in 420 undersampling scheme - TBH i'm too lazy to try and search for explanation - sorry - just try to do dirty hack and combine chroma planes shifted and not (last 2 pixels) (so probably add border, duplicate chroma plane, shift chroma, crop to 2 pixels, merge 2 shifted pixels croma with source).
    Quote Quote  
  6. Is it not luma that is causing the problem, not chroma?
    This works quite better, testing just adding 2pixels left and right to 1920x1080 source to get 1924x1080:
    Code:
    import vapoursynth as vs
    from vapoursynth import core
    from havsfunc import Overlay
    clip = core.lsmas.LibavSMASHSource( "F:/video.mp4")
    black = clip.std.BlankClip(width=1924, color=(16,128,128))
    mask = clip.std.BlankClip(color=(255,128,128))
    clip = Overlay(black, clip, x=2, mask=mask)
    clip.set_output()
    or more familiar:
    Code:
    LWLibavVideoSource("F:\video.mp4")
    black = BlankClip(last, width=1924)
    mask = BlankClip(last, color_yuv=$FFFFFF)
    Overlay(black, last, x=2, mask=mask)
    Last edited by _Al_; 5th Apr 2024 at 23:51.
    Quote Quote  
  7. ... or not, same result I got using with AddBorders, sorry. Video tested was _ChromaLocation: 0=left (mpeg)
    Quote Quote  
  8. Originally Posted by pandy View Post
    It is probably related to chroma samples location in 420 undersampling scheme - TBH i'm too lazy to try and search for explanation - sorry - just try to do dirty hack and combine chroma planes shifted and not (last 2 pixels) (so probably add border, duplicate chroma plane, shift chroma, crop to 2 pixels, merge 2 shifted pixels croma with source).
    I have heard and or read elsewhere on here in the past something about chroma will never perfectly line up for YV12 or something, so it makes a little sense now that you mention it.

    I would think though that if you put the original from before over top, that it would bleed into the black, and not the black into it since its supposed to be under it. That doesn't seem to be the case though. I guess its still seen as all in one instead of multiple different planes/layers.


    I could fix this more easily if I didn't have to resize to 1916x1080 first to fix stretched fat/wide looking aspect of the movie, as I have done it before with 1920x1080 movies.

    This is how I fixed 1920x1080.

    Code:
    preborder = last
    crop( 2, 0, -2, 0)
    AddBorders(2,0,2,0,color=$000000)
    MergeChroma(last, preborder) # Puts the original chroma back over everything, including the black borders
    crop( 0, 20, 0, -20)
    dark = smoothtweak(brightness=-255, saturation=0)
    mask = BlankClip(width=width, height=height, color=$000000).BoxFill(1919, 0, 2, height, $FFFFFF)
    Overlay(last, dark, mask=mask)
    mask = BlankClip(width=width, height=height, color=$000000).BoxFill(0, 0, 2, height, $FFFFFF)
    Overlay(last, dark, mask=mask)
    That fixed the bleeding black and had the original chroma covering the black bars which could then be covered with boxfill and made much less noticeable even though it was still there if you strain your eyes hard enough. Still it was so close to black you really wouldn't notice afterwards.

    I cant do this with the resized to 1916x1080 or the chroma over the entire image gets ruined.
    Quote Quote  
  9. I noticed that chroma sharpening MergeChroma(awarpsharp2(depth=6, blur=1, type=1)) had an effect on it as well, and while it was screwing up everything elses chroma, I wondered if another overlay after that would work. I tried again and wow that actually did it for me.

    Code:
    spline36resize(1916,1080)
    preborder = last
    AddBorders(2,0,2,0)
    MergeChroma(awarpsharp2(depth=6, blur=1, type=1))
    overlay(last, preborder, 2, 0)
    dark = smoothtweak(brightness=-255, saturation=0)
    mask = BlankClip(width=width, height=height, color=$000000).BoxFill(1919, 0, 2, height, $FFFFFF)
    Overlay(last, dark, mask=mask)
    mask = BlankClip(width=width, height=height, color=$000000).BoxFill(0, 0, 2, height, $FFFFFF)
    Overlay(last, dark, mask=mask)
    Last edited by killerteengohan; 6th Apr 2024 at 05:47.
    Quote Quote  



Similar Threads

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