View Full Version : Video with horizontal shaking - how to fix it?


Kermit25
1st June 2012, 23:10
Welcome.
Several times, I recorded something and video was horizontal shaking (as if every second frame was shifted by 1px the earlier) Strangely, the station logo is stable, but the projected video is trembles. I thought that I was unlucky, but when re-recording - the same effect.

When only the even frame has loaded:
...SelectOdd()...

or

...SelectEven()...
while watching the picture was stable (ignoring interference from 25fps -> 12.5 fps). It was the same as I left the odd frames. Image is not shaking. When I play, original material - it shakes.

I tried a few filters for deinterlacing:
... KernelDeInt(order=1,sharp=true) ...
or
... FieldDeinterlace() ...
or
... FieldDeinterlace(blend=false) ...
or
... TomsMoComp() ...
or
... DGBob() ...
interlace is remove correctly, but none removed the shaking :(

I tried to remove it "by hand":

#DATA
d2vpath = "sample_shack.d2v"
#audio=NicMPG123Source("sample_shack T01 DELAY 0ms.mpa")

# INTERLACE
mpeg2source(d2vpath)
deint = tdeint()
tfm(d2v=d2vpath,clip2=deint)
#audiodub(video,audio)

#SHACK
converttoRGB24()
odd=SelectOdd()
even=SelectEven()
even=AddBorders(even,0,0,1,0)
even=crop(even,1,0,0,0)
Interleave(even,odd)

.....

Few professional, but the closest to ideal. Tremor is smaller, but still felt.

Does anyone have an idea how to fix a "broken" material? If anyone has an idea, that can be made available readily to a short sample for tests :)

Thank you for your attention, and ask for help.

Guest
1st June 2012, 23:58
Post a link to an unprocessed source sample to get proper help.

Kermit25
2nd June 2012, 10:22
Here it is.
http://www.sendspace.com/file/rer1st
This untouched source sample :o

laserfan
2nd June 2012, 12:53
I've not looked at your sample, but you might want to play with Stab() til someone else helps--I had good luck with it with a movie that had horizontal shake. I think the commented-out lines (#) might be the defaults. I don't remember. But I tested first using Trim on a portion of the video and then let 'er rip and was very happy with the result:

DGSource("videoIN.dgi",debug=false)

#Trim(0,1729)

Stab()

##############################################################################
#Original script by g-force converted into a stand alone script by McCauley #
#latest version from December 10, 2008 #
##############################################################################

function Stab (clip clp, int "range", int "dxmax", int "dymax") {

range = default(range, 1)
dxmax = default(dxmax, 15)
dymax = default(dymax, 6)

#temp = clp.TemporalSoften(4,4,8,15,2)
#inter = Interleave(temp.Repair(clp.TemporalSoften(4,4,8,15,2)),clp)
temp = clp.TemporalSoften(7,255,255,25,2)
inter = Interleave(temp.Repair(clp.TemporalSoften(1,255,255,25,2)),clp)
mdata = DePanEstimate(inter,range=range,trust=1,dxmax=dxmax,dymax=dymax,info=false)

DePan(inter,data=mdata,offset=-1,mirror=12,blur=30,info=false)
SelectEvery(2,0)
}

Kermit25
2nd June 2012, 16:08
I want to try Your method, but I have problems.
I had no filter DePan ... I added it.
Although it has problems VitrualDub "DePanEstimate: Can not load FFTW3.dll"

EDIT....
OK. I solved the problem of the missing file FFTW3.dll
But unfortunately, the function did not improve shaking :/

Guest
4th June 2012, 18:21
I had a look at the sample. If you compare the top of the frame to the bottom, the bottom is barely shaky while the top is all over the place, with that effect smoothly changing from top to bottom. That means no stabilizer that just translates the picture is going to work. I don't know of any way to fix this, but others may chime in.

ajk
5th June 2012, 06:09
The distortion pattern seems reasonably stable, so if you find a plugin that can stretch the fields back into shape, I think finding three different settings would be enough and it probably would not need to be adaptive in any way. I did not test this idea though, and don't really know of such a plugin off hand. The station logo will get skewed, but perhaps you could overlay a slightly larger version of it back on the video or get rid of it in some other way.

A quick way to get stable motion is to pick just one field, eg.:


Source("Sample.mpg")

SeparateFields()
SelectEvery(4,0)

PointResize(width(),height()*2)


Due to the nature of the animation, I don't think you lose a lot of motion like this. Though if there are lots of pans in the full episode, maybe you do lose too much. And of course vertically this looks pretty coarse, you should use EEDI/NNEDI/whatever kind of better interpolation to do the actual resizing.

zee944
10th June 2012, 12:57
Here it is.
http://www.sendspace.com/file/rer1st
This untouched source sample :o

You could analyze only the top of the video (cropping most of the frame) with DePan or DeShaker, logging the values (x, y movement etc.) into a textfile, than use DeSkew or Reform plugin with supersampling to balance out the shaking using the data with ConditionalFilter. Then you can repeat the same with the bottom of the video. It would save your video completely, however it's quite time consuming to do, probably doesn't worth it. There must be a better official source for this cartoon.