Various AVISynth scripts to clean noise and convert PAL to NTSC
Hello,
I have a few AVISynth script file presets that I use to clean/sharpen VHS and sometimes convert PAL to NTSC. I'd like to share them. The footage is assumed interlaced and Huffyuv losslessly compressed. Function names speak for themselves. First one just cleans and sharpens the image. I am sure I will get criticized for splitting into fields and treating fields like frames. Code:
LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\2.0\LoadPluginEx2.dll") Code:
function vhs_pal_interlaced_to_ntsc(clip myclip, int start, int end, int "dest_width", int "dest_height", int "pixiedust_limit", float "sigma", float "ss_x", float "ss_y") Code:
function vhs_pal_progressive(clip myclip, int start, int end, int "dest_width", int "dest_height", int "pixiedust_limit", float "sigma", float "ss_x", float "ss_y") Code:
function vhs_pal_progressive_to_ntsc(clip myclip, int start, int end, int "dest_width", int "dest_height", int "pixiedust_limit", float "sigma", float "ss_x", float "ss_y") References: FFfft3dfilter: http://avisynth.org.ru/fft3dfilter/fft3dfilter.html LimitedSharpen: http://avisynth.org/mediawiki/LimitedSharpen I can provide the before and after screen shots if anyone is interested. |
I'll reply with my own scripting later....
For now, I edited your post to clean up the Avisynth scripting, and put it between [code][/code] tags. Take no offense, I'm just trying to make it easy for others to follow along. The excessive use of / makes it hard for newbies to know what's going on. Some of the devs at Doom9 and Avisynth.org use far too many / marks in order to put code on separate lines. With a GUI like AvsPmod, breaking the code up like that doesn't make much sense anymore. The GUI dumps all the variables into option boxes, and then the lines wrap in the code view. As far as your code goes... My preferred method is to convert PAL to progressive with a high quality deinterlacer, and then convert it to 480p24, and then alter the audio within a few ms via Sound Forge 9 Pro. In the era of 120hz HDTVs and progressive-scan DVD/Blu-ray players, it just makes more sense. From my quick glance at the script, you're split fields, denoising it, padding it with dupe frames, and then re-interlacing it as NTSC. Is that correct? That does work, but it's forever juddered. Definitely post some stills and clips. :) |
5 Attachment(s)
Quote:
Quote:
Now screen shots. The footage was interlaced PAL VHS that I captured with my LifeView FlyVideo 3000FM via S-Video cable from JVC VCR in Edit mode. The format is PAL 25fps 704x576, Huffyuv. I chose the frame where the motion takes place so that you can see interlaced artifacts. And you can see some chroma noise. The 1st image is the original unfiltered. The 2nd image is denoised/sharpened (see the script above) also in PAL and is in cropped D1 (i.e. 704x576). It's very interesting to compare this to the original. Take a closer look and let me know what you think as far as noise and sharpening goes. The 3rd image is denoised, converted to NTSC and then sharpened. The resolution is cropped D1 (704x480) for NTSC. The 2nd and the 3rd image are for illustration purposes. When I go for DVD, I use half D1, not cropped D1. So the last 2 images (4th and 5th) are half D1 PAL and half D1 NTSC respectively. --Leonid |
To quickly address the audio comment, you have to alter pitch by almost 4%. I forget the exact % down to thousandths.
Otherwise it goes chipmunk |
To be blunt.. if stealing code, steal something better, this don't make sense to me.. (only commenting the denoising part)
Why PixieDust? It's legacy, you need tricks even to load the plugin in modern Avisynth, IIRC it's not that well suited for VHS even way back then. Also PixieDust is spatio-temporal filter, not just spatial (http://avisynth.org/mediawiki/Dust/PixieDust), FFT3DFilter is spatio-temporal also. I have no idea about PixieDust but the default settings passed to FFT3DFilter are too high, bt=5 can cause ghosting. Separating fields and then feeding them to temporal denoiser as progressive causes filter to work with wrong temporal information because you're missing the field inbetween. I don't have the know-how to explain this better than this. There's no reason to separate fields for denoising because FFT3DFilter supports interlaced processing (and PixieDust can be forgotten..). If you really want to use PixieDust, use something like lossless bob -> filter -> re-interlace. And finally a matter of taste, to my eyes the samples are oversharpened and cause artifacts from denoising to be visible. I'd suggest taking a look at MVDeGrain[1-3] http://avisynth.org.ru/mvtools/mvtools2.html About audio processing; http://avisynth.org/mediawiki/TimeStretch PS. Post samples of the video, still images don't tell the full story. |
Quote:
Quote:
Quote:
What should I have done is this: SeparateFields Pixie Weave FFT3D(bt = 5) SeparateFields LimitedSharpen Weave It will take forever to process though. :) Quote:
Quote:
|
Quote:
Quote:
Quote:
Quote:
Quote:
I understand that things may look ok to you even if they're not done correctly. But passing bad workflow as advice to people who may use it to damage their videos without knowing any better is not nice. This is the danger with Avisynth, it's easy to mess up. |
Quote:
Or use a Dropbox free account. Remember that Site Staff don't visit "download sharing" sites like Megaupload: http://www.digitalfaq.com/forum/news...embership.html Countdown clocks, ad-filled pages, etc -- wastes time, and those sites are often sources of malware exploits. |
Quote:
Quote:
Do you happen to know off the top of your head the AVISynth function that moves the field up and down? By the way, why is that one line up and one line down? Don't they have to meet in the middle to be aligned? Shouldn't it be half line up and half line down? 100fps.com suggested quarter scan line in deinterlacing. Please, advice. So I guess, the more correct way should be: Code:
SeparateFields Quote:
|
I'm way past my bedtime and I'll comment more later. For now I wanted to say that you only need to move even OR odd fields, not both. If you think about what an interlaced frame is, you'll figure out why. :) No idea why 100fps talks about quarter. I don't remember how properly to do this in code, check doom9.
My way has been (slower than your way because of double height): Code:
Bob(0.0, 1.0) # lossless bob |
Quote:
Now do you suggest I do this: Code:
Bob(0.0, 1.0) # lossless bob --Leonid |
Code:
SetMemoryMax(512) Some of the commented out NR settings can be activated, though never all of them together. I snagged some quick settings from the main processing system just now. These are some common basics amongst the various scripts written for specific types of errors. All of the numbers are fungible, change as needed. Avisynth is not a monkey-see/monkey-do type software. It's easier to make a mess than to improve video, if you don't fully understand what's happening in the scripts. Only use as many filters as needed. Never unnecessarily use extra filters, as it mostly just makes quality worse (not better). AvsPmod is helpful, so you can preview what's going on by changing settings, or activating various filters. Do note that some of these can be created in VirtualDub, too. Vdub has several NR filters. The Median filter, for example. Or changing the framerate to 23.976. Some things are only possible in Avisynth, some are only possible in VirtualDub, and some can be done in both. |
Quote:
PS. Instead of LimitedSharpen try http://avisynth.org/mediawiki/LSFmod PPS. http://avisynth.org/ is a good reading :) |
Site design, images and content © 2002-2024 The Digital FAQ, www.digitalFAQ.com
Forum Software by vBulletin · Copyright © 2024 Jelsoft Enterprises Ltd.