Hello,
I got an old VHS, and I would like to know if there is anything possible to enhance it's quality.
The problem is the following: The edges are blurred. They appear to be doubled as if there was to pictures on over the other. You'll see what I mean with this picture:
![]()
Is there anything I can do to fix this problem?
Thank you in advance for any advices.
+ Reply to Thread
Results 1 to 30 of 51
-
-
You have interlaced video. Each frame contains two half images, called fields, intended to be viewed one field at a time. If you're making a DVD this doesn't need to be "fixed", it's normal for video. DVD players and TVs will display it properly. But the sample frame you posted indicates the video was mishandled somewhere and the two fields are no longer completely separate. There is no way to fix this. Maybe this mishandling was in your preparation of the samples, not in the source? Post a short sample of the source in its native format.
Your video also shows signs of severe over sharpening (halos). Typical of multigeneration VHS recordings. If this is a first generation recording the over sharpening could come from your VHS deck, capture card, or any other filtering you're doing. Disable any sharpening filters you can. If you can't you can use a Blur(x,y) filter in AviSynth. There are also Dehalo() filters that may help.Last edited by jagabo; 21st Apr 2010 at 06:39.
-
What do you mean by "the two fields are no longer completely separate"?
I also posted the two separate fields and there is the same problem on each field... edges doubled.
What is "over sharpening"? -
Before explaining sharpening it helps to understand how to blur an image. Suppose you have a line of pixels (let's use grayscale so we can show each pixel as a single number, its intensity):
50 50 50 50 100 100 100 100
That represents a sharp transition from dark (50) to light (100). Blurring an image is basically the "leaking" of light from nearby pixels. You can simulate this by making each pixel the average of itself and the two pixels at its side. Assuming the pixels just outside the edge of this frame are the same as the pixels at the edges (ie, there is another 50 to the left and another 100 to the right):
[(50+50+50)/3] [(50+50+50)/3] [(50+50+50)/3] [(50+50+100)/3] [(50+100+100)/3] [(100+100+100)/3] [(100+100+100)/3] [(100+100+100)/3]
50 50 50 67 83 100 100 100
Now, instead of a sharp transition from 50 to 100 you have a blurry edge that rises from 50 to 67 to 83 then finally 100.
Sharpening an image can be performed by reversing this process. Instead of adding the light from nearby pixels you subtract light from nearby pixels. Normally this would be done by weighting the pixels but lets use weights of 100 percent to simplify our math:
[-50+50*3-50] [-50+50*3-67] [-50+67*3-83] [-67+83*3-100] [-83+100*3-100] [-100+100*3-100]
50 33 68 82 117 100
As you can see, instead of having a simple sharp transition from 50 to 100, to the left of the edge there is now a dark halo (33) and at the right of the edge there is a bright halo (117). We over sharpened the image. If you sharpen again you'll get even brighter/darker halos. If you continue sharpening you'll eventually get halos around the halos.
Here's what it looks like visually at 32x enlargement (each 32x32 block of pixels represents one pixel of the source):
The first line is the original sharp edge. The second line is that sharp edge blurred. The third line is that blurred edge slightly over sharpened. The fourth line is the over sharpened image sharpened again. -
Regarding the interlacing issue:
An interlaced frame contains two separate half images. Here's a 4x enlargement of a portion of a frame where one field is green, the other field red:
That is easily separated into the two fields by taking every other line of the frame, first the even numbered scanlines, then the odd numbered scanlines:
If you were to watch that video on an interlaced TV that is exactly what you would see. First the green field (with blank lines in between) then a red field (with black lines in between). In practice the electron beam is not so highly focused so that you can really see those black lines. And they are flashing past at 60 fields per second so you wouldn't perceive them as separate images anyway.
Now let's resize that interlaced image with a simply bilinear filter:
The two fields have become intermixed. Now when we display one field at a time we see this:
You have to be careful when handling interlaced video. Once you have disturbed the integrity of the two fields there is no way to fixing them. -
Thank you very much for this explanation. It's much more clear now.
So, if I understand correctly, it should be possible to correct this by blurring the image:
50 33 68 82 117 100
[(50+33+68)/3] [(33+68+82)/3] [(68+82+117)/3] [(82+117+100)/3]
50 50.33 61 89 99.67 100
But I'll get something like this:
http://forum.doom9.org/showthread.php?p=738444#post751380
don't know if it's better...
I didn't find the dehalo() function. I just found dehalo_alpha here : http://avisynth.org/mediawiki/DeHalo_alpha
I also had a look at some .avs script like this one: http://forum.doom9.org/showthread.php?p=803275
but there are always missing functions when I try to execute the script and I cannot find all the dll required.. -
I just saw you answer about interlacing issue
How did you notice this problem in the picture I posted? The bad lines at the top? -
This is more than just an interlacing issue, and it cannot be remedied. The "ghost" outlines around the edges of your subject are the result of multi-generation VHS-to-VHS dubbing. You could try deinterlacing until the cows came home and it still would not help.
-
The Dehalo Alpha you found tells you it requires the MaskTools and Degrain packages. You have to download and install them too. A little googling should find them. One good place to start is here:
http://avisynth.org/warpenterprises/
The sample image you posted was very badly degraded but the side-by-side separated fields showed the artifacts one would expect from contaminated fields (some combing still left in the separated frames).
Regarding multigenerational VHS copying:
VHS tape is an inherently low resolution (horizontally) format. VHS decks try to compensate for this by applying a sharpening filter during playback. Over sharpening once doesn't hurt too much. But when you copy a VHS tape onto another VHS tape you get another generation of over sharpening. Each time you repeat this you get more over sharpening.
Another issue is the scale of the halo. A wide halo requires a wide de-halo algorithm. Your halos are at least two pixels wide. You may get better results by reducing the frame size by half horizontally before applying any dehalo filters. Note that VHS's horizontal resolution is in the 350 pixel range so working at 360x480 or 352x480 is closer to the source's true resolution, and closer to the resolution of the halo artifacts.Last edited by jagabo; 21st Apr 2010 at 08:44.
-
Yes I added these library but I still miss the Prewitt() function.
And I also get this error: integrity overflow (line 37)
with this script:
Code:ImageSource("dallas1.bmp") BlindDeHalo3( rx=3.0, ry=3.0, strength=125, \ lodamp=0.0, hidamp=0.0, sharpness=0.0, tweaker=0.0, \ PPmode=0, PPlimit=0, interlaced=false) function BlindDeHalo3( clip clp, float "rx", float "ry", int "strength", \ float "lodamp", float "hidamp", float "sharpness", float "tweaker", \ int "PPmode", int "PPlimit", bool "interlaced") { rx = default( rx, 3.0 ) ry = default( ry, 3.0 ) strength = default( strength, 125 ) lodamp = default( lodamp, 0.0 ) hidamp = default( hidamp, 0.0 ) sharpness = default( sharpness, 0.0 ) tweaker = default( tweaker, 0.0 ) PPmode = default( PPmode, 0 ) PPlimit = default( PPlimit, (abs(PPmode)==3) ? 4 : 0 ) interlaced = default( interlaced, false ) sharpness = (sharpness>1.58) ? 1.58 : sharpness tweaker = (tweaker > 1.00) ? 1.00 : tweaker strength = float(strength)*(1.0+sharpness*0.25) RR = string((rx+ry)/2.0) ST = string(float(strength)/100.0) LD = string(lodamp) HD = string(pow(hidamp,2)) TWK0 = "x y - 12 "+ST+" / "+RR+" / /" TWK = "x y - 12 "+ST+" / "+RR+" / / abs" TWK_HLIGHT = "x y - abs 1 < 128 "+TWK+" 128 "+TWK+" - "+TWK+" 128 / * + "+TWK0+" "+TWK+" "+LD+" + / * " \ + "128 "+TWK+" - 20 / 2 ^ 128 "+TWK+" - 20 / 2 ^ "+HD+" + / * 128 + ?" i = (interlaced==false) ? clp : clp.separatefields() oxi = i.width oyi = i.height sm = i.bicubicresize(m4(oxi/rx),m4(oyi/ry)) mm = mt_lutxy(sm.mt_expand(),sm.mt_inpand(),"x y - 4 *").mt_expand().mt_deflate().blur(1.58).mt_inflate().bicubicresize(oxi,oyi,1.0,.0).mt_inflate() sm = sm.bicubicresize(oxi,oyi,1.0,.0) smd = mt_lutxy(i.sharpen(tweaker),sm,TWK_HLIGHT) smd = (sharpness==0.0) ? smd : smd.blur(sharpness) clean = mt_lutxy(i,smd,yexpr="x y 128 - -").mergechroma(i) clean = mt_merge(i,clean,mm) LL = string(PPlimit) LIM = "x "+LL+" + y < x "+LL+" + x "+LL+" - y > x "+LL+" - y ? ?" base = (PPmode<0) ? i : clean small = base .bicubicresize(m4(oxi/sqrt(rx*1.5)),m4(oyi/sqrt(ry*1.5))) ex1 = small.mt_expand().blur(.5) in1 = small.mt_inpand().blur(.5) hull = mt_logic( mt_lutxy( ex1.mt_expand().RemoveGrain(12,-1), ex1, "x y - 1 1 / * 1.0 ^ 1 - 5 *" ) \ ,mt_lutxy( in1, in1.mt_inpand().RemoveGrain(12,-1), "x y - 1 1 / * 1.0 ^ 1 - 5 *" ) \ ,"max", U=-128, V=-128) \ .bicubicresize(oxi,oyi,1.0,.0) postclean = (abs(PPmode)== 1) ? mt_merge(base,small.bicubicresize(oxi,oyi,1.0,.0),hull,Y=3,U=2,V=2) \ : (abs(PPmode)== 2) ? mt_merge(base,base.RemoveGrain(19,-1),hull,Y=3,U=2,V=2) \ : (abs(PPmode)== 3) ? mt_merge(base,base.RemoveGrain(4,-1),hull,Y=3,U=2,V=2) \ : clean postclean = (PPlimit==0) ? postclean \ : mt_lutxy(base,postclean,yexpr=LIM,U=2,V=2) (PPmode==0) ? clean : postclean interlaced ? weave() : last return( last ) } #--------------------------------------------------------- function m4(float x) {return(x<16?16:int(round(x/4.0))*4)}
-
You probably have the wrong version of some of the filters. Prewitt looks to be part of a recent modification of MaskTools2.
http://avisynth.org/mediawiki/MaskTools2/Mt_edge -
I tried these versions:
http://manao4.free.fr/MaskTools-v1.5.8.zip
http://manao4.free.fr/masktools-v2.0a38.zip
http://avisynth.org/warpenterprises/files/masktools_20070805.zip
but none of them seems to have the prewitt() function...
I managed to make Dehalo_Alpha work but it doesn't remove the halos, it only blurs the whole image..
If you want to have a try, you can download a short sample of the video here: http://www.mediafire.com/?ydywionmkzy -
I suspected... but at least I know the problem now.
And the interlacing issue, was it the problem you diagnosed? -
How do you noticed that? I mean, what are the effects? The bad lines at the top of the video?
-
Actually, I take that back. It looks like the two fields are intact but the video is in such poor shape it's hard to tell. Normally you use a simple Bob or discard field detinterlace and look at the results. If you still see combing artifacts the two fields are not intact.
Here's a simple filter sequence that clears out most of the halos but leaves the video very blurry:
BilinearResize(160,480)
Blur(1,0)
BicubicResize(720,480) -
Sounds like Chinese for me..
What does "combing artifacts" means ? The bad lines at the top? And I don't understand after which operation they should disappear if the fields are intacts.
Here's a simple filter sequence that clears out most of the halos but leaves the video very blurry:
BilinearResize(160,480)
Blur(1,0)
BicubicResize(720,480)Last edited by mathmax; 21st Apr 2010 at 14:06.
-
Last edited by jagabo; 21st Apr 2010 at 20:24.
-
I've seen simular results when an SVHS recording was palyed back on a VHS player.
To save money, people used to drill a hole at the end of the grove on the bottom of the cassette to record SVHS on a standard VHS tape.
Is there a hole? -
Regarding the removal of halos, some mix of resizing and dehalo filters, probably with multiple instances of each, may work better. I'll leave that up to you.
Megahurts, I'm sorry I don't understand what you mean.. -
Because dehalo filters are designed to remove halos that are about a single pixel thick. The low bandwidth of VHS tape means the horizontal resolution is closer to 350 pixels than 720 pixels. That means the halos are roughly two pixels wide when captured at 720 pixels. Then when a VHS tape is copied over and over the halos widen, become more severe, and you get halos around the halos. To undo this you may have to run several dehalo passes at the resolution the halos were produced.
-
Nope - its in how you can see the combed lines are quite sharp and distinct in places, and blurred completely together in others, in a fairly regular vertical pattern. Once you've seen it happen a few times it's distinctive. Somewhere between the original recording and the image you uploaded, the video has been improperly resized.
(I've seen it particularly bad on an anime DVD that was cack-handedly converted to PAL from telecined-NTSC... you could even see artefacts on the CRT TV I first played it on - and forget about making a clean AVI conversion of it. Ended up buying a better quality re-release from a different publisher - very lucky that such a thing even existed, mind, and they changed the audio!)
Question: What is the original format of the tape? You're showing us a full-size NTSC capture (including the lower twin images that are the two seperate fields)... did it start life as such? My suspicion is it may have been a PAL recording, which doubles up the hurt if improperly handled. First you have a lot of (originally temporally as well as spatially separate) lines being mashed into each other on each field, and then you have the framerate conversion - probably also mishandled - complicating matters.
The proper way to deal with the two would be to convert to full-frame, 720x576, 50hz video (so doubling up, with each frame having one field different), run some kind of trick deinterlacer, resizer and motion interpolation filter (my brain hasn't the strength to fully explain or research this right now) and backconvert to your intended format (29.97/59.94 hz interlaced at 720x480). Or at very least, seperate the fields (720x288 50hz), do a simple resize of both sets to 720x240, and pile them back together with an occasional single-field duplication and switching of field order (NB this causes further headaches later...)
And that's without even dealing with the haloing issue.
(BTW as VHS is an analogue format, dropping it to 352 PIXELS across and then back up again may cause noticable quantisation effects even so - is there no halo filter that can have the width expanded instead? Particularly as the dividing line may end up sitting halfway across a pixel, then. The clarity is low, but there's an infinite range of positions available)
What's been done instead is that the entire 2-field frame has been dropped into the editor, bilinear resized to 5/6ths of its previous size, probably had every 5th whole frame duplicated (maybe even without the requisite 1000/1001 drop, so the sound's noticably desynched after a few minutes), and then rewritten out. Possibly the output of a very primitive hardware frame converter, if the tape itself has reached you with these artefacts still in place. Assuming I'm correct about the origins that isLast edited by EddyH; 22nd Apr 2010 at 08:49.
-= She sez there's ants in the carpet, dirty little monsters! =-
Back after a long time away, mainly because I now need to start making up vidcapped DVDRs for work and I haven't a clue where to start any more! -
BlindDehalo3() does support independent halo thickness settings on both the x and y axis, as well as a strength setting. Since this is a multigenerational VHS copy you need multiple passes to get rid of multiple halos. I found two passes of BlindDehalo3(rx=7, ry=1, strength=200) (at the original 720x480 resolution) comes close to eliminating the severe halo around the guitarist's legs. But it leaves the video very blurry, similar to the Blur() method I pointed out earlier. Obviously, you could choose to use a compromise setting that leaves some halos but also leaves the video sharper. Fixing the levels will help too.
Frame 73, original:
After:
MPEG2Source("VTS_01_3.demuxed.d2v")
Levels(40,1,255,0,255)
BlindDehalo3(rx=7, ry=1, strength=100)
BlindDehalo3(rx=7, ry=1, strength=100)
ConvertToYUY2(interlaced=true)
After:
MPEG2Source("VTS_01_3.demuxed.d2v")
Levels(40,1,255,0,255)
BlindDehalo3(rx=7, ry=1, strength=200)
BlindDehalo3(rx=7, ry=1, strength=200)
ConvertToYUY2(interlaced=true)
Last edited by jagabo; 22nd Apr 2010 at 09:06.
-
Thank you very much for your answer EddyH
I don't know anything about the history of this tape.. I just got the digitalized files.
I would really like to see exactly what you mean. Where are these mashed lines? Could you give me the lines and frames numbers?
Ok but why you wanna resize it and change the frame rate? Is it necessary to run a deinterlacer or a motion interpolation filter? What are you hopping to fix with the motion interpolation filter?
Do you think some fields are missing causing a wrong order in some passages (bottom field in first, top field in second)? Or I didn't understand the problem?
How can you guess this?
But I didn't noticed the sound's desynched...
Sorry to ask all these questions but I'm pretty novice with all that techniques. And I would really like to know more..
jagabo, thank you for your tests. It's still very blurry but we needn't to resize with this function. I guess it's better... but can we still hope better results with other scripts? -
EddyH is talking about poor PAL to NTSC conversions. It's hard to tell exactly with your sample because of the time base errors, blurriness, macroblock artifacts, and halos. But I don't see any convincing evidence of poor resizing from 576 lines to 480 lines, temporal blending of fields, or missing/duplicate frame/fields from frame rate conversion.
-
Hi
Is there a way to sharpen the video in one direction (horizontally) after I blur it to get rid of the halos? -
sharpen(horizontal,vertical)
e.g.
sharpen(1,0)
weren't you using masks & blurring , or was that someone else at doom9
Similar Threads
-
Pictures are blurred while capturing
By eliqush in forum Capturing and VCRReplies: 5Last Post: 31st May 2010, 19:02 -
My Caps Come out very Blurred
By zxfactor in forum Capturing and VCRReplies: 9Last Post: 17th Feb 2009, 06:10 -
Blurred Text on DVD Menu
By boofer in forum Authoring (DVD)Replies: 3Last Post: 10th Jan 2009, 17:45 -
Streamclip output blurred
By bijones2 in forum EditingReplies: 0Last Post: 14th Jun 2008, 06:37 -
DVD Lab - menu text blurred (PAL)
By BeachNut in forum Authoring (DVD)Replies: 12Last Post: 21st Jan 2008, 06:12