Log in

View Full Version : Need some help with a Vapoursynth script


gonca
23rd June 2019, 18:53
When using an avisynth script for my encode all works
LoadPlugin("C:/Program Files (Portable)/dgdecnv/DGDecodeNV.dll")
DGSource("I:\xxxxx.dgi", fieldop=0, fulldepth=True)

DGTelecide(mode=1, dthresh=3.5)
DGDecimate()

#####CROP#####
Crop(12, 60, -8, -60)

#####RESIZE#####
Spline64Resize(854, 370)

ConvertBits(10)

When using the vapoursynth equivalent I have problems
Vapoursynth Editor check says the script is fine but I can't even get vdub2 to load it
import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin("C:/Program Files (Portable)/dgdecnv/DGDecodeNV.dll")
clip = core.dgdecodenv.DGSource(r'F:\xxxxx.dgi', fieldop=0, fulldepth=True)

#####AVSCOMPAT#####
core.avs.LoadPlugin("C:/Program Files (Portable)/dgdecnv/DGDecodeNV.dll")

#####IVTC#####
clip = core.avs.DGTelecide(clip, mode=1, dthresh=3.5)
clip = core.avs.DGDecimate(clip)

#####CROP#####
clip=core.std.Crop(clip, left=12, right=8, top=60, bottom=60)

#####RESIZE#####
clip=core.resize.Spline36(clip=clip, width=854, height=370)

clip = core.resize.Point(clip, format=vs.YUV420P10)

clip.set_output()

Can someone help me find the problem

The reason I am trying to get the vpy script working is that when using 64 bit suptitle I get major artifacts during the appearance of the subtitle
I don't have a problem with ImageFile

gonca
23rd June 2019, 19:15
Been working on it and the problem seems to be the resize line
Gives resize error 1027

gonca
23rd June 2019, 19:20
Some more googling and attempts to figure it out and I solved the issue

StainlessS
23rd June 2019, 20:41
and I solved the issue

Dont keep it quiet, what was it. [Perhaps 'clip=clip' where I'm guessin' clip is non optional (I dont speak snake)].

ChaosKing
23rd June 2019, 21:22
clip=clip is correct. Resize error 1027: image dimensions must be divisible by subsampling factor
If you change height to something like 372 then it should work.

But is height = 370 correct for YUV420P8? I can confirm that it works in avs, in VS not. Who is to blame?

sneaker_ger
23rd June 2019, 21:27
Interlaced should need mod4, progressive only mod2?

http://avisynth.nl/index.php/Crop#Crop_restrictions

gonca
23rd June 2019, 21:30
The video is form an old DVD.
The DVD was soft pull down but the video was flagged interlaced (fake)
Interlaced cropping must be mod 4

import vapoursynth as vs
core = vs.get_core()
core.std.LoadPlugin("C:/Program Files (Portable)/dgdecnv/DGDecodeNV.dll")
clip = core.dgdecodenv.DGSource(r'F:\xxxxx.dgi', fieldop=0, fulldepth=True)

#####AVSCOMPAT#####
core.avs.LoadPlugin("C:/Program Files (Portable)/dgdecnv/DGDecodeNV.dll")

#####IVTC#####
clip = core.avs.DGTelecide(clip, mode=1, dthresh=3.5)
clip = core.avs.DGDecimate(clip, cycle=5, keep=4)

#####CROP#####
clip=core.std.Crop(clip, left=12, right=8, top=60, bottom=60)

#####RESIZE#####
clip = core.std.SetFieldBased(clip, 0)
clip=core.resize.Spline36(clip=clip, width=854, height=370)

clip = core.resize.Point(clip, format=vs.YUV420P10)

clip.set_output()


The red parts are the changes
The SetFieldBased entry gets around the mod requirements for interlaced

This whole exercise is because 64 bit suptitle does some nasty things when the subtitle is showing, makes it look like I am using 50kb/s

gonca
23rd June 2019, 21:40
Dont keep it quiet, what was it. [Perhaps 'clip=clip' where I'm guessin' clip is non optional (I dont speak snake)].

I don't speak it well either, actually I just mumble a lot.
That is why it takes me longer and I have to ask for help for vpy and avs+ scripts

And I still don't get any notifications
Maybe some is giving me a hint

ChaosKing
23rd June 2019, 21:45
Interlaced should need mod4, progressive only mod2?

http://avisynth.nl/index.php/Crop#Crop_restrictions

Ahh yes, a progressive clip with height=370 works in VS, interlaced also if you set the field core.std.SetFieldBased(clip, 0).

gonca
23rd June 2019, 22:32
Ahh yes, a progressive clip with height=370 works in VS, interlaced also if you set the field core.std.SetFieldBased(clip, 0).

To be more specific
This was a 720x480 16:9 with letterboxing
I removed the black bars and resized so I could use a SAR of 1:1
so I don't have to rely on a media player being able to recognize the DAR in a mkv container

I was using a progressive clip, which had fake interlaced flags