View Full Version : Need help detecting FieldSwapped Frames (VHS-Cap). A task for our masking gurus!
scharfis_brain
14th November 2004, 16:29
I have capped a VHS using my Cinergy400 and VVCR.
the captured file is drop-free.
The only thing that bothers me is that it has a dynamic field shift. like shown here:
http://home.arcor.de/scharfis_brain/samples/swapped.png
applying swapfields() repairs this:
http://home.arcor.de/scharfis_brain/samples/repaired.png
Now I need an automatic solution to detect and repair those field shifted frames. All are progressive.
I had the idea in mind to do some edge-like masking (Dideeeeeeeeeeeeeeeeeeeeeeee?) to detect the combed /stairstepped horizontals.
So all I need is, to compare the AVGluma (or whatever) of the unshifted and shifted frame, so I can select the good one.
Every help is very appreciated.
It seems to be a typical behaviour of the SAA-chips.
With my Old Bt-8x8 Card I never had this kind of error.
(But I don't want to use the Bt8x8 anymore for several reasns)
Mug Funky
14th November 2004, 16:56
not sure if this actually works - it's hard to test without a clip that shows this.
c=last
global edges=c.yv12convolution(horizontal="1",vertical="1 -2 1",Y=3,U=0,V=0,usemmx=true)
global swapedges=c.swapfields().yv12convolution(horizontal="1",vertical="1 -2 1",Y=3,U=0,V=0,usemmx=true)
ConditionalFilter(c, c, c.swapfields(), "float(averageluma(edges)-averageluma(swapedges))", "lessthan", "0.0")
hmm... swapfields.swapfields doesn't return the original clip... is that a little strange?
[edit]
from the look of things, it certainly passes normal progressive frames through without touching them. interlaced frames will be a problem, but i can't see a way around that.
scharfis_brain
14th November 2004, 17:30
Thanks very much!
This will become my standarised function for dynamic field-shifts in progressive sources.
function repairfieldswap(clip c)
{d=c.swapfields().crop(0,0,0,-1)
d=stackvertical(d.crop(0,0,0,1),d)
e=c.converttoyv12()
global edges=e.yv12convolution(horizontal="1",vertical="1 -2 1",Y=3,U=0,V=0,usemmx=true)
global swapedges=e.swapfields().yv12convolution(horizontal="1",vertical="1 -2 1",Y=3,U=0,V=0,usemmx=true)
ConditionalFilter(e, c, d, "float(averageluma(edges)-averageluma(swapedges))", "lessthan", "0.0")
}
I have to test this with laced content.
with horizontal panning this method should be very okay.
but with vertical panning, that interferes with the amount of the shifted field, there would be a major problem because the function somehow aligns fields.
Mug Funky
15th November 2004, 10:18
hmm... i haven't even attempted to test this on anything but progressive stuff.
it just uses a comb mask on a swapped and non-swapped version of the input, and outputs whichever comes out darker in the comb mask.
but i'm thinking that on interlaced input, i don't think we can make the assumption that swapping fields will actually increase the detected amount of combing. reasonably static scenes would be okay in theory (less precise, but still should work reliably), but on scenes where everything is moving this function would be useless without a better comb-mask.
hmm. perhaps the jumping effect of separated fields could be exploited - swaped fields should always jump more. maybe depan could be used?
krieger2005
18th November 2004, 19:42
How can zou crop by "1"? I tried to do that in YV12 and YUY2. One give me an error. the other does nothing... Maybe i done something wrong
scharfis_brain
18th November 2004, 19:53
with YUY2 one can crop by one in vertical. but not in horizontal.
since all my captures are in YUY2, this is very okay for me.
O.S.D
21st April 2006, 21:03
Hi
I have tryed your filter and it is realy good but thre is one thing that is strange and that is that the corected frame
gets a litle darker then the uncorekted frames is there
something that i can do to fix it?
And does this hapen to eny one ells?
:thanks:
AVIL
21st April 2006, 21:28
@scharfis_brain
Perhaps this filter could help:
http://compression.ru/video/old_film_recover/field_shift_en.html
Good luck
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.