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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 28th March 2008, 15:16   #1  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
My PAL S-VHS clean up script

This isn't magic, and the best parts/ideas were taken from other people, but I'm sharing it in case it's any use to someone...

Code:
avisource("whatever.avi")

# PAL = TopFieldFirst
assumetff() 

# Make progressive
Bob(0.0,1.0) # better bobbers are available ;)

# Fix (S-)VHS chroma shift
Vshift=2 # determine experimentally
Hshift=2 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
mergechroma(last.crop(Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))

# Need YV12 for mc_spuds and aWarpSharp
# (Consider doubling vertical resolution to prevent loss here if you really care?)
# ( - I don't, so I haven't tried it)
converttoyv12(interlaced=false)

# Store the noisy version
a=last 

# Denoise with mc_spuds
mc_spuds(chro=true)

# warp horrible fuzzy chroma to match nice sharp luma
c=aWarpSharp(depth=20.0, thresh=0.75, blurlevel=2, cm=1)

# put a little of the original noise back in to avoid "plastic" look
overlay(a,opacity=0.4) # 0.5 keeps 50% noise, 0.25 keeps 25% noise etc

# completely replace chroma with nice version
mergechroma(c)

# go back to a nicer colour space before re-interlacing
# (not worth it for DVD etc, but good if you want to store lossless YUV and maybe take frame grabs)
converttoyuy2(interlaced=false)

#re-interlace
assumetff()
separatefields()
selectevery(4,0,3)
weave()
If anyone spots any bugs, please let me know.

Note: I'm using the original version of mc_spuds. Other versions (and other sources) might benefit from different options, and more or less noise mixed back in.

Note: I'm intentionally not blanking the head switching at the bottom since it usually includes good picture on my tapes, and I'm hoping to inpaint the bad line or two one day! If you prefer to paste a black border over the bottom to hide the mess, use...
Code:
crop(0,0,0,-16).AddBorders(0,0,0,16)
...at the end.

Comments welcome.

Cheers,
David.
Attached Images
  
2Bdecided is offline   Reply With Quote
Old 28th March 2008, 16:15   #2  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,630
if you got the processing power I suggest to use nnedi(field=-2) instead of bob().

You'll get much better denoising at straight diagonals
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 28th March 2008, 16:19   #3  |  Link
g-force
Guest
 
Posts: n/a
I think the chroma shift part is pretty clever. Nice work!

suggestion: instead of "crop(0,0,0,-16).AddBorders(0,0,0,16)" you could use "Letterbox(last,0,16)" since you're croping and adding borders by the same amount.
-G
  Reply With Quote
Old 28th March 2008, 17:34   #4  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
g-force,
I didn't know about letterbox - thank you g-force. I'm currently keeping the overscan in the hope of improving it one day, and intend to just crop it out completely for PC applications (mainly facebook/youtube) - but if I decide to mask out the DVD res version I will use letterbox.

scharfis_brain,
The denoising is already painfully slow - I'll see how much worse nnedi makes it. I started with bob(), but found bob(0.0,1.0) was much sharper (preserved the original lines, of course). I also tried mcbob (experiment only - way too slow for actual use) and it sometimes improved sharpness a little more, but occasionally got confused by the noise and added artefacts. I'll see if nnedi has the same issues.

Thanks for the feedback.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 26th February 2009, 18:23   #5  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
Dear 2Bdecided,

I finally discovered your script which works very very good for me. I use fft3dGPU instead of MC-Spuds for "best quality/speed" ratio.

But I wanted to know if you improved your script since march 2008?

and how did you find the settings for awarpsharp (as your settings value are different from what MarcFD specifed)?

Thanks
Francois

Last edited by fjhdavid; 26th February 2009 at 18:28.
fjhdavid is offline   Reply With Quote
Old 26th February 2009, 20:15   #6  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
I haven't changed it, though I'm not convinced by my use of awarpsharp. I chose those settings after testing with some critical scenes (i.e. ones where there were some narrow areas of colour which would disappear if it went wrong) but having used it on more content now, I've seen some images where it replaces a "vague" colour or join of colours with the wrong colour. Didee originally proposed applying it to a sharpened luma image to have more edges to warp to, but that made the problem worse for me. YMMV!

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 26th February 2009, 21:33   #7  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
I tested it with DVE essential.
I played the DVD "DVE essential" and recorded it on a DVD recorder with analog wire.
Then I use photoshop to check and magnify pictures.

and I can say that your script produce really good results! I can't send you pictures (they are too big) but DVE essential has special patterns with a lot of colors transitions and your script reduces them by, at least, 70% of the bleeding, and it smooths the colors transitions.

For the wrong colors you talked about, are they exeptional (I think "the wrong" comes from "the sum of two or three colors" from special transition or intersection) but they are not wrong...

oh yes, I forgot, what do you think about MC_spuds filter (except the fact it is really slow)?

(I tested it yesterday for a long time, tweaking parameters, and I am not impressed compare to fft3d filter. In fact fft3dfilter looks more robust and "linear" as sigma increased. If you leave sigma around 1.5-2 for Y and 3 for U,V as Fizick said in the documentation, you have pretty good result yet)

Last edited by fjhdavid; 27th February 2009 at 15:09.
fjhdavid is offline   Reply With Quote
Old 1st March 2009, 23:52   #8  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
Dear B2decided,

With some film (recorded with my dvd recorder) during fast horizontal motion (horizontal panoramic), I can see a green halo at the back of the object which is moving, especially when the object is black and move in front of a white background.

Why the halo is green and not black?

what would you suggest to remove this green halo?

thanks
fjhdavid is offline   Reply With Quote
Old 2nd March 2009, 11:28   #9  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
Hi fjhdavid,

It's not "my script" that's clever - it's mc_spuds (which itself is using lots of powerful functions) and awarpsharp (as suggested by Didee) that's clever. I'll try fft3dfilter one day.

I don't have any suggestions for the problem you describe. Maybe you could start a new thread, post a small sample, and someone might have an idea.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 16th March 2009, 23:54   #10  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
just want to know David:

in your script, is the luma left unchanged (if you exclude the denoiser)?
or is the luma a little bit modified through the awarsharp function?

thanks
Francois

Last edited by fjhdavid; 17th March 2009 at 00:11.
fjhdavid is offline   Reply With Quote
Old 17th March 2009, 11:54   #11  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
Hi,

I believe the only luma processing is the denoise. So without the denoise, the luma is unchanged.

You can check that everything is working as it should:

Add the line "b=last" after the line "assumetff()", and then add the line "subtract(last,b)" right at the end of the script. Drop this into virtual dub, and it'll show you the difference between the input and the output. If you add greyscale() at the end of the modified script, it'll show you the luma difference only, which (if you comment the denoiser out) should be nothing (pure grey = nothing).

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 1st April 2009, 14:50   #12  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
Yes, I can confirm, you get pure grey: mean=127, deviation=0.

It means that the luma is unchanged (except denoising of course).

Thanks, I will use this script as it can't hurt luma!
fjhdavid is offline   Reply With Quote
Old 1st April 2009, 17:32   #13  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
2Bdecided!
Please explain
Quote:
Fix (S-)VHS chroma shift
Vshift=2 # determine experimentally
Hshift=2 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Especialy Vshift.
yup.
yup is offline   Reply With Quote
Old 1st April 2009, 20:10   #14  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
The labels on those two lines are swapped. It should be

PHP Code:
Fix (S-)VHS chroma shift
Vshift
=# 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
Hshift=# determine experimentally 
Vshift: The chroma in PAL VHS drops by one line per field (2 lines per frame) per generation of tape.
Hshift: The chroma on these tapes seems to be shifted by a couple of pixels. This shifts it back.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 3rd April 2009, 00:33   #15  |  Link
Maximus_G
Registered User
 
Maximus_G's Avatar
 
Join Date: Jan 2004
Posts: 55
Quote:
Originally Posted by 2Bdecided View Post
This isn't magic, and the best parts/ideas were taken from other people, but I'm sharing it in case it's any use to someone...
That's a great idea to put it all in one place. Thank you! I've been just looking for such a script and gonna try it right now
And thank you guys for the good comments!
Maximus_G is offline   Reply With Quote
Old 3rd April 2009, 21:27   #16  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
just some additionals infos about how you can use this script:

you can also use it with "analog" recording on DVD. In this case you usually don't need the "shift part" of the script, at least for me, there is no color shift.
2bdecided, is vshift only VHS related?

I also changed the thresh to 0.5 (instead of 0.75) as Marc FD suggest this is the best setting for awarpsharp but maybe 2bdecided could add more about this choice?

and I removed the "original noise back" as I don't have "plastic" look. The plastic look may also come from the "S-VHS resolution lost?" or the denoiser you apply.

But I least for me, results are very good (I suggest you test it on a DVD test with color bar pattern and you will be surprised, even if the script effect is more difficult to see with "real movies")

but don't forget to tell us your results please!!!

PS: 2bdecided, you didn't use the BorderMirror function of Didee as you don't have the color artefacts that aWarpSharp was producing on the outmost frame borders?

Last edited by fjhdavid; 4th April 2009 at 14:49.
fjhdavid is offline   Reply With Quote
Old 4th April 2009, 20:29   #17  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
fjhdavid, I can remember seeing the border artefacts, but don't have them any more. The less aggressive aWarpsharp settings don't produce them (as much / at all). I may have used mirror borders if they were still there - if I wasn't feeling very lazy. I might have done a crop+add borders at the end instead - mostly the artefacts only creep into the already black borders.

I chose those settings by playing with a clip with strong colour transitions and obvious colour bleed, tweaking them until it looked right - i.e. colours stopped where they should. The chroma resolution of (S-)VHS is terrible, and diagonal corners of triangles (for example) never get the right colour whatever you do!

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 5th April 2009, 13:50   #18  |  Link
fjhdavid
Registered User
 
Join Date: Nov 2002
Posts: 220
In fact you mean that your settings are not "sufficiently" aggressive so you don't see the border artefacts?

(I say that, because after 20 films with your settings I am not able to see them...) but I can also see diagonal corners of triangles problem depending of colors combinations; I can only see them from green to magenta transitions with color bar patterns....

Last edited by fjhdavid; 5th April 2009 at 14:27.
fjhdavid is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 07:08.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2020, vBulletin Solutions Inc.