VideoHelp Forum
+ Reply to Thread
Results 1 to 5 of 5
Thread
  1. RGBColor - A VapourSynth function for specifying color

    Even though the default color is "black" for VapourSynth's AddBorders & BlankClip functions, the added borders are always full range (for 8 bit video the black level is 0 rather than 16 as it should be for limited range video). The RGBColor function will ensure the black level is correct. YUV and RGB are both supported at any bitdepth (except for half float).

    RGBColor 2024-10-02.zip

    import vapoursynth as vs
    core = vs.core
    import RGBColor as rgb

    Specifying a border color for the AddBorders function

    Adding black borders

    clip = core.ffms2.Source("Video.mkv")
    clip = core.std.AddBorders(clip, 20,20,0,0, color=rgb.RGBColor(clip))

    Adding dark blue borders

    clip = core.ffms2.Source("Video.mkv")
    clip = core.std.AddBorders(clip, 20,20,0,0, color=rgb.RGBColor(clip, color="darkblue"))

    Specifying the color of a blank clip with the same properties as a previous clip

    A blank clip with black frames

    clip = core.ffms2.Source("Video.mkv")
    BClip = core.std.BlankClip(clip, color=rgb.RGBColor(clip))

    A blank clip with red frames

    clip = core.ffms2.Source("Video.mkv")
    BClip = core.std.BlankClip(clip, color=rgb.RGBColor(clip, color="red"))

    Specifying the color of a blank clip when no previous clip exists

    A blank clip with black frames

    BClip = core.std.BlankClip(format=vs.YUV420P8)
    BClip = core.std.BlankClip(BClip, color=rgb.RGBColor(BClip))

    A blank clip with red frames

    BClip = core.std.BlankClip(format=vs.YUV420P8)
    BClip = core.std.BlankClip(BClip, color=rgb.RGBColor(BClip, color="red"))
    Last edited by hello_hello; 2nd Oct 2024 at 09:42.
    Quote Quote  
  2. Is it compatible to the version from last year? (so can I replace the old version or so I need to adjust scripts where I used the old version?)
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  3. Yes it's compatible. The main difference is this version specifies the color range correctly when determining the color.

    I hadn't realised the VapourSynth frame property uses 0 for full range and 1 for limited, while the resizers use 0 for limited and 1 for full, so this version takes any specified "range", or the _ColorRange value in frame properties, and converts it to a string.

    The ColorClip line near the end now uses
    resize.Point(range_s="limited")
    instead of
    resize.Point(range=1)
    which would have meant it was specifying a full range value for limited range video.

    The original version required the user to specify a color. This version defaults to "black".
    And for some reason the original didn't include "lightgray" as a color, only "lightgrey". It should've included both (as the same color).
    Last edited by hello_hello; 2nd Oct 2024 at 11:48.
    Quote Quote  
  4. Thanks for the info.
    users currently on my ignore list: deadrats, Stears555
    Quote Quote  
  5. Member
    Join Date
    Aug 2018
    Location
    Wrocław
    Search PM
    Originally Posted by hello_hello View Post
    I hadn't realised the VapourSynth frame property uses 0 for full range and 1 for limited
    Avisynth too.
    Quote Quote  



Similar Threads

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