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. |
|
|
Thread Tools | Search this Thread | Display Modes |
19th September 2015, 23:15 | #1 | Link |
Registered User
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
|
Interlaced VHS Cleaning with resize does not output correct interlaced video
I experiment with a script basically made by johnmeyer. I have added a crop and resize function, and I use autoadjust for Color and Levels, as well as a sharpen stage.
Principally it works fine but the result does not Output a correct interlaced TFF Video. There is something wrong with the fields. Unfortunately I do not understand why it makes this field mess. It should output a TFF Video as is the Input. I think the various process stages are not in correct order. But how should it be? Can anybody help me with this. I would appreciate it very much. Here is the VHS script: Code:
#original Denoiser script for interlaced video using MDegrain2i2_by JMH SetMemoryMax(1024) Loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\mvtools2.dll") LoadPlugin("C:\Program Files (x86)\AviSynth 2.5\plugins\cnr2.dll") SetMTMode(5,6) #~ source=AVISource("E:\fs.avi").killaudio().AssumeTFF().waveform().Crop(12, 4, -12, -8) source=qtinput("D:\videodata.mov", color=2, audio=0).ConvertToYV12.AssumeTFF().Crop(12, 0, -12, -8) # Crops xx pixels L,T,R,B and resizes to 720x576ilaced: SetMTMode(2) #CHROMA RESTAURATION specially for analog source material chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #for VHS/V8 #chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,false) #for Laserdisc #Set overlap in line below to 0, 2, 4, 8. Higher number=better, but slower (BLOCKSIZE/OVERLAP/STRENGTH/DCT) / Increase thSAD Value for more degraining #~ output=MDegrain2i2(source,4,0,400,0) #For VHS, better results in shadows #~ output=MDegrain2i2(source,8,2,300,0) #For Hi8, good noise reduction output=MDegrain2i2(chroma,8,4,300,0) #Retains a little more detail, but slower #output=MDegrain2i2(chroma,4,2,400,0) #Better for retaining detail on flat surfaces, but slower still #-CHOOSE OUTPUT to display compared view or only processed output output=IResize(output,720,576) #~ StackHorizontal(source,output) #~ return output.Levels(16, 1, 235, 0, 255, coring=false) #simple Level Adjust return output.AutoAdjust(auto_balance=false, chroma_limit=1.05, auto_gain=true, gain_mode=0, chroma_process=100, gamma_limit=1.25, high_quality=false) #Auto Color and Level #~ return output #------------------------------- function MDegrain2i2(clip source, int "blksize", int "overlap", int "strength", int "dct") { fields=source.SeparateFields() # separate by fields super = fields.MSuper(pel=2, sharp=1) backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct) forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct) backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct) forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct) MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=strength) #Optional sharpening steps unsharpmask(50,3,0) sharpen(0.1) Weave() } function IResize(clip Clip, int NewWidth, int NewHeight) { Clip SeparateFields() Shift=(GetParity() ? -0.25 : 0.25) * (Height()/Float(NewHeight/2)-1.0) E = SelectEven().Spline36resize(NewWidth, NewHeight/2, 0, Shift) O = SelectOdd( ).Spline36resize(NewWidth, NewHeight/2, 0, -Shift) Ec = SelectEven().Spline36Resize(NewWidth, NewHeight/2, 0, 2*Shift) Oc = SelectOdd( ).Spline36Resize(NewWidth, NewHeight/2, 0, -2*shift) Interleave(E, O) IsYV12() ? MergeChroma(Interleave(Ec, Oc)) : Last Weave() }
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore Last edited by papcom; 19th September 2015 at 23:18. |
20th September 2015, 00:35 | #2 | Link |
Formerly davidh*****
Join Date: Jan 2004
Posts: 2,532
|
IResize separates fields and resizes (or so it seems at a glance), but after separating fields you've really got non-contiguous rows above and below each other, which won't resize nicely if you're changing the vertical resolution. And you do seem to be cropping 8 pixels off the bottom before your resize to 720x576...
But I might be missing something. |
20th September 2015, 09:48 | #3 | Link |
Registered User
Join Date: Oct 2009
Location: crow-land
Posts: 543
|
seems about right from previous advice,
http://forum.doom9.org/showthread.ph...90#post1185790 sure the source is TFF ? place AssumeTFF() before the function and on the end of the weave. does the cnr2 need separate and weave as well ? Last edited by hydra3333; 20th September 2015 at 09:52. |
20th September 2015, 11:16 | #4 | Link |
Registered User
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
|
Do You think that the crop is at the wrong Position? ... where shall I put the cropping? (I must be able to crop some Pixels at B/T/L/R in order to get rid of the nasty trash around VHS pics)
HELP: The Problem is, that my script above results in a Video that has Field1 and Field2 identically !!!
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore Last edited by papcom; 20th September 2015 at 13:35. |
20th September 2015, 16:25 | #5 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,748
|
Do you absolutely want to resize and avoid black borders ? Because you can simply replace cropped lines by black lines (and center video, thus add for example 4 lines on top and 4 below if you cropped 8 bottom lines), that's always what I do with VHS sources, I don't even de-interlace.
If you need temporal filters on interlaced sources, you can use JDL_UnfoldFieldsVertical ; http://www.avisynth.nl/users/stickboy/ It separates fields and gather them one above the other, it's better than simply separate fields (which alternate top and bottom fields, not good for temporal filters). It needs jdl-interlace.avsi and jdl-util.avsi. Here is an example ; Code:
source() assumeTFF() Crop(12,0,-12,-8) JDL_UnfoldFieldsVertical(flip=true)#separate and gather fields, video becomes kind of progressive spatial and/or temporal filters(...) JDL_FoldFieldsVertical(flip=true)#re-interlace addborders(12,4,12,4) But of course, the result is not exactly the same than if you filter a de-interlaced video because filtering is done on flattened fields ; try and see if the result is good enough for you. But it allows to avoid potential de-interlacing and resizing artifacts, each method has its benefits. The argument flip=true flips only the bottom field, which makes both fields touching themselves by their bottom side (better for spatial filters). edit : to open mov files (and also TS, mkv or mp4), LWLibavVideoSource may be better than qtinput, especially with interlaced h264. Findable here (take L-SMASH-Works and put LSMASHSource.dll in Avisynth's plugins folder) ; http://forum.doom9.org/showthread.ph...73#post1689573 Last edited by Music Fan; 20th September 2015 at 17:26. |
20th September 2015, 18:05 | #7 | Link |
Registered User
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
|
thanks @musicfan and @jmh ...I will be pleased to try the border solution. But can You pls help me with the JDL Utility? I am not familiar with this. Where shall I put which code in my scipt?
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore |
20th September 2015, 19:46 | #8 | Link |
Registered User
Join Date: May 2009
Location: Belgium
Posts: 1,748
|
You just have to put jdl-interlace.avsi and jdl-util.avsi (they include several functions) in Avisynth's plugins folder, then you will be able to use JDL_UnfoldFieldsVertical(flip=true) and JDL_FoldFieldsVertical(flip=true), as in my example.
If these functions are not detected, you will have to use Loadplugin in the debut of the script to load both avsi, as for the dlls in your script. And of course you will have to modify your script to remove everything about resize an re-interlacing. Use all colors corrections and denoising between the 2 JDL... lines. Last edited by Music Fan; 20th September 2015 at 19:54. |
20th September 2015, 21:32 | #9 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,718
|
The original script should work. Is this standard definition video? It appears that it might be, given that you are re-sizing to PAL SD. If your source is PAL SD, that is bottom field first, and therefore you need to change AssumeTFF to AssumeBFF.
|
23rd September 2015, 09:35 | #11 | Link |
Registered User
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
|
Black Borders can be a way to go, but anyway I search for the resized solution. I need a result without any border or blanking or head switching noise around the pic, and which finally has the standard SD-format of 720x576-25i.
(BTW: I work with SD 720x576 ProRes422-25i-PAL CCIR files, which are TFF, as defined in the prores-standard.)
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore |
Thread Tools | Search this Thread |
Display Modes | |
|
|