Log in

View Full Version : dvd encoding with vs


aldix
1st January 2020, 17:13
hi & happy new year,

quite a newbie in vs, what's the equivalent for this:


last.tfm().tdecimate().colormatrix()


many thanks in advance!

Selur
1st January 2020, 22:16
TFM&Decimate:
http://www.vapoursynth.com/doc/plugins/vivtc.html
ColorMatrix:
No extra filter is needed, ColorMatrix can be adjusted with the normal resizers:
for example:
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)
see: http://www.vapoursynth.com/doc/functions/resize.html

Here's also an example of a script:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins, is only required if you use the portable version
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/d2vsource.dll")
# Loading F:\TestClips&Co\files\interlaceAndTelecineSamples\telecine\apollo_440_-_lost_in_space(jason_nevis_lunar_landing).m2v using D2VSource
clip = core.d2v.Source(input="E:/Temp/m2v_4bff9621d633f8451e10095c6a88fe26_853323747.d2v")
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip, fpsnum=30000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)
# applying VTM and VDecimate
clip = core.vivtc.VFM(clip=clip, order=0, mode=1)
clip = core.vivtc.VDecimate(clip=clip)
# Output
clip.set_output()

Cu Selur

Ps.: Sadly like with Avisynth in Vapoursynth there is no source filter which can properly parse a dvd (and allows to select a program chain).

aldix
1st January 2020, 23:36
thanks a lot for the reply!


Ps.: Sadly like with Avisynth in Vapoursynth there is no source filter which can properly parse a dvd (and allows to select a program chain).


what do you mean? rn i got the d2v working on vs with this:


core.std.LoadPlugin(path="C:/Users/Admin/AppData/Local/Programs/Python/Python37/Lib/site-packages/vapoursynth/d2vsource.dll")
...
src = core.d2v.Source(input=r"c:\disc1\video_ts\VTS_02_1.d2v")


is it wrong? cos even tho i got everything working (found vivtc package ultimately), video is doing strange things on vs editor preview - like, weird color bleeding on scene change when clicking through frame by frame? stuff like that. is it cos of what you said?


:thanks:

lansing
2nd January 2020, 03:46
If you're not going to upscale your dvd or need to combine it with 1080p videos, you don't need to convert the color matrix, just leave it as it is. Then in your encoder, like x264, add a flag to specify that your video is rec601 (--colormatrix smpte170m) and the video player will display the color correctly.

aldix
2nd January 2020, 04:26
If you're not going to upscale your dvd or need to combine it with 1080p videos, you don't need to convert the color matrix, just leave it as it is. Then in your encoder, like x264, add a flag to specify that your video is rec601 (--colormatrix smpte170m) and the video player will display the color correctly.

hmm, no, i don't need to do any of that. so if i'll add this flag when encoding, it will get rid of the color bleeding? thanks!

lansing
2nd January 2020, 05:00
hmm, no, i don't need to do any of that. so if i'll add this flag when encoding, it will get rid of the color bleeding? thanks!

I don't know about the color bleed, you may need to upload a sample clip here to show the problem

Selur
2nd January 2020, 11:34
what do you mean?
If you don't know about DVDs and their program chains and the script properly shows the content you want everything is fine.

feisty2
2nd January 2020, 11:54
TFM&Decimate:
http://www.vapoursynth.com/doc/plugins/vivtc.html
ColorMatrix:
No extra filter is needed, ColorMatrix can be adjusted with the normal resizers:
for example:
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)
see: http://www.vapoursynth.com/doc/functions/resize.html

Here's also an example of a script:
# Imports
import vapoursynth as vs
core = vs.get_core()
# Loading Plugins, is only required if you use the portable version
core.std.LoadPlugin(path="I:/Hybrid/64bit/vsfilters/SourceFilter/d2vSource/d2vsource.dll")
# Loading F:\TestClips&Co\files\interlaceAndTelecineSamples\telecine\apollo_440_-_lost_in_space(jason_nevis_lunar_landing).m2v using D2VSource
clip = core.d2v.Source(input="E:/Temp/m2v_4bff9621d633f8451e10095c6a88fe26_853323747.d2v")
# making sure input color matrix is set as 470bg
clip = core.resize.Point(clip, matrix_in_s="470bg",range_s="limited")
# making sure frame rate is set to 29.970
clip = core.std.AssumeFPS(clip, fpsnum=30000, fpsden=1001)
# Setting color range to TV (limited) range.
clip = core.std.SetFrameProp(clip=clip, prop="_ColorRange", intval=1)
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)
# applying VTM and VDecimate
clip = core.vivtc.VFM(clip=clip, order=0, mode=1)
clip = core.vivtc.VDecimate(clip=clip)
# Output
clip.set_output()

Cu Selur

Ps.: Sadly like with Avisynth in Vapoursynth there is no source filter which can properly parse a dvd (and allows to select a program chain).

This is incorrect, anything involving convolution must be performed on progressive content, so field matching must be the very first step, before all that matrix conversion stuff, which involves resampling (convolution) from 420 to 444 to 420

Selur
2nd January 2020, 15:22
damn, you are right the order must be

# applying VTM and VDecimate
clip = core.vivtc.VFM(clip=clip, order=0, mode=1)
clip = core.vivtc.VDecimate(clip=clip)
# ColorMatrix: adjusting color matrix from 470bg to 709
clip = core.resize.Bicubic(clip=clip, matrix_in_s="470bg", matrix_s="709", range_in=0, range=0)

aldix
2nd January 2020, 17:41
I don't know about the color bleed, you may need to upload a sample clip here to show the problem

here are two consecutive frames, the first one is the problematic one. i've no idea what's the red "blob" and how to get rid of it. same thing can also be blue, and also on scene changes as it were (not sure what's the more accurate term would be...).


https://i.ibb.co/0r8vtqm/5810.png



https://i.ibb.co/rysvGKb/5811.png


also, thanks for all the other replies. thankfully yes, the d2vsource option seems to be working fine, it's only the above issue i'm dealing with rn. thanks!

AzraelNewtype
5th January 2020, 00:02
The blob appears to be the chroma from the second frame leaking early. Changing the colormatrix will do literally nothing to fix this.

Selur
5th January 2020, 08:14
Assuming this is not in the source, try whether disabling mchroma and or chroma in VFM helps.
see: http://www.vapoursynth.com/doc/plugins/vivtc.html

aldix
5th January 2020, 20:23
Assuming this is not in the source, try whether disabling mchroma and or chroma in VFM helps.
see: http://www.vapoursynth.com/doc/plugins/vivtc.html

thanks for the advice! however, neither disabling either of those or both together works - the blob remains. what else can i try? thanks!

edit: i just tried adding chroma=False to VDecimate and the result is the spill jumping to the next frame. maybe useful in tracking this down? i'm lacking enough expertise myself.

poisondeathray
6th January 2020, 15:45
Does problem occur on every scene change?

If you upload an unprocessed video sample, someone will take a look and make suggestions

feisty2
6th January 2020, 16:00
someone will take a look and make suggestions

no. I cant remember when was the last time someone had the time and cared to do this on this (vaporsynth) forum

aldix
6th January 2020, 17:56
Does problem occur on every scene change?

If you upload an unprocessed video sample, someone will take a look and make suggestions


well, this is a very strange development, at least for me, but i guess i gotta chalk it down to my inexperience.

problem went away after i put crop after vfm & vdecimate (it was right after d2vsource previously).

thank you everyone for engaging, though. much appreciated!

poisondeathray
6th January 2020, 18:19
well, this is a very strange development, at least for me, but i guess i gotta chalk it down to my inexperience.

problem went away after i put crop after vfm & vdecimate (it was right after d2vsource previously).

thank you everyone for engaging, though. much appreciated!


Interlaced 4:2:0 crop has restrictions; width mod2, height mod4.

You should always post your full script