View Full Version : White lines across PAL DV file converted from Hi8. Repairable?
nhope
19th July 2011, 12:32
I have a 4:3 interlaced PAL DV file of a cousin's wedding that was converted years ago from a Hi8 tape. It has occasional random white lines flickering across it. The lines are never in the same place for more than one frame.
Is there any way to fix this? Perhaps a script that detects the white lines and copies or interpolated adjoining lines to patch it?
Below are some example frames, and here is 4 seconds of typical footage (http://dl.dropbox.com/u/21489814/white-lines.avi).
http://dl.dropbox.com/u/21489814/interference1.jpg
http://dl.dropbox.com/u/21489814/interference2.jpg
http://dl.dropbox.com/u/21489814/interference3.jpg
Ghitulescu
19th July 2011, 12:43
Do you still have the Hi8 cassette?
Maybe the D8-camcorder overreacted to the tapes' dropouts.
nhope
19th July 2011, 12:48
I might be able to get the tape in a couple of weeks. If there's still a Hi8 camera there, it would be an ancient one with a slim chance of functioning well. At a guess, the tape was probably played out over an S-Video cable to a Sony mini-DV deck or VX2000. I actually have another file without the white lines, but the levels are horrible (over-exposed/blown out).
2Bdecided
19th July 2011, 13:10
First course of action is definitely try to re-capture with decent equipment. Apart from the white lines, that captures looks good.
If you can't re-capture, there must be something that can deal with single-line single-frame errors. turnright().descratch().turnleft() would be the first thing I'd try.
Cheers,
David.
Ghitulescu
19th July 2011, 13:11
I thought that it may be the camcorder that has been used (many people owning V8 and Hi8 bought a Digital8 one), since these camcorders are oversensitive to dropouts, but I think I remember a similar thread here with a different cause. You may need to recapture the tape again in case the lines are visible on the DV gear, too.
smok3
19th July 2011, 13:15
i tested DeScratch with various parameters on your test video, but didn't bring me anywhere.
nhope
19th July 2011, 13:39
Thanks for trying.
In the absence of an AviSynth solution, I'm wondering if I can create a mask in my NLE (Sony Vegas Pro) that lets a lower track show through in areas with levels higher than 240, duplicate the video to a lower track and move it up or down by 1 line. These lines are at a level >240, and most of the highlights are not. I will experiment with that.
Didée
19th July 2011, 13:41
Needs more refinement regarding the actual repair ... basically just a quick try on creating a mask:
# mt_masktools.dll
# VerticalCleaner.dll
AviSource("white-lines_(nhope).avi")
o=last
mask1 = o.mt_lut("x 200 > 255 0 ?")
mask2 = mt_lutxy(o,o.verticalcleaner(),"x y - 8 - 8 *")
streakmask = mt_logic(mask1,mask2,"min")
streakmask = streakmask.mt_inpand(mode="horizontal").mt_inpand(mode="horizontal").mt_inpand(mode="horizontal").mt_inpand(mode="horizontal")
streakmask = streakmask.mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").greyscale
brr = o.separatefields.mt_inpand(mode="vertical",U=2,V=2).mt_expand(mode="vertical",U=2,V=2).weave()
o.mt_merge(brr,streakmask,U=2,V=2)
#interleave(o,last)
return(last)
Edit: Oops, there was one "o" too much.
nhope
19th July 2011, 15:12
Thanks very much Didée, that does a good job of getting rid of most of it. Unfortunately there are still a few areas with 3 or more "adjacent" white lines which slip through the net. I've tried tweaking values in your script but haven't been successful yet. Here's another particularly bad 1-second sample (http://dl.dropbox.com/u/21489814/white-lines2.avi) that has such adjacent lines, and here's a screen grab after running through your script:
http://dl.dropbox.com/u/21489814/interference4.jpg
Didée
19th July 2011, 15:33
Unfortunately there are still a few areas with 3 or more "adjacent" white lines which slip through the net.
Sure. Didn't I say "needs more refinement"? ;)
Though, the mask in itself should work for those areas, too, as long as *not* both fields are damaged in the same area.
It (should) be the too simple inpand/expand, which is too small to erode a 3-pixels-high cluster.
You can try placing a ".removegrain(4)" between inpand and expand in the brr=... line. That should suffice for 3-high clusters.
However that's still a very simple spatial repair. Temporal filtering would be better (but also more complicated and much slower).
There's lots of prior art created by yup. Search for +yup +horizontal +streaks, and you'll find kilometers of threads'n scripts worth reading. :D
Didée
19th July 2011, 16:20
Oh, that 2nd sample is really worse. Well ... no matter what script gets cooked up, you will find that one frame that consists of 99% white streak artifacts, and conclude "nope, don't work." :D
Here's a brute-force extension of the previous script. (Y'know, brute-force implies "brutal")
# RemovegrainSSE2.dll / RepairSSE2.dll
# MVtools2.dll
# mt_masktools.dll
# VerticalCleaner.dll
AviSource("white-lines_(nhope).avi","white-lines2_(nhope).avi")
crop(12,0,-4,-0,true)
blankclip(last).merge(last,0.999)
o=last
#return o
mask1 = o.mt_lut("x 200 > 255 0 ?")
mask2 = mt_lutxy(o,o.verticalcleaner(),"x y - 8 - 8 *")
streakmask = mt_logic(mask1,mask2,"min")
streakmask = streakmask.mt_inpand(mode="horizontal").mt_inpand(mode="horizontal").mt_inpand(mode="horizontal").mt_inpand(mode="horizontal")
streakmask = streakmask.mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").mt_expand(mode="horizontal").greyscale
mask2 = streakmask.separatefields.mt_expand(mode="vertical").mt_expand(mode="vertical").mt_expand(mode="vertical").weave()
brr = o.separatefields.removegrain(0,19).mt_inpand(mode="vertical",U=2,V=2).mt_inpand(mode="vertical",U=2,V=2).mt_expand(mode="vertical",U=2,V=2).mt_expand(mode="vertical",U=2,V=2).weave()
o.mt_merge(brr,streakmask,U=2,V=2)
bob(0,0)
bobb=last
bs=16
super = bobb.mt_inpand(mode="vertical",U=2,V=2).mt_inpand(U=2,V=2).removegrain(11).MSuper(pel=2, sharp=1)
super2 = bobb.MSuper(pel=2, sharp=1,levels=1)
bvec2 = MAnalyse(super, isb=true, delta=2, blksize=bs, overlap=bs/2)
bvec1 = MAnalyse(super, isb=true, delta=1, blksize=bs, overlap=bs/2)
fvec1 = MAnalyse(super, isb=false, delta=1, blksize=bs, overlap=bs/2)
fvec2 = MAnalyse(super, isb=false, delta=2, blksize=bs, overlap=bs/2)
bc2 = bobb.mcompensate(super2,bvec2)
bc1 = bobb.mcompensate(super2,bvec1)
fc1 = bobb.mcompensate(super2,fvec1)
fc2 = bobb.mcompensate(super2,fvec2)
median2(bc2,bc1,bobb,fc1,fc2)
# contrasharpen
D1=mt_makediff(o.bob(0,0),last)
D2=mt_makediff(last,last.removegrain(4).removegrain(20)).mt_lut("x 128 - abs 4 / 1 1.4 / ^ 4 * x 128 - x 128 - abs 0.001 + / * 128 +")
DD=D2.repair(D1,12).mt_lutxy(D2,"x 128 - y 128 - * 0 < 128 x 128 - abs y 128 - abs < x y ? ?")
last.mt_adddiff(DD,U=2,V=2)
separatefields().selectevery(4,0,3).weave()
#stackhorizontal(o,last)
return(last)
#=============================================
# median of 5 clips from Helpers.avs by G-force
#=============================================
Function Median2(clip "input_1", clip "input_2", clip "input_3", clip "input_4", clip "input_5", string "chroma")
{
chroma = default(chroma,"process") #default is "process". Alternates: "copy first" or "copy second"
#MEDIAN(i1,i3,i5)
Interleave(input_1,input_3,input_5)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
m1 = selectevery(3,1)
#MAX(MIN(i1,i3,i5),i2)
m2 = input_1.MT_Logic(input_3,"min",chroma=chroma).MT_Logic(input_5,"min",chroma=chroma).MT_Logic(input_2,"max",chroma=chroma)
#MIN(MAX(i1,i3,i5),i4)
m3 = input_1.MT_Logic(input_3,"max",chroma=chroma).MT_Logic(input_5,"max",chroma=chroma).MT_Logic(input_4,"min",chroma=chroma)
Interleave(m1,m2,m3)
chroma == "process" ? Clense(reduceflicker=false) : Clense(reduceflicker=false,grey=true)
selectevery(3,1)
chroma == "copy first" ? last.MergeChroma(input_1) : chroma == "copy second" ? last.MergeChroma(input_2) : last
Return(last)
}
nhope
19th July 2011, 16:21
".removegrain(4)" nearly does it, but leaves a few bits and pieces. I've now managed to get more success with this:
brr = o.separatefields.mt_inpand(mode="0 -2 0 -1 0 0 0 1 0 2",U=2,V=2).mt_expand(mode="0 -2 0 -1 0 0 0 1 0 2",U=2,V=2).weave()
This should be adequate for this job, but I'll check out the temporal filtering too. Cheers
jmac698
19th July 2011, 17:45
I've tested all the white lines techniques for VHS dropouts. You can do pretty good with it. I have another idea as well, we can use your version without lines to fill in the lines. I know it's blown out, but most spots used to fill in should be ok. Ideally you would fill in as much valid video as possible and interpolate the rest somehow, preferably temporally in low motion areas and spatially otherwise (to avoid possible occlusion problems).
Can you post a sample of the same spot in the other copy?
And yes, ideally you can re-capture, but if you still get white lines, you can merge two captures as I find that the white lines are always in different places.
That's why I don't like to call them dropouts, as if the oxide was actually flaked off, you would get the white lines in the same spot. What I think is happening is that the signal is temporarily below detection level and the FM demodulation idles at the frequency for white.
jmac698
19th July 2011, 17:59
Here's some that I've tried: (with user parameters as used in avsPmod)
loadplugin(dir+"DePulse.dll")#http://www5e.biglobe.ne.jp/~hoe/dv-and-movie/tipsxxx/index.html
loadplugin(dir+"descratch.dll")#http://avisynth.org.ru/descratch/descratch.html
loadplugin(dir+"despot.dll")#http://avisynth.org.ru/despot/despot.html
function destreak(clip v, int mode, int lumathresh, int chromathresh, bool show) {
return select(mode, \
\
v.converttoyuy2.depulse([<"h", 80, 235, 80>],[<"l", 16, 79, 79>],0,show).converttoyv12, \
nop, \
v.Turnright(). \
DeScratch(12, 10,5,1, 5, 41, 0,1, \
keep=0, border=1,modeY=3,mark=show). \
Turnleft(), \
v.DeSpot([<"p1", 1, 20, 12>], [<"p2", 1, 20, 1>], pwidth=41, pheight=1, 25, interlaced=false, \
ranked=true, p1percent=0, dilate=16, fitluma=true, blur=1, motpn=false, seg=0, sign=0, tsmooth=0))
}
Also removedirt from removegrain (example in docs). You'll have to change border=3 for your thick lines.
nhope
19th July 2011, 19:01
jmac698, when I loaded your script into VirtualDub I got an error: unexpected character "[".
I think it's going to be difficult to merge from the other capture because, apart from the different levels, it's shifted slightly and the frames don't line up. Probably more trouble than it's worth. But anyway here (http://dl.dropbox.com/u/21489814/white-lines-b.avi) and here (http://dl.dropbox.com/u/21489814/white-lines2-b.avi) are the equivalent 2 samples anyway. I'm afraid I can't really remember how the 2 different captures were done, or why they are different, because it was years ago, but apart from the white lines, the first capture is much nicer in terms of levels and detail. A recapture is difficult, as the ageing Hi8 tape and camera is in the back of a cupboard on the other side of the world (or possibly in a landfill by now!), and the rest of my A/V gear is on this.
The script that Didée posted worked amazingly well on the short sample. I'll try it on some more now.
jmac698
19th July 2011, 19:10
Hi,
I'm afraid that wasn't a working script, just some examples copied and pasted. The "[" is a special feature that can only be used with AvsPmod.
I have techniques to match the line shift, the levels, and the sync. You're right that it's probably too much trouble, but I'd like to test some of my own ideas anyhow.
I'll see if I can make a working script from the 4 line removal plugins I have.
johnmeyer
19th July 2011, 22:25
I tried a motion-compensated version of a Despot script that I used very successfully earlier this year on a 1969 Quadruplex tape that had severe dropouts. It worked great on that, but the dropouts were <20 pixels in length. Yours are 720 pixels. I'm pretty sure Despot can be made to work, but I need to spend more time figuring out whether it is better to simply motion compensate the clip and then let Despot do its thing, or instead create a mask and then feed the mask to Despot. Both are shown in the documentation.
However, since Didée's second script is doing the job, probably better to use that and get the job done.
nhope
19th July 2011, 22:32
Didée's script is performing miracles with the lines, but it softens the image a bit so I've added a sharpen(0.5,0.75) before the reinterlace and will leave it to run on the whole video overnight. Thanks for all the help everyone.
Didée
19th July 2011, 23:28
Just in case, I've added a small custom contrasharpen to the script. The result should now stay more close to the original.
Ghitulescu
20th July 2011, 08:59
Didée's script is performing miracles with the lines, but it softens the image a bit so I've added a sharpen(0.5,0.75) before the reinterlace and will leave it to run on the whole video overnight. Thanks for all the help everyone.
Instead of doing "overnight" processings over and over, why don't you simply recapture the tape again? You'll have the original sharpness, colours and no white lines to be masked.
nhope
20th July 2011, 10:32
@Didée - Thanks for the that. The contrasharpen does help.
@Ghitulescu - Yes, a recapture would be ideal but, as I said, the camera and tape are not with me now and if I do get access to them again, the result will probably be the same or worse. From what I recall, I tried recapturing a couple of times and got white lines again. It's a 20+-year-old Canon Hi8 cam, probably captured to a VX2000 DV cam over S-video.
How would a typical "professional" outfit capture an old Hi8 tape?
StainlessS
20th July 2011, 12:27
This might be worth a look.
http://forum.doom9.org/showthread.php?t=151426&highlight=depulse
smok3
20th July 2011, 12:42
How would a typical "professional" outfit capture an old Hi8 tape?
some of the next digital8 cameras was able to playback old hi8 analog stuff, maybe you can find one someplace...
vBulletin® v3.8.11, Copyright ©2000-2025, vBulletin Solutions Inc.