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. |
16th June 2022, 14:30 | #1 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
deinterlacing+ not coming out smooth
I have the below script I'm running on some old VHS footage. Footage is 29.97 and interlaced. Final outcome is 59.94 and progressive. The resulting footage doesn't seem super smooth movement wise like the source. Do you see something wrong with this script that would cause movement to be not so smooth and maybe the look of ghosting during movement?
Code:
#LoadPlugin("D:\Program Files (x86)\AviSynth+\plugins+\LSMASHSource.dll") function VideoAndAudio(string filename) { v = LWLibavVideoSource(filename) # get video a = LWLibavAudioSource(filename) # get audio AudioDub(v,a) # join them } VideoAndAudio("<video>") assumetff() resampleaudio(48000) # audio resampling because my caps are 32khz converttoyv12(interlaced=true) ylevels(0,1.000,255,16,255) # adjust Luma levels only (adjust according to your needs) tweak(sat=1.2,cont=1.0,bright=0,coring=false) # adjust saturation, contrast, etc... ######################## pointresize(last.width, last.height*2).ConverttoRGB32(matrix="rec601",interlaced=true).pointresize(last.width, last.height) separatefields() ## Remove some chroma noise with CCD in RGB (gives best results) ## pointresizing for lossless RGb <> YCrCb convertion LoadVirtualDubPlugin("Z:\virtualdub\plugins32\Camcorder_Color_Denoise_sse2.vdf", "CCD", 1) CCD(15,1) # from 0 to 100 # Default =30 / 15-30 = best results # Sharpening (small-medium) with msu smart sharpen LoadVirtualDubPlugin("Z:\virtualdub\plugins32\msu_sharpen.vdf", "MSUSmartSharpen", 1) MSUSmartSharpen(3) # from 0 (small overall) to 5 (mad) weave() pointresize(last.width, last.height*2).converttoyv12(matrix="Rec601",interlaced=true).pointresize(last.width, last.height) ################### # Denoising with Mdegrain1 for not too strong noise and interlaced source fields=AssumeTFF().SeparateFields() # or AssumeBFF super = MSuper(fields) backward_vec2 = MAnalyse(super, isb = true, delta = 2, overlap=2) forward_vec2 = MAnalyse(super, isb = false, delta = 2, overlap=2) MDegrain1(fields, super, backward_vec2,forward_vec2,thSAD=400) Weave() AssumeTFF() QTGMC(Preset="Slower", SourceMatch=3, Lossless=2, Sharpness=0.1) Crop(6,0,0,-8) AddBorders(6,0,0,8) Last edited by jriker1; 16th June 2022 at 14:58. |
16th June 2022, 19:31 | #2 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
One obvious thing to check is that AssumeTFF is correct. Feed your original to this script:
Separatefields() AssumeTFF() and see if you get retrograde motion (two steps forward, one step back). If you do, change to BFF. I think your PointResize is being done on interlaced footage. Any resizing should be done after the footage is progressive (i.e., at the end) after you apply QTGMC. Your first set of functions that are applied to separated fields are not preceded by a selecteven() and selectodd() function. Normally you do your processing, after separating fields, on the even fields only and then the odd fields only. Otherwise the adjacent fields are not spatially aligned. You then do an Interleave() command prior to the Weave() command to put the even and odd fields back together. I can't remember if you do Interleave(Even,Odd) or Interleave (Odd,Even). I always have to test this for every script. You do a second Seperatefields() just after making the video interlaced again. Not sure why you did this. Probably not a big deal, but there is a small possibility that you could have reversed the fields in the previous Weave() statement. I don't think your script will do this, but you can easily check by temporarily making the last statement in the script Return(fields). You can see if you have any retrograde motion. |
16th June 2022, 22:36 | #3 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
Thanks for the help I will adjust things accordingly. Other issue I'm running into. So the source video has per mediainfo:
Pixel aspect ratio : 0.889 Display aspect ratio : 1.333 Display aspect ratio : 4:3 However the resulting output video shows Pixel aspect ratio 1.0 Display aspect ratio 1.5 Is there something I have to add to the script to make sure the PAR and DAR are right? I'm guessing AVISynth isn't responsible for this but would hope that VirtualDub would set these values accurately on output IF LWLibavVideoSource was passing the right info to the encoder but probably inaccurate. Or maybe I continue working with it the way it is and then when I put the final file in the MKV container add the DAR 1.333 to it? Last edited by jriker1; 17th June 2022 at 01:02. |
17th June 2022, 06:43 | #4 | Link | ||
Registered User
Join Date: Nov 2006
Posts: 773
|
you forgot selecteven
Quote:
Quote:
msu sharp: 3 is high aswell (i like 0 or 1 personnally) pointresize: no need now, i believe that was because of a mismatch between yv12<> rgb rounding errors, avisynth 2.6 mt fixed it qtgmc("slower"), by using the "slower" mode you are denoising some more i advise you to use "fast" or "medium" Last edited by Mounir; 17th June 2022 at 06:48. |
||
18th June 2022, 01:12 | #6 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
If you're starting out with 29.97 interlaced video, and if you want it to have the same "feel" and smoothness as the original, then my choice would be to leave it as 59.94 progressive. Therefore, I would not use selecteven() at the end.
À chacun son goût. |
18th June 2022, 14:34 | #7 | Link |
Registered User
Join Date: Dec 2003
Posts: 485
|
Thanks. The original VHS was encoded to the following specs, sharing what I assume are relevant so to not post to much detail. Glad to provide the whole MediaInfo output:
Inform: 24.4 Mb/s, 720*480 (4:3), at 29.970 (29970/1000) FPS, DV (NTSC) Format: DV Width: 720 pixels Height: 480 pixels Pixel aspect ratio: 0.889 Display aspect ratio: 1.333 Display aspect ratio: 4:3 Frame rate: 29.970 (29970/1000) FPS Color space: YUV Scan type: Interlaced Scan order: Bottom Field First When I run the AVISynth script thru VirtualDub, I end up with: Inform: 73.2 Mb/s, 720*480 (3:2), at 59.940 (60000/1001) FPS, Lagarith Format: Lagarith Width: 720 pixels Height: 480 pixels Pixel aspect ratio: 1.000 Display aspect ratio: 1.500 Display aspect ratio: 3:2 Frame rate: 59.940 (60000/1001) FPS Color space: YUV Scan Type not listed in output but progressive now So what happened to the Pixel and Display aspect ratios? Note this isn't the final output and perhaps when it's in an MKV container I just need to change the DAR or something in the metadata but not sure. |
18th June 2022, 15:49 | #8 | Link |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 115
|
Why applying MDegrain1 on separate fields when finally you deinterlace the video? It is more effective (and technically correct) if used after QTGMC(). And while you are there better keep all frames, rather then removing one with SelectEven() loosing half of the motion, ad johnmeyer properly suggested.
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
18th June 2022, 16:32 | #9 | Link | |
Registered User
Join Date: Dec 2003
Posts: 485
|
Quote:
|
|
18th June 2022, 17:37 | #10 | Link |
Registered User
Join Date: Aug 2017
Location: Italy
Posts: 115
|
The question is that the video is interlaced, and the temporal filters or spatial/temporal filters are designed for progressive frames. If you denoise after SeparateFields() is wrong. If you denoise after SeparateFields() .SelectEven() or SeparateFields().SelectOdd() is not optimal, and somehow wrong as well.
For a pure temporal filter in theory there is no need to deinterlace, neither to do any of the field operation. In practice, working with a deinterlaced frame gives twices the data to the filter, which is better. Some references: https://forum.doom9.org/showthread.php?t=86394 http://forum.doom9.net/showthread.ph...93#post1921993 https://forum.doom9.org/showthread.p...95#post1691595
__________________
A channel on S-VHS / VHS capture and AviSynth restoration https://www.youtube.com/channel/UCMs...h1MmNAs7I8nu4g |
20th June 2022, 14:44 | #11 | Link | ||
Registered User
Join Date: Dec 2003
Posts: 485
|
Side item. Do we know why when I run this script thru virtualdub it shows all kinds of white lines?
Picture isn't showing so here is a link: https://ibb.co/f2bGNLQ This isn't in the source file and doesn't really show in the final output but I have seen it from time to time when scrolling thru the output video. Note if I strip out everything but the QTGMC part and converttoyv12 it goes away hmmm. Seems to be related to this piece: Quote:
converttoyv12(matrix="Rec601",interlaced=true) After the end Weave() again those lines go away. However if I remove the above section entirely except for the converttovy12 lines are still there ugh. Should note it's flaky. Like I can remove a section and those lines aren't there, then add them back in and "maybe" they will come back maybe they won't. Like I took out: Quote:
Last edited by jriker1; 20th June 2022 at 15:13. |
||
20th June 2022, 15:32 | #12 | Link | |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
Quote:
The rest of your original script will probably be OK (i.e., if you are going to deinterlace, then you WANT to have 59.94 fps progressive as your final output. |
|
20th June 2022, 16:08 | #13 | Link | ||
Registered User
Join Date: Dec 2003
Posts: 485
|
Quote:
Quote:
Last edited by jriker1; 20th June 2022 at 19:19. |
||
20th June 2022, 21:26 | #14 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
Try a different zoom level in Virtualdub. Depending on your video driver, you can sometimes get artifacts in the VirtualDub display which are not actually in the video. You can also test this idea by rendering 2-3 seconds of video and see if the white lines show up in the final render.
|
Tags |
avisynth |
|
|