View Single Post
Old 20th January 2014, 15:26   #6  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,695
I was able to make quite a bit of improvement using a variation of the script I posted above. Here is a DV codec version of the result:

"Restored" Version

I did the color correction in Vegas. I am a big fan of using the right tool for the job, and most NLEs have far better ways of correcting color than can be done in AVISynth.

You might want to add, at the end of this script, some sort of standard deblocking filter. I think it might have a chance, using the "restored" version uploaded above as the source, to actually get rid of the blocks.

I looked carefully for detail loss, and didn't see anything significant. If you look at the gauze on the feeding tube in frame 218, I think you'll see that the cross-hatch pattern on the gauze is maintained. Here's a before/after of that frame (this particular frame did not exhibit much blockiness):



If you look at the baby's lower lip, and the areas around the eyes, I think you'll actually see some detail that was obscured by the noise in the original.

One thing I did notice: the speed of this video, even at 25 fps, seems to be way too fast. I didn't see any obvious places where frames were dropped. Was this file processed in any way before uploading?

Here's the variation of the script that I used to create the clip I just uploaded:

Code:
#This is the recommended script for VHS as of April, 2012

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)
#Modify this line to point to your video file
source=AVISource("E:\fs.avi").killaudio().AssumeTFF()
SetMTMode(2)

#Only use chroma restoration for analog source material
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS

#output=MDegrain2i2(chroma,8,0,0)
output=MDegrain2i2(chroma,8,4,0)  #Better, but slower

#stackvertical(source,output)
#stackhorizontal(source,output)
#return output.Levels(16, 1, 235, 0, 255, coring=false)

return output

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

function MDegrain2i2(clip source, int "blksize", int "overlap", int "dct")
{
  Vshift=0 # 2 lines per bobbed-field per tape generation (PAL); original=2; copy=4 etc
  Hshift=0 # determine experimentally 

  overlap=default(overlap,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
  #  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))

  super = fields.MSuper(pel=2, sharp=1)
  backward_vec2 = super.MAnalyse(isb = true, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
  forward_vec2 = super.MAnalyse(isb = false, delta = 2, blksize=blksize, overlap=overlap, dct=dct)
  backward_vec4 = super.MAnalyse(isb = true, delta = 4, blksize=blksize, overlap=overlap, dct=dct)
  forward_vec4 = super.MAnalyse(isb = false, delta = 4, blksize=blksize, overlap=overlap, dct=dct)

  MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) 

  unsharpmask(60,3,0) #not sure whether to put this before or after the weave.

  Weave()
}

Last edited by johnmeyer; 20th January 2014 at 15:29. Reason: Removed first sentence because I realized the blocks in the PNG file were before/after comparisons
johnmeyer is offline   Reply With Quote