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 18th August 2016, 12:41   #1  |  Link
Marcoh_
Registered User
 
Join Date: Jul 2016
Posts: 2
Dealing with a big amount of VHS noise

Hey everyone,
I was dealing with an old VHS transfer, which suffered from various typical old VHS issues (rainbows, dot crawl....) and a very big amount of noise.
I managed to reduce the first issues to the minimum using Cnr2 and cc. What 'worried' me more is the big annoying noise. Can anybody do some tests and suggest me something that can remove (most of) the noise losing as less detail as possible? I'll post a 2 mins vob sample.

Thanks in advance

Vob sample: https://mega.nz/#!ApITSLpY!VQWNVFCAL...brLQrjovArhxv0
Marcoh_ is offline   Reply With Quote
Old 18th August 2016, 13:14   #2  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
when the noise is gone you'll find out just how little detail was there to begin with.

that's just a little warning

otherwise it's relatively easy to denoise with mvdegrain sorts of things.
__________________
sucking the life out of your videos since 2004
Mug Funky is offline   Reply With Quote
Old 18th August 2016, 19:49   #3  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,167
I think that any of the dozens of scripts posted in dozens of threads about VHS denoising will probably give you a pretty good result. Here is one such script. I tested it on your clip, and the results looked better and, just as importantly, didn't look worse. One issue with any denoising is that you can sometimes introduce problems that are worse than what you remove. Even if you don't do that, many denoising scripts remove so much good stuff that the result looks artificial.

I usually use the interleaved result when checking whether I like the results of the script. You can zoom way in, so you can see lots of detail, and then "rock back and forth" in Virtualdub (or whatever you use to view your scripts) between the original frame and the denoised frame. You can then let your eye pick out any problems you created. The biggest downside to this denoising approach is that it sometimes removes subtle really large details, like the contours on an asphalt road. However, it does a really good job on finer details, like hair, buttons, jewelry, etc.

Code:
#Denoiser script for interlaced video using MDegrain2

SetMemoryMax(768)

Loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll")
LoadPlugin("c:\Program Files\AviSynth 2.5\plugins\CNR\Cnr2.dll")

SetMTMode(5,6)
source=AVISource("E:\fs.avi").killaudio().AssumeTFF().ConvertToYV12()
SetMTMode(2)

chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS

output=MDegrain2i2(chroma,8,4,400,0)  #Needs higher denoising parameter than script w/o MRecalculate

return output

#Uncomment this block and use instead of "return output" in order to 
#compare original frame with denoised result, one frame after another
/*
return Interleave(
\    source
\  , output
\ )
*/

#stackvertical(source,output)


#-------------------------------

function MDegrain2i2(clip source, int "blocksize", int "over", int "denoising_strength", int "dct")
{
  Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
  Hshift=0 # determine experimentally 
  overlap=default(over,0) # overlap value (0 to 4 for blksize=8)
  dct=default(dct,0) # use dct=1 for clip with light flicker

  fields=source.SeparateFields() # separate by fields

  #This line gets rid of vertical chroma halo - use for VHS 2nd generation
  #fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift))

  #This line will shift chroma down and to the right instead of up and to the left
  #fields=MergeChroma(fields,Crop(AddBorders(fields,Hshift,Vshift,0,0),0,0,-Hshift,-Vshift))

  prefiltered = RemoveGrain(fields,2)
  superfilt =   MSuper(prefiltered, hpad=32, vpad=32,pel=2)
  super=        MSuper(fields,      hpad=32, vpad=32,pel=2)

  halfblksize= (blocksize>4)   ? blocksize/2 : 4
  halfoverlap= (over>2)        ? over/2      : 2

  bvec1 =  MAnalyse(superfilt, isb = true,  delta = 2, blksize=blocksize, overlap=over,dct=dct)
  bvec1 =  MRecalculate(super, bvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100) 

  fvec1 =  MAnalyse(super, isb = false, delta = 2, blksize=blocksize, overlap=over,dct=dct)
  fvec1 =  MRecalculate(super, fvec1, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

  bvec2 =  MAnalyse(super, isb = true,  delta = 4, blksize=blocksize, overlap=over,dct=dct)
  bvec2 =  MRecalculate(super, bvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

  fvec2 =  MAnalyse(super, isb = false, delta = 4, blksize=blocksize, overlap=over,dct=dct)
  fvec2 =  MRecalculate(super, fvec2, blksize=halfblksize, overlap=halfoverlap,thSAD=100)

  denoised = fields.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength)


#Remove block comment delimeters to add sharpening
/*
  #Unsharpmask sharpening
  even=selecteven(denoised)
  odd= selectodd (denoised)
  #denoised = interleave( unsharpmask(even,30,3,4), unsharpmask(odd,30,3,4) )

  #The following seems to be a better sharpener for VHS
  denoised = interleave( UnsharpHQ(even,THRESHOLD=20, SHARPSTR=4.0, SMOOTH=0.5, 
  \ SHOW=false), UnsharpHQ(odd,THRESHOLD=20, SHARPSTR=4.0, SMOOTH=0.5, SHOW=false) )
*/

  #Use these two lines if there is more noise in one field than the other
  #denoised_s = fields.MDegrain2(super, bvec1,fvec1,bvec2,fvec2,thSAD=denoising_strength*3)
  #Weave (interleave (denoised.selecteven (), denoised_s.selectodd ()))

  Weave(denoised)
}
johnmeyer is offline   Reply With Quote
Old 18th August 2016, 22:10   #4  |  Link
Marcoh_
Registered User
 
Join Date: Jul 2016
Posts: 2
Thanks a lot, although I stupidly forgot to mention that in my script my idea was to deinterlace the footage through QTGMC, in order to get a 50fps progressive video. Is your script applicable also to progressive footage? If yes, would you be so kind to provide the 'new' function? Thanks a lot again.
Marcoh_ is offline   Reply With Quote
Old 18th August 2016, 22:49   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,167
Why do you feel you need to deinterlace? You asked the wrong guy, because I'm the one who always advises against it. You do understand that deinterlacing irrevocably degrades your video, and that you cannot get back the details lost in the process? Much better to let the deinterlacer in your TV or playback software/hardware handle the process.

Most scripts that deal with interlaced video would be easier to re-do than this one. This one handles interlaced footage via the delta=2 and delta=4 settings in the motion compensation code. This is done after separating into fields, and is a slightly clever way to get the even and odd fields.

If you really and truly feel you need to use this on deinterlaced footage, probably the simplest way to get what you want is to just use the MDegrain code from the MVTools2 documentation, and use that in place of the MDegrain2i2 function.

My recommendation, however, is to skip using QTGMC and simply use the script as is and keep your video interlaced.
johnmeyer is offline   Reply With Quote
Old 18th August 2016, 23:08   #6  |  Link
Mug Funky
interlace this!
 
Mug Funky's Avatar
 
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,547
Bumping up to 50p isn't such a bad idea. The alternative is relying on the deinterlace in the playback device which will be worse than qtgmc.
__________________
sucking the life out of your videos since 2004
Mug Funky 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 19:48.


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