FBB,
Some Comments flagged by ssS:
Code:
Function VideoTek(clip clp) {
clp
nChannels=(HasAudio)?AudioChannels:0 # HasAudio = audio_samples_per_second!=0
#Errors checking
Assert(IsPlanar && IsYUV, "VideoTek: source must be planar YUV") # ssS: IsPlanar simpler than IsYV12 etc
Assert(nChannels<9,"VideoTek: sources with more than 8 audio channels are not supported")
#Getting info
#Resolution
x=clp.Width()
y=clp.Height()
#Framerate
fps=clp.FrameRate() # ssS: Not FrameRateNumerator (check Src with eg Assumefps(30000,1001)
#ColorSpace
colorspace=clp.PixelType()
#Taking care of High bit Depth
Bpc = clp.BitsPerComponent
clp.ConvertBits(bits=8) # ssS: If already 8 bits then ConvertBits should do nothing anyway (return original)
# ...
See SendSpace below sig for Avs (not avsi, remove my comments and test code, and rename to avsi).
Appended testcode after your script, in the avs
Code:
AviSource("d:\Parade.avi")
Assumefps(30000,1001) # Test FrameRate
# UnComment ONLY ONE of below
#ConvertToRGB32 # RGB32
#ConvertToRGB24 # RGB24
#ConvertToYUY2 # YUY2
#ConvertToYV12 # YV12
# v2.60 +
#ConvertToYV411 # YV411
#ConvertToYV16 # YV16
#ConvertToYV24 # YV24
#ConvertToY8 # Y8
# Avs+
#ConvertToRGB48 # RGB48 Intereleaved RGB 16 bit
#ConvertToRGB64 # RGB64 Intereleaved RGBA 16 bit
# ... + Loads more
# 32 Bit Float
#ConvertToRGB48.ConvertToPlanarRGB.ConvertBits(32) # RGBPS
#ConvertToRGB64.ConvertToPlanarRGBA.ConvertBits(32) # RGBAPS
#ConvertToY8.ConvertBits(32) # Y32
#ConvertToYV12.ConvertBits(32) # YUV420PS
#ConvertToYV16.ConvertBits(32) # YUV422PS
#ConvertToYV24.ConvertBits(32) # YUV444PS
#ConvertToYV12.ConvertBits(32).AddAlphaPlane # YUVA420PS
#ConvertToYV16.ConvertBits(32).AddAlphaPlane # YUVA422PS
ConvertToYV24.ConvertBits(32).AddAlphaPlane # YUVA444PS
###################
Videotek
EDIT: Fix your avsi script and I'll remove this post.
EDIT:
More mods, posted on SendSpace. [also, removed references to clp after initializing Last].
Code:
Function VideoTek(clip clp) {
clp
nChannels=(HasAudio)?AudioChannels:0 # HasAudio = audio_samples_per_second!=0
#Errors checking # ssS: Might as well do at beginning (after errchk, known Planar YUV & < 9 channels)
# Assert(IsPlanar && IsYUV, "VideoTek: source must be planar YUV") # ssS: IsPlanar simpler than IsYV12 etc
Assert(nChannels<9,"VideoTek: sources with more than 8 audio channels are not supported")
#Getting info
#Resolution
x=Width()
y=Height()
#Framerate
fps=FrameRate() # ssS: Not FrameRateNumerator (check Src with eg Assumefps(30000,1001)
#ColorSpace
colorspace=PixelType()
#Taking care of High bit Depth
Bpc = BitsPerComponent
# ConvertBits(bits=8) # ssS: If already 8 bits then ConvertBits should do nothing anyway (return original)
ConvertToYUV444.ConvertBits(bits=8) # ssS: Convert To YV444, 8 bit, support all colorspace input
# ...
Supports ALL input colorspace, not just Planar YUV. [Only tested with YUY2, RGB64, RGBPS + a few more, but all should work]
EDIT: Fixed Error in either Avs+ or VD2.
Bug report here in devs forum:-
https://forum.doom9.org/showthread.p...58#post1927858
fix [Updated script on SendSpace]
Code:
Function VideoTek(clip clp) {
clp
nChannels=(HasAudio)?AudioChannels:0 # HasAudio = audio_samples_per_second!=0
#Errors checking
Assert(nChannels<9,"VideoTek: sources with more than 8 audio channels are not supported")
#Getting info
#Resolution
x=Width()
y=Height()
#Framerate
fps=FrameRate()
#ColorSpace
colorspace=PixelType()
#Taking care of High bit Depth
Bpc = BitsPerComponent
ConvertToYUV444
(HasAlpha) ? RemoveAlphaPlane : NOP # ssS: Avoid eg YUVA444 error in VirtualDub2 (OK in PotPlayer but grey screen in VD2 if YUVA)
ConvertBits(bits=8) # ssS: Convert To YUV444, 8 bit, NO ALPHA, support all colorspace input
# ...