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 16th June 2009, 07:29   #1  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
Sharpening VHS capture

Hi folk. Now I try improve quality from VHS capture. VHS tape from camcorder original (no generation copy). Quality very good only grain and white noise. Main idea from videofred thread, difference only that my source interlaced.
script:
Code:
SetMemoryMax(1152)
Loadplugin("MT.dll")
LoadPlugin("warpsharp.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("SSE3Tools.dll")
LoadPlugin("RemoveGrainTSSE3.dll")
LoadPlugin("RemoveGrainSSE3.dll")
LoadPlugin("RepairSSE3.dll")
Import("LimitedSharpenFaster.avsi")
SetMTMode(5)
LSF_sharp_ness=250 LSF_radi_us=3  LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
W=720  H=576
DirectShowSource("my.avi")
SetMTMode(2)
source=AssumeTFF()
noise=source.nnedi2(field=-2)
supernoise = MSuper(noise)
backward_vec1=supernoise.MAnalyse(isb = true, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec1=supernoise.MAnalyse(isb = false, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec2=supernoise.MAnalyse(isb = true, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec2=supernoise.MAnalyse(isb = false, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec3=supernoise.MAnalyse(isb = true, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec3=supernoise.MAnalyse(isb = false, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
noise.MDegrain3(supernoise,backward_vec3,backward_vec2,backward_vec1,forward_vec1,forward_vec2,forward_vec3,thSAD=400,thSADc=400,plane=4)
#HDRAGC()
limitedSharpenFaster(last,smode=3,strength=LSF_sharp_ness,overshoot=50,radius=LSF_radi_us, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
AssumeTFF().SeparateFields().SelectEvery(4,0,3)
StackVertical(SeparateFields(source),last)
#Weave()
I use MDegrain on bobed frames, but with field order (even with even, odd with odd), because sharpening better work on bobed frames.
HDRAGC now give flickering, I will be try AutoLevels.
Any suggestion and advice welcome!
With kind regards yup.
yup is offline   Reply With Quote
Old 16th June 2009, 08:00   #2  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Without sample it's a bit difficult...
LSF doesn't need radius for Smode=3

You can try this to: (instead of MDegrain3)
Code:
noise.MCTemporalDenoise(settings="low",Tovershoot=2,strength=200,chroma=true) ### adjust "settings" to your video, and try with GPU=true (speedup)
LaTo is offline   Reply With Quote
Old 16th June 2009, 08:18   #3  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
LaTo!
It is lecture.
Please:
http://www.sendspace.com/file/7muf54
yup
yup is offline   Reply With Quote
Old 16th June 2009, 08:25   #4  |  Link
scharfis_brain
brainless
 
scharfis_brain's Avatar
 
Join Date: Mar 2003
Location: Germany
Posts: 3,628
you could try tempgauss_mc() as denoiser for your interlaced VHS.
It works pretty well.
__________________
Don't forget the 'c'!

Don't PM me for technical support, please.
scharfis_brain is offline   Reply With Quote
Old 16th June 2009, 10:02   #5  |  Link
LaTo
LaTo INV.
 
LaTo's Avatar
 
Join Date: Jun 2007
Location: France
Posts: 701
Replace MDegrain3 & LSF by this:
Code:
MCTemporaldenoise(settings="high",chroma=true,strength=300,Tovershoot=7,flat=true,AGstr=4,bias=128)





Some strong halos are present in the source, you should remove these before MCTemporalDenoise because they are over-enhanced by sharpening.
Try Dehalo_alpha before or others scripts in the forum.
LaTo is offline   Reply With Quote
Old 16th June 2009, 11:39   #6  |  Link
2Bdecided
Registered User
 
Join Date: Dec 2002
Location: Yorkshire, UK
Posts: 1,673
Be careful not to make it look like plastic / cartoon. The noise hides the low resolution a little - and you can't add more resolution!

It's not really a "difficult" source.

Cheers,
David.
2Bdecided is offline   Reply With Quote
Old 17th June 2009, 07:59   #7  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
for all!
@ LaTo my target PAL DVD 720x576 25Hz interlaced.
@ scharfis_brain if i right understandt You suggest:
Code:
tempgauss_mc()
limitedSharpenFaster(last,smode=3,strength=LSF_sharp_ness,overshoot=50, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
AssumeTFF().SeparateFields().SelectEvery(4,0,3)
Weave()
May be before reinterlace use vertical blur filter (Unfilter)?
@ 2Bdecided You do not see chroma shift?
yup.
yup is offline   Reply With Quote
Old 17th June 2009, 09:38   #8  |  Link
R3Z
Silver Über Alles
 
R3Z's Avatar
 
Join Date: Aug 2006
Location: Australia
Posts: 269
EDIT: Best to ignore this post, error in script.

Heres another angle, remove some noise, sharpen then re-add some noise to give it a non custard/oil painting look;

http://www.users.on.net/~inet_s51/doom9/test.jpg


Mdegrain2 seems to get rid of most noise and the chroma problem. The detail based grain function just adds some grain based on the detail levels.

Just a suggestion, we all like different things !

Last edited by R3Z; 18th June 2009 at 08:21.
R3Z is offline   Reply With Quote
Old 17th June 2009, 10:26   #9  |  Link
Terka
Registered User
 
Join Date: Jan 2005
Location: cz
Posts: 677
you can try remove the yellow areas using
Camcorder color denoise, see http://acobw.narod.ru/
so the script can be like:
Quote:
LoadVirtualDubPlugin ("c:\Program Files\AviSynth\plugins\ccd.vdf", "ccd",0)
clp=avisource("c:\hj\kamera\avisynth\psi\!Psi.avi")
clp.ConvertToRGB32(interlaced=true)
ccdamount=49 #try different settings
ccd=last.ccd(ccdamount,1).ccd(ccdamount,1).ConvertToYV12()
Terka is offline   Reply With Quote
Old 17th June 2009, 11:59   #10  |  Link
videoFred
Registered User
 
videoFred's Avatar
 
Join Date: Dec 2004
Location: Gent, Flanders, Belgium, Europe, Earth, Milky Way,Universe
Posts: 663
Quote:
Originally Posted by R3Z View Post
Heres another angle, remove some noise, sharpen then re-add some noise to give it a non custard/oil painting look;
Your example looks very good, not so 'plastic' at all. I will have a closer look at your 'detailbasedgrain' function.



Fred.
__________________
About 8mm film:
http://www.super-8.be
Film Transfer Tutorial and example clips:
https://www.youtube.com/watch?v=W4QBsWXKuV8
More Example clips:
http://www.vimeo.com/user678523/videos/sort:newest
videoFred is offline   Reply With Quote
Old 17th June 2009, 13:24   #11  |  Link
Didée
Registered User
 
Join Date: Apr 2002
Location: Germany
Posts: 5,394
The result shown by R3Z looks quite good. However, the DetailBasedGrain function looks really fishy! See:

Code:
function DetailBasedGrain(clip source, int "BM", int "dmin", int "dmax", int "grain_str", float "blur_str1",float "blur_str2", float "sharp_str") 
{
	bm=default(bm,"noise")                   	# BlockBuster Method
	dmin=default(dmin,1)              		        # Blockbuster Detail Min
	dmax=default(dmax,15)				        # Blockbuster Detail Max
	grain_str=default(grain_str,2)        	    # Grain strength
	blur_str1=default(blur_str1,1.5)          	# Blur Strength
	blur_str2=default(blur_str2,0.75)          	# Blur Strength   
	sharp_str=default(sharp_str,1)          	# Sharpen Strength      
    
	grain_dist = source.BlockBuster(method=bm,detail_min=dmin,detail_max=dmax,variance=grain_str)
	difference = mt_makediff(source, grain_dist, U=1, V=1)
	grain_pro = difference.Blur(blur_str1).Blur(blur_str2).Sharpen(sharp_str)
	mt_makediff(source,grain_pro,U=2,V=2)
	grain_dist.addgrain(12,0,0).Blur(1)

	return last
}
Note that the greyed lines have no effect at all - their output is not used to build the function's output. Hence, what the function does is

source
Blockbuster()
addgrain()
blur(1)

i.e.
take source, let Blockbuster add noise to flat areas, let addgrain add noise everywhere, and finally blur *everything* (including the original underlying content!)

Is that really the intended operation?


Oh, and ... the "BM" parameter is declared as integer variable, but it's supposed to be a string variable - see default(bm).
__________________
- We´re at the beginning of the end of mankind´s childhood -

My little flickr gallery. (Yes indeed, I do have hobbies other than digital video!)
Didée is offline   Reply With Quote
Old 18th June 2009, 03:23   #12  |  Link
R3Z
Silver Über Alles
 
R3Z's Avatar
 
Join Date: Aug 2006
Location: Australia
Posts: 269
Quote:
Originally Posted by Didée View Post
The result shown by R3Z looks quite good. However, the DetailBasedGrain function looks really fishy! See:

i.e.
take source, let Blockbuster add noise to flat areas, let addgrain add noise everywhere, and finally blur *everything* (including the original underlying content!)

Is that really the intended operation?


Oh, and ... the "BM" parameter is declared as integer variable, but it's supposed to be a string variable - see default(bm).


Its supposed to blur the grain added by blockbuster and then add some extra grain ontop after this to help blend in the added grain.

I asked around a bit for help on how to do that and after making the function I had no comments until now !

Edit: I see whats wrong, i am making a few changes and we will see if i have learnt anything.

Last edited by R3Z; 18th June 2009 at 03:55.
R3Z is offline   Reply With Quote
Old 18th June 2009, 06:37   #13  |  Link
yup
Registered User
 
Join Date: Feb 2003
Location: Russia, Moscow
Posts: 854
I try three scripts:
first,fields ordering on bobed frames
Code:
SetMemoryMax(1152)
Loadplugin("MT.dll")
LoadPlugin("warpsharp.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("SSE3Tools.dll")
LoadPlugin("RemoveGrainTSSE3.dll")
LoadPlugin("RemoveGrainSSE3.dll")
LoadPlugin("RepairSSE3.dll")
Import("LimitedSharpenFaster.avsi")
SetMTMode(5)
LSF_sharp_ness=250 LSF_radi_us=3  LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
W=720  H=576
DirectShowSource("tape1.avi")
SetMTMode(2)
source=AssumeTFF()
noise=source.nnedi2(field=-2)
supernoise = MSuper(noise)
backward_vec1=supernoise.MAnalyse(isb = true, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec1=supernoise.MAnalyse(isb = false, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec2=supernoise.MAnalyse(isb = true, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec2=supernoise.MAnalyse(isb = false, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec3=supernoise.MAnalyse(isb = true, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec3=supernoise.MAnalyse(isb = false, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
noise.MDegrain3(supernoise,backward_vec3,backward_vec2,backward_vec1,forward_vec1,forward_vec2,forward_vec3,thSAD=400,thSADc=400,plane=4)
limitedSharpenFaster(last,smode=3,strength=LSF_sharp_ness,overshoot=50, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
AssumeTFF().SeparateFields().SelectEvery(4,0,3)
Weave()
second on fields
Code:
SetMemoryMax(1152)
Loadplugin("MT.dll")
LoadPlugin("warpsharp.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("SSE3Tools.dll")
LoadPlugin("RemoveGrainTSSE3.dll")
LoadPlugin("RemoveGrainSSE3.dll")
LoadPlugin("RepairSSE3.dll")
Import("LimitedSharpenFaster.avsi")
SetMTMode(5)
LSF_sharp_ness=250 LSF_radi_us=3  LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
W=720  H=576
DirectShowSource("tape1.avi")
SetMTMode(2)
source=AssumeTFF()
noise=source.SeparateFields()
supernoise = MSuper(noise)
backward_vec1=supernoise.MAnalyse(isb = true, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec1=supernoise.MAnalyse(isb = false, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec2=supernoise.MAnalyse(isb = true, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec2=supernoise.MAnalyse(isb = false, delta = 4,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec3=supernoise.MAnalyse(isb = true, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec3=supernoise.MAnalyse(isb = false, delta = 6,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
noise.MDegrain3(supernoise,backward_vec3,backward_vec2,backward_vec1,forward_vec1,forward_vec2,forward_vec3,thSAD=400,thSADc=400,plane=4)
weave.nnedi2(field=-2)
limitedSharpenFaster(last,smode=3,strength=LSF_sharp_ness,overshoot=50, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
AssumeTFF().SeparateFields().SelectEvery(4,0,3)
Weave()
third on bobed frames
Code:
SetMemoryMax(1152)
Loadplugin("MT.dll")
LoadPlugin("warpsharp.dll")
LoadPlugin("mt_masktools-25.dll")
LoadPlugin("SSE3Tools.dll")
LoadPlugin("RemoveGrainTSSE3.dll")
LoadPlugin("RemoveGrainSSE3.dll")
LoadPlugin("RepairSSE3.dll")
Import("LimitedSharpenFaster.avsi")
SetMTMode(5)
LSF_sharp_ness=250 LSF_radi_us=3  LSF_sub=1.5 #first sharpening parameters (LimitedSharpenFaster) sub=subsampling
W=720  H=576
DirectShowSource("tape1.avi")
SetMTMode(2)
source=AssumeTFF()
noise=source.nnedi2(field=-2)
supernoise = MSuper(noise)
backward_vec1=supernoise.MAnalyse(isb = true, delta = 1,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec1=supernoise.MAnalyse(isb = false, delta = 1,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec2=supernoise.MAnalyse(isb = true, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec2=supernoise.MAnalyse(isb = false, delta = 2,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
backward_vec3=supernoise.MAnalyse(isb = true, delta = 3,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
forward_vec3=supernoise.MAnalyse(isb = false, delta = 3,blksize=8, overlap=4,dct=0, chroma=true, badSAD=1000)
noise.MDegrain3(supernoise,backward_vec3,backward_vec2,backward_vec1,forward_vec1,forward_vec2,forward_vec3,thSAD=400,thSADc=400,plane=4)
limitedSharpenFaster(last,smode=3,strength=LSF_sharp_ness,overshoot=50, ss_X=LSF_sub, SS_Y=LSF_sub, dest_x=W,dest_y=H)
AssumeTFF().SeparateFields().SelectEvery(4,0,3)
Weave()
All give relatively good result comparing to source.
I think tat first script work better than other espicialy on static background. Also speak me that I need make before reinterlacing (or nothing)?
Please explain.
yup.
yup is offline   Reply With Quote
Old 18th June 2009, 08:10   #14  |  Link
R3Z
Silver Über Alles
 
R3Z's Avatar
 
Join Date: Aug 2006
Location: Australia
Posts: 269
Hopefully this is right, at least it looks that way when comparing frames between each stage of filtering (using subtract);



Code:
AVISOURCE(....

Bob(0,0.75)

bobbed= last
src = last

super = src.MSuper()
bvec2 = super.MAnalyse(isb=true, delta=2, overlap=8,blksize=16)
bvec1 = super.MAnalyse(isb=true, delta=1, overlap=8,blksize=16)
fvec1 = super.MAnalyse(isb=false, delta=1, overlap=8,blksize=16)
fvec2 = super.MAnalyse(isb=false, delta=2, overlap=8,blksize=16)

src.MDegrain2(super, bvec1, fvec1, bvec2, fvec2)

LimitedSharpenFaster(last,smode=4,strength=180,overshoot=50,soft=30)

comp=last

function DetailBasedGrain(clip src, string "BM", int "dmin", int "dmax", int "grain_str", float "blur_str1",float "blur_str2", float "sharp_str") 
{
	bm=default(bm,"noise")                   	# BlockBuster Method
	dmin=default(dmin,1)              		        # Blockbuster Detail Min
	dmax=default(dmax,15)				        # Blockbuster Detail Max
	grain_str=default(grain_str,2)        	    # Grain strength
	blur_str1=default(blur_str1,1.5)          	# Blur Strength
	blur_str2=default(blur_str2,0.75)          	# Blur Strength   
	sharp_str=default(sharp_str,1)          	# Sharpen Strength      
    
	grain_dist = src.BlockBuster(method=bm,detail_min=dmin,detail_max=dmax,variance=grain_str)
	difference = mt_makediff(src, grain_dist, U=1, V=1)
	grain_blur = difference.Blur(blur_str1).Blur(blur_str2).Sharpen(sharp_str)
	difference2=mt_makediff(src,grain_blur,U=2,V=2)
    
    Blank=BlankClip(width=src.width(), height=src.height(),pixel_type="YV12").ColorYUV(off_y=-128)
    PP_Grain=Blank.Addgrain(3,0.2,0.4).Blur(.8)
    PP=Overlay(Difference2,PP_Grain,mode="subtract")
	
	return PP
}
	
DetailBasedGrain(dmax=23,grain_str=12,blur_str2=1.5,blur_str1=1, sharp_str=0.9)

substrong = Subtract(comp,last).Levels(127, 1, 129, 0, 255)

StackHorizontal(src.subtitle("original"),last.subtitle("processed"),substrong.subtitle("amp dif"))
If anyone could help out, i would like to make the second addgrain and blur an option, kind of like an if then else statement. Not sure how to do it yet !
R3Z 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 16:25.


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