Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
18th December 2022, 19:31 | #4763 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
I get totally different decimated output when using:
Code:
# Imports import vapoursynth as vs # getting Vapoursynth core core = vs.core # Loading Plugins core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll") core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/LSmashSource/vslsmashsource.dll") # source: 'C:\Users\Selur\Desktop\sample_from_DVD.mkv' # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine # Loading C:\Users\Selur\Desktop\sample_from_DVD.mkv using LWLibavSource clip = core.lsmas.LWLibavSource(source="C:/Users/Selur/Desktop/sample_from_DVD.mkv", format="YUV420P8", stream_index=0, cache=0, prefer_hw=0) # Setting color matrix to 470bg. clip = core.std.SetFrameProps(clip, _Matrix=5) clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5) clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5) # Setting color range to TV (limited) range. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1) # making sure frame rate is set to 29.97 clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001) clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # cropping the video to 704x480 clip = core.std.CropRel(clip=clip, left=6, right=10, top=0, bottom=0) # Deinterlacing using TIVTC clip = core.tivtc.TFM(clip=clip, mode=4) clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976 # make sure content is preceived as frame based clip = core.std.SetFieldBased(clip, 0) # adjusting output color from: YUV420P8 to YUV420P10 for x265Model clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited") # set output frame rate to 23.976fps clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001) # Output clip.set_output() Code:
# Imports import vapoursynth as vs # getting Vapoursynth core core = vs.core # Loading Plugins core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/DeinterlaceFilter/TIVTC/libtivtc.dll") core.std.LoadPlugin(path="i:/Hybrid/64bit/vsfilters/SourceFilter/DGDecNV/DGDecodeNV.dll") # source: 'C:\Users\Selur\Desktop\sample_from_DVD.mkv' # current color space: YUV420P8, bit depth: 8, resolution: 720x480, fps: 29.97, color matrix: 470bg, yuv luminance scale: limited, scanorder: telecine # Loading C:\Users\Selur\Desktop\sample_from_DVD.mkv using DGSource clip = core.dgdecodenv.DGSource("G:/Temp/mkv_6971e61a600461af6ca6ccf15732fb4f_853323747.dgi",fieldop=2) # Setting color matrix to 470bg. clip = core.std.SetFrameProps(clip, _Matrix=5) clip = clip if not core.text.FrameProps(clip,'_Transfer') else core.std.SetFrameProps(clip, _Transfer=5) clip = clip if not core.text.FrameProps(clip,'_Primaries') else core.std.SetFrameProps(clip, _Primaries=5) # Setting color range to TV (limited) range. clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1) # making sure frame rate is set to 29.97 clip = core.std.AssumeFPS(clip=clip, fpsnum=30000, fpsden=1001) clip = core.std.SetFrameProp(clip=clip, prop="_FieldBased", intval=0) # cropping the video to 704x480 clip = core.std.CropRel(clip=clip, left=6, right=10, top=0, bottom=0) # Deinterlacing using TIVTC clip = core.tivtc.TFM(clip=clip, mode=4) clip = core.tivtc.TDecimate(clip=clip)# new fps: 23.976 # make sure content is preceived as frame based clip = core.std.SetFieldBased(clip, 0) # adjusting output color from: YUV420P8 to YUV420P10 for x265Model clip = core.resize.Bicubic(clip=clip, format=vs.YUV420P10, range_s="limited") # set output frame rate to 23.976fps clip = core.std.AssumeFPS(clip=clip, fpsnum=24000, fpsden=1001) # Output clip.set_output() With dgdecodenv.DGSource I get wrong decimation hits. In Avisynth I would use "clip = clip.PreRoll(Int(clip.FrameRate())" to handle this, but what to do in Vapoursynth? I encountered this with the source from https://forum.videohelp.com/threads/...erlace-dilemma Okay, scratch that, using PreRoll in Avisynth doesn't help either, only switching away from DGDecNV. The question whether there is an alternative to PreRoll still remains. Cu Selur Last edited by Selur; 18th December 2022 at 19:36. |
19th December 2022, 04:38 | #4764 | Link |
Registered User
Join Date: Sep 2007
Posts: 5,377
|
I get similar results between avs and vpy versions of simple TIVTC script using DGSource (frames match up, but not bit identical, I think libtivtc might be taking a slightly different field on some matches, but still resulting in the same frame visually)
|
20th December 2022, 21:49 | #4766 | Link | ||
Registered User
Join Date: Sep 2007
Posts: 5,377
|
Quote:
Quote:
|
||
5th January 2023, 15:53 | #4767 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Issue was resolved over at: https://www.rationalqm.us/board/view...php?f=8&t=1220
It was my mistake, I misunderstood how fieldop in DGSource source worked. Instead of fieldop=2, I should have used fieldop=0. :/ (so not a bug in DGDecNV, but in my mind ) Cu Selur Last edited by Selur; 5th January 2023 at 15:55. |
9th January 2023, 23:13 | #4768 | Link |
Registered User
Join Date: May 2011
Posts: 321
|
About _ColorRange prop,
I have to specify it this way: RANGE = {0:'limited', 1:'full'}, I checked Zimg and it has it the same way. But manual has it backwards, http://www.vapoursynth.com/doc/apire...ame-properties Could it be fixed in that documentation? |
10th January 2023, 01:18 | #4769 | Link | |
Registered User
Join Date: Dec 2020
Posts: 88
|
Quote:
Frame prop and zimg arg are different things. 1 is limited in _ColorRange prop and full in zimg arg. |
|
10th January 2023, 19:28 | #4770 | Link |
Registered User
Join Date: May 2011
Posts: 321
|
I have to define range and matrix using strings, otherwise things are off:
Code:
print(vs.__api_version__) clip = core.lsmas.LibavSMASHSource('YUV.mp4') rgb1 = clip.resize.Bicubic(format=vs.RGB24, matrix_in_s='709', range_in_s='full') rgb2 = clip.resize.Bicubic(format=vs.RGB24, matrix_in_s='709', range_in=0) and rgb1 and rgb2 are not the same, is it an old bug? I do not have portable tkinter in portable API4 right now to quick check Oh, I get it now, it is swapped, so if wanting to set 'limited' in props, we have to use: Code:
API3: clip = clip.std.SetFrameProp(prop='_ColorRange', intval=1) API4: clip = clip.std.SetFrameProps(_ColorRange=1) Code:
rgb = clip.resize.Bicubic(format=vs.RGB24, matrix_in_s='709', range_in=0) Last edited by _Al_; 11th January 2023 at 03:57. |
15th January 2023, 08:55 | #4771 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Trying to port CQTGMC to Vapoursynth, I started with:
Code:
def CQTGMC(clip: vs.VideoNode, Sharpness: float=0.25, thSAD1: int=192, thSAD2: int=320, thSAD3: int=128, thSAD4: int=320) -> vs.VideoNode: flip = core.std.FlipHorizontal(clip) flip = Padding(clip=clip,top=clip.width%64) flip = Padding(clip=clip,right=clip.height%64) padded = core.std.StackHorizontal([clip,flip]) # todo: optional use nnedi3CL bobbed = core.znedi3.nnedi3(clip=padded, field=2) denoised = core.rgvs.RemoveGrain(clip=bobbed,mode=12) denoised = core.fmtc.resample(clip=denoised, kernel="gauss", w=denoised.width, h=denoised.height, scaleh=denoised.width+0.0001, interlaced=False, interlacedd=False) denoised = core.resize.Bicubic(clip=denoised, format=bobbed.format, dither_type="error_diffusion") # adjust format after fmtc denoised = core.std.Merge(clipa=denoised, clipb=bobbed,weight=0.25) srchClip = denoised csuper = core.mv.Super(clip=denoised); bvec = core.mv.Analyse(csuper,isb=True,blksize=64,overlap=32) fvec = core.mv.Analyse(csuper,isb=False,blksize=64,overlap=32) Comp1 = core.mv.Compensate(denoised,csuper,bvec,thsad=thSAD2) Comp2 = core.mv.Compensate(denoised,csuper,fvec,thsad=thSAD2) denoised = core.std.Interleave([Comp1,denoised,Comp2]) csuper = core.vs.Super(clip=denoised) bvec = core.mv.Analyse(csuper,isb=True,blksize=64,overlap=32) fvec = core.Analyse(csuper,isb=False,blksize=64,overlap=32) Inter = core.mv.FlowInter(csuper,bvec,fvec,blend=False) # global CQTGMC_A = Inter.SelectEvery(3,0) # global CQTGMC_B = Inter.SelectEvery(3,1) # srchClip # ScriptClip(""" # P = YDifferenceFromPrevious() # N = Trim(1,0).YDifferenceFromPrevious() # N < P ? CQTGMC_A : CQTGMC_B # """) # super = MSuper() # bVec1 = MAnalyse(super,isb=true,overlap=4,delta=1) # fVec1 = MAnalyse(super,isb=false,overlap=4,delta=1) # bobbed # super = MSuper(levels=1) # bComp1 = MCompensate(super,bVec1,thSAD=thSAD3) # fComp1 = MCompensate(super,fVec1,thSAD=thSAD3) # Interleave(\ # SeparateFields(bobbed).SelectEvery(4,0),\ # SeparateFields(fComp1).SelectEvery(4,1),\ # SeparateFields(bComp1).SelectEvery(4,2),\ # SeparateFields(bobbed).SelectEvery(4,3)) # Weave() # # super = MSuper(levels=1) # bComp1 = MCompensate(super, bVec1,thSAD=thSAD4) # fComp1 = MCompensate(super, fVec1,thSAD=thSAD4) # tMax = mt_logic(fComp1,"max",U=3,V=3).mt_logic(bComp1,"max",U=3,V=3) # tMin = mt_logic(fComp1,"min",U=3,V=3).mt_logic(bComp1,"min",U=3,V=3) # MDegrain1(super,bVec1,fVec1,thSAD=thSAD1) # sharpen = mt_adddiff(mt_makediff(Removegrain(20),u=3,v=3),u=3,v=3) # mt_clamp(sharpen,tMax,tMin,Sharpness,Sharpness,3,3,3) # super = MSuper(levels=1) # MDegrain1(super,bVec1,fVec1,thSAD=thSAD1) # Crop(0,0,-(input.width()%64),-(input.height()%64)) # return last # from havsfunc def Padding(clip: vs.VideoNode, left: int = 0, right: int = 0, top: int = 0, bottom: int = 0) -> vs.VideoNode: if not isinstance(clip, vs.VideoNode): raise vs.Error('Padding: this is not a clip') if left < 0 or right < 0 or top < 0 or bottom < 0: raise vs.Error('Padding: border size to pad must not be negative') width = clip.width + left + right height = clip.height + top + bottom return clip.resize.Point(width, height, src_left=-left, src_top=-top, src_width=width, src_height=height) Can someone tell me how to convert this part: Code:
global CQTGMC_A = Inter.SelectEvery(3,0) global CQTGMC_B = Inter.SelectEvery(3,1) srchClip ScriptClip(""" P = YDifferenceFromPrevious() N = Trim(1,0).YDifferenceFromPrevious() N < P ? CQTGMC_A : CQTGMC_B """) Thanks! Cu Selur |
15th January 2023, 12:03 | #4775 | Link |
Registered User
Join Date: Oct 2001
Location: Germany
Posts: 7,277
|
Okay. Thanks
Opened a separate thread for the porting. https://forum.doom9.org/showthread.php?p=1981140 Cu Selur |
30th January 2023, 22:47 | #4776 | Link |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
I've been trying to use fvf insertsign to overlay a lagarith .avi with alpha on top of my video. however, it does not work.
how can i specify it right so that it takes the alpha channel properly? I used the same files with avs and it worked... i think i am missing something related to telling vs about the alpha channel? the logo appears but without being overlayed properly Last edited by ~ VEGETA ~; 30th January 2023 at 23:47. |
31st January 2023, 00:05 | #4777 | Link |
Registered User
Join Date: May 2011
Posts: 321
|
havsfunc could be used:
import havsfunc clip=havsfunc.Overlay(clip1,clip2,mask=alpha) https://github.com/HomeOfVapourSynth...sfunc.py#L5960 |
31st January 2023, 02:31 | #4778 | Link | |
Registered User
Join Date: Dec 2020
Posts: 88
|
Quote:
|
|
31st January 2023, 15:46 | #4779 | Link | |
The cult of personality
Join Date: May 2013
Location: Planet Vegeta
Posts: 155
|
Quote:
also, it does not have options to specify ranges. also: video1= lvf.misc.overlay_sign(clip=video1,overlay=fixed_logo,frame_ranges=[8508,8655]) didn't work and put this: https://pastebin.com/GSZRYLqi first it didn't accept 2 colorspaces as alpha clip in RGBA, so I did: Code:
video1= lsmash... fixed_logo = core.ffms2.Source(source=path..., alpha=True) fixed_logo = core.resize.Bilinear(fixed_logo, format=vs.YUV420P8, matrix_s="709") video1= lvf.misc.overlay_sign(clip=video1,overlay=fixed_logo,frame_ranges=[8508,8655]) On insertsign side, I still cannot use it even after modifying it with the mentioned commit manually in scripts folder. |
|
Tags |
speed, vaporware, vapoursynth |
|
|