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"))
Try StreamFab Downloader and download from Netflix, Amazon, Youtube! Or Try DVDFab and copy Blu-rays!
+ Reply to Thread
Results 1 to 6 of 6
Thread
-
Last edited by hello_hello; 2nd Oct 2024 at 09:42.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
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 -
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.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview) -
Thanks for the info.
users currently on my ignore list: deadrats, Stears555 -
It wasn't that I'd mixed up the value in frame properties, but I'd either forgotten or never knew that the VapourSynth resizers do it backwards.
Something like the following will cause VapourSynth to write a value of 1 for _ColorRange in frame properties because 0 is limited range for the resizers, while 1 is limited range in frame properties.
clip = core.resize.Spline36(clip, 640,480, range=0)
The safest way to do it for the resizers, especially if you want to change the range, is to use a string rather than 0 or 1, at least for me because I'm easily confused.
clip = core.resize.Spline36(clip, 640,480, range_in_s="full", range_s="limited")Last edited by hello_hello; 3rd Oct 2024 at 20:14.
Avisynth functions Resize8 Mod - Audio Speed/Meter/Wave - FixBlend.zip - Position.zip
Avisynth/VapourSynth functions CropResize - FrostyBorders - CPreview (Cropping Preview)
Similar Threads
-
VapourSynth function to detect and remove variable PAR/Pillarboxing
By PRAGMA in forum ProgrammingReplies: 1Last Post: 11th Apr 2023, 07:53 -
Installing vapoursynth
By rrats in forum Newbie / General discussionsReplies: 3Last Post: 30th Sep 2021, 16:35 -
LUTs for color adjustments in Vapoursynth and Avisynth?
By Selur in forum Newbie / General discussionsReplies: 1Last Post: 28th May 2021, 16:17 -
vapoursynth errors
By IAAMM in forum Newbie / General discussionsReplies: 7Last Post: 29th Mar 2021, 10:14 -
Vapoursynth error
By plshelpvapoursynth in forum Newbie / General discussionsReplies: 9Last Post: 23rd Aug 2020, 23:19