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.

 

Go Back   Doom9's Forum > Capturing and Editing Video > Avisynth Usage

Reply
 
Thread Tools Search this Thread Display Modes
Old 6th June 2019, 21:35   #1  |  Link
szabi
Registered User
 
Join Date: Nov 2004
Posts: 251
Video stabilization (deshake)

Hi

I tried to stabilize my video, however I could not get what I expected.
Video source is 3840×2160@29.970, mp4.
First I try to use deshaker (v3.1) plugin in virtualdub.
Altered setting from default in 1st pass, scale:Full
Altered setting from default in 2nd pass, edge compensation:None
Because the final video going to be cropped any zoom is not needed.
I was not happy with outcome.

Second try to use DePanStabilize.
Code:
LoadPlugin("C:\My Program Files\MeGui\tools\lsmash\LSMASHSource.dll")
LSMASHVideoSource("D:\Camera\deshake-test\VID_20190606_123345.mp4")
i = ConvertToYV12()
mdata = DePanEstimate(i)
DePanStabilize(i, data=mdata)
crop(142, 80, -142, -80)
LanczosResize(1920,1080)
I was not happy with result so I modified the script based on what sample I did find on internet:
Code:
i = ConvertToYV12()
mdata = DePanEstimate(i, range=2, trust=0, dxmax=5, dymax=5, zoommax=1,  log="F:\depanlog.log")
DePanStabilize(i, data=mdata, dxmax=30, dymax=15, zoommax=1, rotmax=0, inputlog="F:\depanlog.log")
crop(142, 80, -142, -80)
LanczosResize(1920,1080)
It did not improve anything, even the created logfile was empty.

Last I did try also came from google search.
Code:
i = ConvertToYV12()
vectors=MSuper().MAnalyse(isb=false,blksize=8, overlap=0,search=5)
globalmotion=MDepan(vectors,pixaspect=1,thSCD1=500)
DepanStabilize(data=globalmotion,cutoff=0.5,mirror=15,prev=0,next=0,blur=50,pixaspect=1,subpixel=2,method=1)
crop(142, 80, -142, -80)
LanczosResize(1920,1080)
Unfortunately this one has crashed whatever I did try.

I created a stack video about each try including one video which only cropped and resized:


The original video is available here: VID_20190606_123345
I would like to ask help what should I do to get a correct result?

Regards
Szabi
szabi is offline   Reply With Quote
Old 6th June 2019, 22:10   #2  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Need more info. Which avs version 32/64bit? Latest dll versions?
No problems here with 32bit avs+. But ran into memory issues with prefetch in avs 32bit. (with last script)
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database

Last edited by ChaosKing; 6th June 2019 at 22:18.
ChaosKing is offline   Reply With Quote
Old 6th June 2019, 22:58   #3  |  Link
wonkey_monkey
Formerly davidh*****
 
wonkey_monkey's Avatar
 
Join Date: Jan 2004
Posts: 2,492
Being a wide angle video and having what I think is some moderate-to-strong rolling shutter are probably what's stopping you get a better result. Have you tried enabling the Rolling Shutter setting on Deshaker?

It's either that or there's some other weird processing going on with that video, because there are times when it looks like the clouds are out of sync with the ground.
__________________
My AviSynth filters / I'm the Doctor
wonkey_monkey is offline   Reply With Quote
Old 7th June 2019, 01:58   #4  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,685
I tried with Deshaker 3.0 but couldn't get it to work. I then stabilized it using an old version of Mercalli that is built into Vegas. I didn't play around with the settings much, so I assume that some of the funkiness in the clouds and around the edges of the video could be improved. Also, my Mercalli is almost a decade old and their newer versions are far better. It is expensive, but is probably the best stabilizer out there. You can download the trial and see if it is worth the (considerable) expense to purchase.

Here's a link to the result (which I down res'd to HD just to make it easier to deal with).

Stabilized Video
johnmeyer is offline   Reply With Quote
Old 7th June 2019, 03:51   #5  |  Link
poisondeathray
Registered User
 
Join Date: Sep 2007
Posts: 5,340
As John mentioned by John- newer versions of mercalli are improved. Most notably - they have rolling shutter correction modes.

Here is the result using the default setting for rolling shutter - vibrations/wobble (also downscaled to 1080p). You can play with the settings and probably get slightly better results. Or adjust more smoothness (but more zoom)

Free , open source software is still lacking in terms of RS correction . Deshaker has partial RS correction, but not generally not as good in those scenarios as mercalli or warp stabilizer
https://www.mediafire.com/file/o3ick...obble.mp4/file
poisondeathray is offline   Reply With Quote
Old 7th June 2019, 06:43   #6  |  Link
pinterf
Registered User
 
Join Date: Jan 2014
Posts: 2,309
in the non-working example clip "i" is not used
pinterf is offline   Reply With Quote
Old 7th June 2019, 08:21   #7  |  Link
szabi
Registered User
 
Join Date: Nov 2004
Posts: 251
Quote:
Originally Posted by ChaosKing View Post
Need more info. Which avs version 32/64bit? Latest dll versions?
No problems here with 32bit avs+. But ran into memory issues with prefetch in avs 32bit. (with last script)
First I tried official Avisynth. This is the version I use since came out without problem until now.
In this case it did not worked neighter with ffms nor with lsmash (index was done my megui).
Installed AviSynth+. Now ffms still crash however lsmash worked expect the last one.
Presently 9 different Avisynth exist? Really?
For me it is really confusing and it even worse by complicating x86 or 64bit.

Quote:
Originally Posted by wonkey_monkey View Post
Being a wide angle video and having what I think is some moderate-to-strong rolling shutter are probably what's stopping you get a better result. Have you tried enabling the Rolling Shutter setting on Deshaker?

It's either that or there's some other weird processing going on with that video, because there are times when it looks like the clouds are out of sync with the ground.
There is no other process on original video it is as camera recorded.
I did try rolling shutter set on deshaker, it gives a slightly better result.

Quote:
Originally Posted by johnmeyer View Post
.....my Mercalli is almost a decade old and their newer versions are far better. It is expensive, but is probably the best stabilizer out there.....
Checking the prices of mentioned software seems more recommended to buy a gimbal.

Quote:
Originally Posted by poisondeathray View Post
Here is the result using the default setting for rolling shutter - vibrations/wobble (also downscaled to 1080p)....

Free , open source software is still lacking in terms of RS correction . Deshaker has partial RS correction, but not generally not as good in those scenarios as mercalli or warp stabilizer
https://www.mediafire.com/file/o3ick...obble.mp4/file
This is the best result until now.
I stacked it to the new comparison video:


As conclusion there is no free software wich could provide better result what I achieved by Deshaker and DePanStabilize until now and there is no better settings for DePanStabilize neighter.
Thanks for your help.

Regards
Szabi
szabi is offline   Reply With Quote
Old 7th June 2019, 08:31   #8  |  Link
szabi
Registered User
 
Join Date: Nov 2004
Posts: 251
Quote:
Originally Posted by pinterf View Post
in the non-working example clip "i" is not used
Modifiy it to the following also has crash result:
Code:
ConvertToYV12()
vectors=MSuper().MAnalyse(isb=false,blksize=8, overlap=0,search=5)
globalmotion=MDepan(vectors,pixaspect=1,thSCD1=500)
DepanStabilize(data=globalmotion,cutoff=0.5,mirror=15,prev=0,next=0,blur=50,pixaspect=1,subpixel=2,method=1)
crop(142, 80, -142, -80)
LanczosResize(1920,1080)
The problem seems the various avisynth with complicating 32 or 64bit plugins.
It would be nice to try 64bit ffms or lsmash indexing but there is no tool to do so.
szabi is offline   Reply With Quote
Old 7th June 2019, 08:50   #9  |  Link
ChaosKing
Registered User
 
Join Date: Dec 2005
Location: Germany
Posts: 1,795
Quote:
Originally Posted by szabi View Post
The problem seems the various avisynth with complicating 32 or 64bit plugins.
It would be nice to try 64bit ffms or lsmash indexing but there is no tool to do so.
64bit ffms2 https://forum.doom9.org/showthread.p...63#post1870563
__________________
AVSRepoGUI // VSRepoGUI - Package Manager for AviSynth // VapourSynth
VapourSynth Portable FATPACK || VapourSynth Database
ChaosKing is offline   Reply With Quote
Old 7th June 2019, 09:30   #10  |  Link
StainlessS
HeartlessS Usurer
 
StainlessS's Avatar
 
Join Date: Dec 2009
Location: Over the rainbow
Posts: 10,980
From Here:- https://forum.doom9.org/showthread.p...57#post1876357

Quote:
Originally Posted by StainlessS View Post
For anyone else wanting to try the multi-source loader script function, here is a 7zip compressed file (~31MB: AVI_LSMASH_FFMS2_SOURCE.7z):-
http://www.mediafire.com/file/2kuq0f...RCE.7z.7z/file
Above 7zip file using Ultra Compression, so may need latest version 7Zip if yours is old (saved an extra 10MB).

Contains both x86 and x64
FFMS2 (XP compatible [C Filter NOT CPP, but autoloads OK in AVS+ without LoadCPlugin call])
LSmash(NOT XP Compatible, CPP filter)
Multi-Source Script function [ GetSeq() ], tries AVI, both LSmash filters and FFMS. (and dubs audio to video)
Also contains RT_Stats latest, v2.00 Beta 12(used by the multi-source loader script).
EDIT: The above zip also has a 15MB MP4 demo clip (heima_720p_500.mp4, demo'ing x264 from some years ago, 720x500p 4 mins).
Guess I forgot to remove from directory before zipping up.
Zip size 31MB, unzip about 113MB(ffms dll's are quite big.
The included script will try AVIsource if AVI file, then LSMash ISO source if ISO file, then FFMS if still not opened ok, then lastly LSMash non ISO source filter.
Requires RT_Stats which is included in zip.

EDIT: Think all source dlls are 10 bit capable.

EDIT: Here script. Can extract function only to eg GetSeq.avsi in plugins and then just use GetSeq(FileName) to load clip.
As it stands, does not use any fancy LSmash or Ffms2 args.

GetSeq.avsi
Code:
Function GetSeq(String vFn,String "aFn") {
    Function IsISOFileName(String s)  {s=RT_GetFileExtension(s) Return(s==".mov"||s==".mp4"||s==".m4v"||s==".3gp"||s==".3g2"||s==".mj2"||s==".dvb"||s==".dcf"||s==".m21")}
    Function IsRiffFileName(String s) {s=RT_GetFileExtension(s) Return(s==".avi"||s==".wav")}
    myName="GetSeq: "                                           aFn = Default(aFn,"")           aFn = (aFn=="") ? vFn : aFn
    Assert(vFn!="",RT_String("%sVFn Cannot be ''",myName))      vFn = vFn.RT_GetFullPathName    IsRiffV = vFn.IsRiffFileName    IsIsoV = vFn.IsISOFileName
    Assert(aFn!="",RT_String("%saFn Cannot be ''",myName))      aFn = aFn.RT_GetFullPathName    IsRiffA = aFn.IsRiffFileName    IsIsoA = aFn.IsISOFileName
    c=0 a=0
    Try { # 1st Try specialized AVI
        c = (IsRiffV)                            ? vFn.AviSource                                                                                                     : NOP
        (c.IsClip)                               ? RT_DebugF("AviSource opened Video\n  '%s'",vFn,name=myName)                                                       : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }
    Try {
        a = (c.IsClip && c.HasAudio && aFn==vFn) ? c : (IsRiffA) ? aFn.WavSource                                                                                     : NOP
        (a.IsClip && a.HasAudio)                 ? RT_DebugF("%s opened Audio\n  '%s'",(c.IsClip && c.HasAudio && aFn==vFn)?"AviSource":"WavSource",aFn,name=myName) : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }

    # Next try specialized ISO LSMash
    Try {
        IsOpenV=(c.IsClip && c.HasVideo)
        c = (IsIsoV)                       ? LSMASHVideoSource(vFn)                                                : c
        (IsIsoV)                           ? RT_DebugF("LSMASHVideoSource opened Video\n  '%s'",vFn,name=myName)   : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }
    Try {
        IsOpenA=(a.IsClip && a.HasAudio)
        a = (IsIsoA)                       ? LSMASHAudioSource(aFn)                                                : a
        (IsIsoA)                           ? RT_DebugF("LSMASHAudioSource opened Audio\n  '%s'",aFn,name=myName)   : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }

     # Next try FFMS2
    Try {
        IsOpenV=(c.IsClip && c.HasVideo)
        (!IsOpenV)    ? FFIndex(vFn)                                                    : NOP
        c=(!IsOpenV)  ? FFVideoSource(vFn)                                              : c
        (!IsOpenV)    ? RT_DebugF("FFVideoSource opened Video\n  '%s'",vFn,name=myName) : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }
    Try {
        IsOpenA=(a.IsClip && a.HasAudio)
        a=(!IsOpenA)  ? FFAudioSource(aFn)                                              : a
        (!IsOpenA)    ? RT_DebugF("FFAudioSource opened Audio\n  '%s'",aFn,name=myName) : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }

    # Next try LSmash non ISO Video
    Try {
        IsOpenV=(c.IsClip && c.HasVideo)
        c = (!IsOpenV && !IsIsoV)          ? LWLibavVideoSource(vFn)                                                : c
        (!IsOpenV && !IsIsoV)              ? RT_DebugF("LWLibavVideoSource opened Video\n  '%s'",vFn,name=myName)   : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }
    Try {
        IsOpenA=(a.IsClip && a.HasAudio)
        a = (!IsOpenA && !IsIsoA)      ? LWLibavAudioSource(aFn)                                                : a
        (!IsOpenA && !IsIsoA)          ? RT_DebugF("LWLibavAudioSource opened Audio\n  '%s'",aFn,name=myName)   : NOP
    } catch (msg) { RT_DebugF("Catch: %s",msg,name=myName) }

    Assert(c.IsClip, RT_String("%s failed open on\n  '%s'",myName,vFn))
    (!c.HasAudio && a.IsClip && a.HasAudio) ? AudioDubEx(c,a) : c
    (!HasAudio) ? RT_DebugF("Audio failed Open on\n  '%s",aFn,name=myName) : NOP
    return Last
}
Client
Code:
FN=".\heima_720p_500.mp4"
#FN="10Bit_Standard8_Scan_16FPS.avi"

GetSeq(FN)
Info
Return last
Viewing debug output via debugview(Google) will show which source filter was used to open clip.
__________________
I sometimes post sober.
StainlessS@MediaFire ::: AND/OR ::: StainlessS@SendSpace

"Some infinities are bigger than other infinities", but how many of them are infinitely bigger ???

Last edited by StainlessS; 7th June 2019 at 09:50.
StainlessS is offline   Reply With Quote
Old 7th June 2019, 14:14   #11  |  Link
szabi
Registered User
 
Join Date: Nov 2004
Posts: 251
Quote:
Originally Posted by johnmeyer View Post
.... You can download the trial and see if it is worth the (considerable) expense to purchase.
After registration I check the trial version.
When analyzing the 2nd step (Correct CMOS distortions) always crash.
Failure message : "Analyzing or creating the shadow-video has failed"
Nothing comes easy.

EDIT: Exporting the video by Lagarith Lossless Codec with resizing to 1920x1080 helped to feed it with Mercalli.
Seems 4k/mp4 video not welcomed or my PC has not enough power.

Last edited by szabi; 7th June 2019 at 14:29.
szabi is offline   Reply With Quote
Old 7th June 2019, 17:50   #12  |  Link
johnmeyer
Registered User
 
Join Date: Feb 2002
Location: California
Posts: 2,685
Quote:
Originally Posted by szabi View Post
EDIT: Exporting the video by Lagarith Lossless Codec with resizing to 1920x1080 helped to feed it with Mercalli.
Seems 4k/mp4 video not welcomed or my PC has not enough power.
The 4K size does present some problems.

One trick you could use would be to create a temporary video that is identical to the original, but down-res'd to 1920x1080, or even lower. Run that through the Deshaker first pass. Then, open the original file, load the LOG file created in the first pass, and see if Deshaker will process the original file using the motion vectors created on the lower-res version in the first pass.
johnmeyer is offline   Reply With Quote
Old 9th June 2019, 06:33   #13  |  Link
szabi
Registered User
 
Join Date: Nov 2004
Posts: 251
Hi

I cropped the video by virtualdub to 3556x2000 and saved to avi through Lagarith Lossless Codec and did cut 1 minutes segments.
After the Mercalli did eat them.
It was so long time ago when I could not use script rather than working lossless.

Thanks for help.
Regards
szabi

Last edited by szabi; 9th June 2019 at 06:43.
szabi is offline   Reply With Quote
Reply

Tags
avisynth, depanstabilize, deshake, stabilize, virtualdub

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 04:22.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.