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 15th April 2011, 14:08   #1  |  Link
greatmagician
Registered User
 
Join Date: Mar 2009
Posts: 23
help to fix this video

hello .. i hop i will get help to fix this video

i tray alot of filters but nothing change

the problem in the color

and the noise even the noise have color ???

look to this pic






what i can do to get the best result ??
greatmagician is offline   Reply With Quote
Old 15th April 2011, 14:37   #2  |  Link
Ghitulescu
Registered User
 
Ghitulescu's Avatar
 
Join Date: Mar 2009
Location: Germany
Posts: 5,769
It looks like a SAT show recorded on a VHS, which tape was later on captured directly in MPEG-2 with a very low bitrate. Or the show itself originated from a VHS tape but still sent on-air with a low bitrate.
There are chroma-shift, cross-chroma, wrong levels and many more on the analog side, blockiness, wrong DAR, on the digital one.

Free feel to address each issue with its corresponding filter.
__________________
Born in the USB (not USA)
Ghitulescu is offline   Reply With Quote
Old 15th April 2011, 15:52   #3  |  Link
greatmagician
Registered User
 
Join Date: Mar 2009
Posts: 23
this is sample video

http://www.mediafire.com/?ot8h026bq6q6vo7
greatmagician is offline   Reply With Quote
Old 15th April 2011, 19:20   #4  |  Link
jmac698
Registered User
 
Join Date: Jan 2006
Posts: 1,867
You could try derainbow
http://avisynth.org/oldwiki/index.php?page=mfRainbow
This would fix the strokes of wrong colors (red, purple, green, blue).
jmac698 is offline   Reply With Quote
Old 15th April 2011, 23:31   #5  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
CNR handles chroma problems in VHS, but this clip has other issues too.

I have a script I use as a starting point for clips like this. You will have to adapt it to your use. I used it, without modification, and created this:

Better Clip

Not exactly a work of art, but better than the original.

The following script can be made about 4x faster (on an 8-core CPU) using SetMTMode statements before/after the AVISource statement.

Code:
#Denoiser script for interlaced video using MDegrain2 (will work on progressive as well)

SetMemoryMax(768)

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

#Modify this line to point to your video file
source=AVISource("E:\frameserver.avi").killaudio()

#VHS chroma settings can sometimes cause smear. Skip CNR2 if not needed.
chroma=source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
#chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,false) #Laserdisc 

#Use 4 instead of 8 in line below for better quality in shadows
output=MDegrain2i2(chroma,8,0,0)
#stackhorizontal(source,output)
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 -- works really well

fields=source.SeparateFields() # separate by fields

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. Remove if sharpening degrades video
Weave()
}
johnmeyer is offline   Reply With Quote
Old 24th November 2014, 19:19   #6  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
I am trying with an older script provided by johnmeyer in this thread (on 16.04.2011). I intend to restore some VHS material (captured via a TBC and an BMD Intensity pro Capture Card). Basically I am searching for a good script method to restore my VHS and Video8 tapes.

Unfortunatly I can't the script get working. I am always getting an error: "Cnr2: YV12 colorspace only", although I have put "converttoyv12" in the script.
I think I have some mistakes in my script. Could anybody help me with that:

Code:
SetMemoryMax(1024)

#Modify this line to point to your video file
source= AVISource("C:\intensitytest8mm.avi").killaudio()
ConvertToYV12(source)
#VHS chroma settings can sometimes cause smear. Skip CNR2 if not needed.
chroma= source.Cnr2("oxx",8,16,191,100,255,32,255,false) #VHS
#chroma=source.Cnr2("oxx",8,14,191,75,255,20,255,false) #Laserdisc 

#Use 4 instead of 8 in line below for better quality in shadows
output=MDegrain2i2(chroma,8,0,0)
#stackhorizontal(source,output)
return output
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore

Last edited by papcom; 24th November 2014 at 19:27.
papcom is offline   Reply With Quote
Old 24th November 2014, 20:19   #7  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Code:
f = "C:\intensitytest8mm.avi"

SetMemoryMax(1024)
AVISource(f, audio=false, pixel_type="YV12")
chroma = CNR2("oxx", 8, 16, 191, 100, 255, 32, 255, false)
MDegrain2i2(chroma, 8, 0, 0)
creaothceann is offline   Reply With Quote
Old 24th November 2014, 22:03   #8  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
thank You for Your code: I inserted it, and now I have the following coming up:

AVISource: the Video decompressor couldn't produce YV12 Output.

Code:
f = "C:\intensitytest8mm.avi"

SetMemoryMax(1024)
AVISource(f, audio=false, pixel_type="YV12")
chroma = CNR2("oxx", 8, 16, 191, 100, 255, 32, 255, false)
MDegrain2i2(chroma, 8, 0, 0) 

#Use 4 instead of 8 in line below for better quality in shadows
#~ output=MDegrain2i2(chroma,8,0,0)
#stackhorizontal(source,output)
return output
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore
papcom is offline   Reply With Quote
Old 24th November 2014, 22:06   #9  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
Oh well, use

Code:
AVISource(f, audio=false).ConvertToYV12
then.
creaothceann is offline   Reply With Quote
Old 24th November 2014, 22:51   #10  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
thanks @creaothceann, it' s working now.

I would like to insert the following autolevel code into the script /whole script of @johnmeyer see some Posts before).
==Where should this code snippet be at its best Position?

Code:
AutoAdjust(auto_balance=true, auto_gain=true, dark_limit=1.50, bright_limit=1.50, gamma_limit=1.25)
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore

Last edited by papcom; 24th November 2014 at 23:09.
papcom is offline   Reply With Quote
Old 24th November 2014, 23:47   #11  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
BTW, I just posted a variation of this script in another forum, and as part of that, provide a "before/after" of some really lousy LP (6-hour mode) VHS tape that was captured without a TBC. Make sure to view this full screen, and after going to full screen, set the resolution to 1080p. I up-res'd the video to make sure that YouTube didn't fuzz it up too much, and you really can see more of the awful stuff in the before image if you set the resolution to HD. Here is the link:

https://www.youtube.com/watch?v=7a9KSQvDZlw

Last edited by johnmeyer; 24th November 2014 at 23:49. Reason: Added suggestion to view full screen
johnmeyer is offline   Reply With Quote
Old 24th November 2014, 23:54   #12  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
@johnmeyer - really impressive - Is this the same script You posted in this thread? ...or did You implement modifications? BTW -- where can I find Your Variation?
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore
papcom is offline   Reply With Quote
Old 25th November 2014, 00:05   #13  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by papcom View Post
@johnmeyer - really impressive - Is this the same script You posted in this thread? ...or did You implement modifications? BTW -- where can I find Your Variation?
You don't have to look for my variation: it is virtually identical to what I already posted above. However, here it is again, with the exact settings used on the video I linked to above:
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")
Import("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\LimitedSharpenFaster.avs")

SetMTMode(5,6)
#Modify this line to point to your video file
source=AVISource("E:\fs.avi").killaudio().AssumeBFF()
SetMTMode(2)

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

#Set overlap in line below to 0, 2, 4, 8. Higher number=better, but slower
#For VHS, 4,0 seems to work better than 8,2. Most of difference is in shadows
output=MDegrain2i2(chroma,8,0,0)
#output=MDegrain2i2(chroma,8,4,0)  #Retains a little more detail, but slower
#output=MDegrain2i2(chroma,4,2,0)  #Better for retaining detail on flat surfaces, but slower still

stackhorizontal(source,output)

#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 optional line gets rid of chroma halo, a problem with 2nd gen tapes
  #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 (an uncommon problem)
  #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)

  #Increase thSAD for more degraining
  MDegrain2(fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) 

  #Optional sharpening steps
  #unsharpmask(50,3,0)
  #sharpen(0.1)

  Weave()
}
johnmeyer is offline   Reply With Quote
Old 25th November 2014, 00:13   #14  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
wow - thank You @johnmeyer, that's very kind- I will try this code with a bad VHS source. I couldn't find the limitedsharpenfaster.avs in my Folder of Your film scripts and plugins. Where could I get it from?
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore
papcom is offline   Reply With Quote
Old 25th November 2014, 00:28   #15  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Quote:
Originally Posted by papcom View Post
wow - thank You @johnmeyer, that's very kind- I will try this code with a bad VHS source. I couldn't find the limitedsharpenfaster.avs in my Folder of Your film scripts and plugins. Where could I get it from?
You don't need it. You'll see that it is not actually used in the script (I forgot to comment out the import line). I also commented out the other sharpening lines. Do everything without sharpening, and only after you like the result should you attempt to add any sharpening. Be especially careful to look for halos when you add sharpening. With low-res VHS material, it doesn't take much sharpening to end up creating some really bad haloing.

Last edited by johnmeyer; 25th November 2014 at 00:29. Reason: Added statement about forgetting to comment out the import line.
johnmeyer is offline   Reply With Quote
Old 25th November 2014, 01:13   #16  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
OK - I understand - What exactely do I do with the Cnr2? ...it requires YV12 explicitly, and gives an error as it is now. Where to put the "ConverttoYV12" in Your script?
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore
papcom is offline   Reply With Quote
Old 25th November 2014, 02:52   #17  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Just skip the CNR. It is only useful if you have a lot of chroma noise, and MDegrain2 actually gets rid of much of it.
johnmeyer is offline   Reply With Quote
Old 25th November 2014, 09:45   #18  |  Link
papcom
Registered User
 
Join Date: Feb 2002
Location: Southwest Germany
Posts: 169
thanks for Your tipp, in the meantime I found out where to insert "converttoyv12"

In order to correct Color and Levels I would like to insert Lato's "auto-adjust" line into your script.
Where would you suggest should I put the following code snippet?


Code:
AutoAdjust(auto_balance=true, auto_gain=true, dark_limit=1.50, bright_limit=1.50, gamma_limit=1.25)
__________________
Lenovo Intel i7Quad/WIN8 - Virtual Dub 1.10.4/Avisinth 2.6MT- MacMini I7 QuadCore
papcom is offline   Reply With Quote
Old 25th November 2014, 16:55   #19  |  Link
creaothceann
Registered User
 
Join Date: Jul 2010
Location: Germany
Posts: 357
You should read the documentation, it's really not hard to understand.
creaothceann is offline   Reply With Quote
Old 25th November 2014, 17:18   #20  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,691
Auto adjusting levels doesn't work very well, IMHO. Good color and gamma correction requires scopes and an NLE. I do mine in Vegas. If you really want to use an auto correct, then just stick it in pretty much anywhere. Try it at the end of the filter chain.
johnmeyer 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 11:46.


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