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. |
15th November 2011, 16:19 | #1 | Link |
Registered User
Join Date: Sep 2011
Posts: 241
|
How to get DePan to fix Screen Shake?
I have a 720 x 480 interlaced MPEG2 video HERE which I've denoised. The original is HERE . The video moves up several pixels every few seconds which was probably caused by old VHS equipment. You can see the "USA" logo move up and down.
I found this code but it just gives wavey artefacts: Code:
Mpeg2Source("E:\1\Screen Shake.d2v") i = ConvertToYV12() mdata = DePanEstimate(i) DePanStabilize(i, data=mdata, initzoom=1.1) Could someone please suggest a filter and script to fix the screen shake. I'm not bothered if it's for DePan or not, just as long as it works. Thanks Last edited by VideoFanatic; 15th November 2011 at 21:11. |
15th November 2011, 21:43 | #5 | Link |
Registered User
Join Date: Sep 2011
Posts: 241
|
I tried the following:
Code:
Mpeg2Source("E:\1\Screen Shake.d2v", CPU=6) DeGrainMedian(limitY=2, limitUV=3, mode=1, interlaced=true) DeGrainMedian(limitY=2, limitUV=3, mode=1, interlaced=true) AssumeTFF() QTGMC() mdata = DePanEstimate(dxmax=0) DePanStabilize(last, data=mdata, initzoom=1.1) SeparateFields() SelectEvery(4,0,3) Weave() |
16th November 2011, 02:41 | #6 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
I threw together a crude script using bits and pieces I had lying around. This isn't a thing of beauty, but it should give you the idea.
Here's the video that results from this script: Stabilized and Denoised And here's the script. You can do the denoising first and then do the stabilization, as recommended above. I tried it both ways and thought I got better results doing the stabilization before the denoising. The depan stabilization works on large blocks so I think it may be somewhat immune to noise. Obviously any denoiser works better on compensated sources, and this approach compensates the source in two different ways before the denoising step. I applied Depan at the field level rather than the frame level. Code:
loadplugin("C:\Program Files\AviSynth 2.5\plugins\MVTools\mvtools2.dll") Loadplugin("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\mt_masktools.dll") Loadplugin("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\Depan.dll") LoadPlugin("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\DepanEstimate.dll") Loadplugin("C:\Program Files\AviSynth 2.5\plugins\Film Restoration\Script_and_Plugins\removegrain.dll") #STABILISING PARAMETERS #---------------------------------------------------------------------------------------------------------------------------- maxstabH=20 #maximum values for the stabiliser (in pixels) 20 is a good start value maxstabV=20 est_left=40 est_top=40 est_right=40 est_bottom=40 est_cont=1.6 source=AVISource("E:\frameserver.avi").killaudio().AssumeTFF().converttoYV12() stab_input=separatefields(source) stab_reference= stab_input.crop(est_left,est_top,-est_right,-est_bottom).tweak(cont=est_cont).MT_binarize(threshold=80).greyscale().invert() mdata=DePanEstimate(stab_reference,trust=1.0,dxmax=maxstabH,dymax=maxstabV) stab=DePanStabilize(stab_input,data=mdata,cutoff=0.5,dxmax=maxstabH,dymax=maxstabV,method=1,mirror=15).deflicker() stabilized=weave(stab).Levels(16, 1, 235, 0, 255, coring=false) denoised=MDegrain2i2(stabilized,8,0,0) #stackvertical(source,denoised) return denoised #------------------------------- 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 fixed_fields=MergeChroma(fields,crop(fields,Hshift,Vshift,0,0).addborders(0,0,Hshift,Vshift)) super = fixed_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(fixed_fields,super, backward_vec2,forward_vec2,backward_vec4,forward_vec4,thSAD=400) #original setting Weave() } |
16th November 2011, 02:58 | #7 | Link |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
I downloaded your fixed video and it still looks to me like most of the jumps seen in the ropes around the ring are still as strong as the original. Take a look at frames 334 and 335 in your improved version compared to what I uploaded.
|
16th November 2011, 04:13 | #8 | Link |
Registered User
Join Date: Sep 2011
Posts: 241
|
I had to change your source line to this as I need Mpeg2Source:
source=Mpeg2Source("E:\1\Screen Shake Denoised new.d2v").killaudio().AssumeTFF().converttoYV12() I appreciate the time you took on your script but your script produces a terrible video! The whole picture moves giving a feeling of motion sickness and the borders move left and right. Are you sure you watched the video I made with my script? |
16th November 2011, 06:46 | #9 | Link | |
Registered User
Join Date: Feb 2002
Location: California
Posts: 2,695
|
Quote:
As to my attempt, I used too large a depan setting, and also didn't crop the edges. You will ALWAYS have to do a crop after using depan to reduce unwanted motion ("jumping" in your case) because depan does not include edge filling. You could use Deshaker, which does include this feature. If you look at the ropes in my video, and ignore the edges (which as I stated above, can easily be fixed by using smaller motion compensation values, and then doing a small crop), the jumping has been eliminated. Anyway, good luck with your project. Last edited by johnmeyer; 16th November 2011 at 06:48. Reason: added one sentence to clarify -- edit made two minutes after post |
|
Tags |
bobbing, depan, screen shake, stabilization |
Thread Tools | Search this Thread |
Display Modes | |
|
|