Log in

View Full Version : Deshaker by Gunnar Thalin


Pages : 1 2 3 4 5 6 7 8 9 [10] 11

redfordxx
10th January 2020, 23:19
I hope I understand optics roughly correctly.
I played a little with the idea of compensating x and y rotation.

I took one frame of my video and tried to find warp with best improvement of OK blocks.

Original motion estimation: 28.7%
After warp: 62.9%

See the pictures. I used avs codepoints_f1="
0,0 0,0
640,0 1,0
640,480 15,8
0,480 0,3
"
warp(points_f1, interleaved = true, relative = true)
I know there is also partial z rotation and x and y shift but it does not matter to the demonstration.

Anyone thinks it has a potential?


BTW:
"19|1|20|4|1|0|1|0|640|480|0|1|1000|1000|1000|1000|4|1|0|2|8|30|350|4|deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|15|15|5|15|0|0|30|30|0|0|0|0|1|1|0|10|1000|0|88|1|1|20|5000|100|20|1|0|ff00ff"

wonkey_monkey
10th January 2020, 23:41
Do you get a better result with Quad in place of Warp?

nji
11th January 2020, 01:04
I would like to mention I've been told
that the equations to determine the 4 parameters
are kind of "ill-posed".
If you reduce the number of parameters the situation
gets better (That's the reason for being able to disable
calculate for rotation and zoom in Deshaker's GUI).
If you enter two more paramters the problem probably
will get way worse?

Second: I'm not sure if a better matching of the OK blocks
in general means better matching of the actual movements.
Don't forget there is no accounting of optical conditions (FOV etc.)

redfordxx
11th January 2020, 09:47
Do you get a better result with Quad in place of Warp?

I read somewhere warp is successor of quad.

Ok, I try again with quad...

redfordxx
11th January 2020, 10:21
I would like to mention I've been told
that the equations to determine the 4 parameters
are kind of "ill-posed".
Meaning complicated or what?
Second: I'm not sure if a better matching of the OK blocks
in general means better matching of the actual movements.
But I think it is good estimate as long as I keep all the discard parameters pretty strict.
Don't forget there is no accounting of optical conditions (FOV etc.)
Meaning what?

nji
11th January 2020, 10:21
...Don't forget there is no accounting of optical conditions (FOV etc.)

To be more specific about what I mean by that.

To my "math intuition" analyzing the 2D data without taking into account
FOV (for larger values) is like doing the first step, very accurate,
more and more sophisticated ... but into the wrong direction.

That's why I was heading for doing something with FOV before analyzing
https://forum.doom9.org/showthread.php?p=1895012

Also ... if you have a look on the example video that the author of
Lens Transform did
https://forum.doom9.org/showthread.php?p=1895255#post1895255
and have a closer look on the difference between
Deshaker original and Lens Transform
you see that the "perspective distortion from FOV" in the original 2D data
are so massive that it doesn't seem to make sense to do sophisticated
analysis on them.

But ... as said ... just intuition from me, ... maybe completely nonsense.

EDIT:
Our posts where at the same time .... so I didn't answered on your last.
Concerning "ill-posed": Please see the def of it, can't explain better.

redfordxx
11th January 2020, 10:29
I tried Lens Transform and even created aan adobe profile. But probably did something wrong, since I did not observe any change on my video.

nji
11th January 2020, 10:32
Did you import Deshaker.log? (Right click in the graphic)
Did you set the smooth value to say 50++ ?

EDIT
And it suffices to edit in the lens profiles something like:

[lens]
name = "24 mm (mFt)"
hfov = 40

redfordxx
11th January 2020, 11:17
Loaded the lens profile. There was hero (extremely visible) and my profile not perceivable.
Could be maybe downloaded profiles for smartphones? I have Samsung A520F.

nji
11th January 2020, 11:59
Did you checked all points from my last post?

BTW
Maybe specific discussion on Lens Transform
should be in
https://forum.doom9.org/showthread.php?p=1747268
as this thread is about Deshaker related.

wonkey_monkey
11th January 2020, 12:57
Quad and Warp produce different results. Quad used to be a separate plugin but is now part of Warp.

redfordxx
11th January 2020, 21:29
That's why I was heading for doing something with FOV
My guess is to fix the lens distorsion first and project it to sphere so that movement of camera won't change the image?
and then run both deshaker passes
and project it to back whatever I want...?

redfordxx
12th January 2020, 01:18
I will try to figure out defish with a, b, c parameters from PTGui and then run deshaker.

nji
12th January 2020, 10:08
Once more I would like to point to the thread
https://forum.doom9.org/showthread.php?p=1895012#post1895012
and the statements wonkey_monkey did on that.

Also in the thread about shekh's Lens Transform at the end
there are some thoughts about it.

As I said before I doubt this thread is the right place for
discussion the matter, as as far as I know
orig Deshaker won't be modified, and source is (and probably will never?)
be available.

However I personally think your 2 ideas could lead to a great
improvement - but only for movies with large FOV.
Good luck! :)

redfordxx
15th January 2020, 23:10
Please help about settings 1st pass. I suspect this behaviour:
When there is some problem finding vector for certain spot, then there is whole big square of missing vectors around.

Which parameter to tweak to help with this?

redfordxx
17th January 2020, 00:43
Can I setup somehow, that I want:

first 2000 frames --- infinite smoothness
rest of video --- normal smoothing

StainlessS
17th January 2020, 07:22
Can only suggest to do in two chunks.
1st 2000, in two passes, save result.
remainder, in two passes, save result.
Join together.

(There could be a way to do the lot in single script using TWriteAvi:- https://forum.doom9.org/showthread.php?t=172837&highlight=TWriteAVI
but would need to do a pair of double passes, with first half filename for FirstHalf_pass1, FirstHalf_pass2, and second half filename for SecondHalf_pass1, SecondHalf_pass2.
Also need two sets of args for Deshaker.
TWriteAVI, cannot not use avs MT and x86 only - TwriteAVI contains old Vdub code incl a little bit of assembler, I dont do x86/x64 assembler)

EDIT:
Basic two pass script (only for normal single use)

WhateverSource(...)
A_Two_Pass_Function(Pass=1) # Create some kind of deshaker log or whatever.
ForceProcessAVI() # Force Pass 1, creating log (A function From TWriteAVI plug)
A_Two_Pass_Function(Pass=2) # Use created log
return Last # 2nd pass when you play/save clip.


First suggestion will probably be less hassle.

EDIT: Double chunks something like

WhateverSource(...)
Clip1 = Trim(0,-2000) # 2000 frames
File1="D:\File1.txt"
Clip2 = Trim(2000,0) # remainder
File2="D:\File2.txt"
Clip1.A_Two_Pass_Function(Pass=1,LogFile=File1)
ForceProcessAVI() # Clip1, Force Pass 1
Clip2.A_Two_Pass_Function(Pass=1,LogFile=File2)
ForceProcessAVI() # Clip2, Force Pass 1
Result1 = Clip1.A_Two_Pass_Function(Pass=2,LogFile=File1) # Clip 1 Pass 2
Result2 = Clip2.A_Two_Pass_Function(Pass=2,LogFile=File2) # Clip 2 Pass 2
return Result1++Result2

redfordxx
17th January 2020, 08:50
Can only suggest to do in two chunks.
1st 2000, in two passes, save result.
remainder, in two passes, save result.
Join together.
Something like this was first thing I was thinking of...
However...
I thought the last frame of the first part could be little off because the clip is fixed to first frame and there would be a little movement.

In your example would not it be the case?

If so, I was thinking: reverse the first part, then do the job with one frame in the middle overlapping, reverse back, get rid of the overlapping frame and join...

StainlessS
17th January 2020, 09:57
because the clip is fixed to first frame
Not sure what you mean there, also not sure why you want to reverse the clip. [I have not read the entire thread]
For duplicate, maybe DuplicateFrame:- http://avisynth.nl/index.php/DuplicateFrame
for delete DeleteFrame:- http://avisynth.nl/index.php/DeleteFrame

If you are going to reverse, then you better be using a totally frame accurate source, nowt better than AVI Lossless, convert to AVI Lossless with FFMPEG if not.

General purpose demo.bat

REM We DO NOT LIKE SPACES IN FILE NAMES (REM == REMark ie comment)

setlocal

REM Where to Find ffmpeg
set FFMPEG="C:\BIN\ffmpeg.exe"

REM Where to get input file, No terminating Backslash, "." = current directory (ie same as dir .bat file)
set INDIR="."

REM Where to place output file, No terminating Backslash. "." would be same as .bat file, ".\\OUT" = OUT folder in same directory as bat file.
set OUTDIR="D:"

REM Below, can add extensionas as eg *.WMV (SPACE separated)
FOR %%A IN (*.mp4 *.vob *.mpg *.TS *.MOV) DO (

REM ****** Un-REM ONLY one of below lines *******.
REM %FFMPEG% -i "%INDIR%\%%A" -vcodec copy -acodec copy "%OUTDIR%\%%~nxA.MKV"
REM %FFMPEG% -i "%INDIR%\%%A" -vcodec utvideo -acodec copy "%OUTDIR%\%%~nxA.MKV"
%FFMPEG% -i "%INDIR%\%%A" -vcodec utvideo -acodec pcm_s16le "%OUTDIR%\%%~nxA.AVI"
REM *********************************************.

)

REM ... Above UN-REM'ed lines :
REM (1) Remux, copy both video and audio (output MKV).
REM (2) UtVideo lossless video, copy audio (output MKV).
REM (3) UtVideo lossless video, PCM audio (output AVI).

Pause

redfordxx
17th January 2020, 12:15
Not sure what you mean there
Because afaik with the infinite smoothness the deshaker fixes the first frame and then the view can go little off.

So, at the and of the first part the view would not be not aligned with the beginning of the second part.

Therefore reverse... instead moving away the camera should converge to the desired position...starting point of the second part.

I have one more idea right now: copy the first frame of the second part before the first part. That should position the clip correctly in the beginning ... and hold ok ... except of computational error.


But now...just more thinking...I cannot use zoom for borders restoring because in the first and second part I will end up with different zoom...and they micht not fit together.

StainlessS
17th January 2020, 15:57
I guess you must wait for advise from somebody that knows what is what, I cant remember the last time I used Deshaker.

redfordxx
3rd February 2020, 09:32
I use Deshaker to process avs script. I that script, I added some black borders (with AddBorders and Quad filters). I set up Deshaker to ignore the black.

When I process the clip then, sometimes Deshaker fails to analyse the vectors properly. When I go back to the bad frame and manually step though them, the results are ok.

Anyone experienced this kind of behaviour?

Bernardd
3rd February 2020, 09:52
I am not sut that resolve your problem.
But to choose black color is not a good idea, black is everywherre.
Choose color used in incrustion video work, like green.

redfordxx
4th February 2020, 13:49
I am not sut that resolve your problem.
But to choose black color is not a good idea, black is everywherre.
Choose color used in incrustion video work, like green.

Thank you. I used magenta and helped.

But still, clip playback has different results that stepping with arrouw.
Really frustrating.

redfordxx
6th February 2020, 10:09
Enabled rolling shutter. Gives better results.
However, what is the meaning of the percentage?
I compared visually the analysis of vectors 1% and 99% and looks same...

redfordxx
6th February 2020, 14:24
I am processing again once processed video. I have added borders not to loose the whole frame.
I use borders $FF00FF not to be processed.

I have found another behaviour.
Deshaker does not process fixed area at the border image, in certain cases. See the picture.
https://i.postimg.cc/bDWFgP8n/20180513-171911-pass2-115.jpg (https://postimg.cc/bDWFgP8n)

(1)The processing area seems to be always rectangular
(2)The rectangle is sometimes smaller than necessary

Changing Initial search range has influence on that, but is not solution.

I don't know whether it is possible to fix (1) but maybe (2)?
Any settings?

redfordxx
19th February 2020, 08:48
Hi.
Is that possible, that the rolling shutter depends on the shutter speed? If the camera supports setting it fixed.

If so, I would say
RS for 30FPS with 1/33sec equals 60FPS with 1/66sec.
RS for 30FPS with 1/66sec is half of 60FPS with 1/66sec.
RS for 30FPS with 1/33sec is double of 30FPS with 1/66sec.


When I take an example record from the Deshaker RS documentation I think all was taken at the same fixed shutter speed.
Canon EOS 80D
- 1080p60: 90%
- 1080p30: 45%
- 1080p24: 36%
- 1080p30 with 3x digital zoom: 90%

MysteryX
23rd January 2022, 02:43
Using this plugin under Vapoursynth could be possible by porting the VirtualDub compatibility plugin....

But will there ever be a possibility of using it on Linux? Since the source code isn't available and the author hasn't been heard from in 8 years, I suppose not a chance?

poisondeathray
23rd January 2022, 02:46
Using this plugin under Vapoursynth could be possible by porting the VirtualDub compatibility plugin....


I haven't tested it in vapoursynth, but apparently you can load it with avs.LoadPlugin


Note that if you are really insane you can load Avisynth’s VirtualDub plugin loader and use VirtualDub plugins as well.


http://www.vapoursynth.com/doc/functions/general/loadpluginavs.html

StainlessS
23rd January 2022, 11:04
the author hasn't been heard from in 8 years
Author (guth, ie Gunnar Thalin, first post in this thread @ post #5),
last sign-in Dec 2020.

EDIT: I think that last time I posted in a Gunnar Thalin thread, he popped up a day or two later.

guth
19th June 2022, 07:15
Author (guth, ie Gunnar Thalin, first post in this thread @ post #5),
last sign-in Dec 2020.

EDIT: I think that last time I posted in a Gunnar Thalin thread, he popped up a day or two later.

I'm still alive! :)
I don't seem to get notification emails?

Using this plugin under Vapoursynth could be possible by porting the VirtualDub compatibility plugin....

But will there ever be a possibility of using it on Linux? Since the source code isn't available and the author hasn't been heard from in 8 years, I suppose not a chance?

Funny, the reason I'm here is to post the next post... see below.

guth
19th June 2022, 07:15
I don't know if there's any interest still, but I (finally) think it might be a good idea to make the Deshaker source code public. :)

Any recommendation on the best way to do this?
Do I just put a zip on my Deshaker page? Or should I put it on GitHub, or something, and how much work is that? Maybe someone else would like to "run" it??
And what license? I don't really care if people make money on it (anymore), but is it still a bad idea to make it completely free? (Excuse my lack of knowledge and interest in legal stuff.)
Also, please keep in mind I've become rather lazy. :)

Boulder
19th June 2022, 11:03
The notification emails have been broken since a long time ago :devil:

I vote for putting the source code on GitHub. I do not believe that it's a big job but someone else can confirm that - or just add it to their repo :D I'm sure there's something useful for someone in the code sooner or later.

StainlessS
19th June 2022, 11:38
I dont do GitHub and so cannot comment on how easy that would be.
I don't really care if people make money on it (anymore)
But I'm guessing that you would prefer not to have someone take totally Freeware source, change a few labels
to say that they are the authors, and make a packet of cash from the people that they deceive.
Open source with GPL would maybe be best.

Nice to see you again Guth :)

VoodooFX
20th June 2022, 11:50
Any recommendation on the best way to do this?
Do I just put a zip on my Deshaker page? Or should I put it on GitHub, or something, and how much work is that?
On GitHub it would be there ~forever, and it's easy, few clicks if your source is one-few files, do it through the website there, not through Git.


And what license? I don't really care if people make money on it (anymore), but is it still a bad idea to make it completely free?
I would say, good luck if anyone by some magic manages to make money out of it. :D

This is do whatever you want license:

The Unlicense

A license with no conditions whatsoever which dedicates works to the public domain. Unlicensed works, modifications, and larger works may be distributed under different terms and without source code.

This is simplest preserving a credit to your name, and preserving the open source if it's not incorporated into some MicrosoftDub:

MIT License

A short and simple permissive license with conditions only requiring preservation of copyright and license notices. Licensed works, modifications, and larger works may be distributed under different terms and without source code.

guth
21st June 2022, 14:36
I would say, good luck if anyone by some magic manages to make money out of it. :D

I have sold it to a few companies in the past, at least. Without even trying. :)

Anyway, thanks for the input, guys. If nothing unexpected happens I'll put it on GitHub within a couple of weeks.

guth
28th June 2022, 19:43
The Deshaker source code is now on GitHub:

https://github.com/gu-t/Deshaker

Please let me know if you see anything weird. I've used Git before, but I'm new to GitHub.

StainlessS
28th June 2022, 20:19
Most gracious of you, cheers Guth.

kedautinh12
29th June 2022, 00:22
Most gracious of you, cheers Guth.

I think you need release binary :D

guth
29th June 2022, 08:19
I think you need release binary :D

Binaries exist on my Deshaker page, that I link to. Or, what do you mean?

kedautinh12
29th June 2022, 09:08
Binaries exist on my Deshaker page, that I link to. Or, what do you mean?

Oh thanks

Rob105
30th May 2023, 11:59
Can i somehow set a horizon across different control frames so Deshaker would stabilize rotation to match this horizon or any way to set horizon at all?

Here's sample video https://www.upload.ee/files/15288523/00007_original_clip.zip.html

What approach would you use to make horizon straight with Deshaker?

stephen22
27th June 2023, 14:26
Find a level frame and process from there with rotation smoothness -1, max correction some large number. Reverse the first section and process similarly. Unreverse and join the 2 together.

isidroco
17th October 2024, 23:39
Hi, I made a PowerShell script [+batch caller] which will pick up all .LOGs from current [or specified] folder and generate fileName_OGG.txt chapter info per LOG (ie: to use with MKVmerge). Minimum duration can be specified (default 75sec). FPS must be known (default NTSC). Has chapter name skeleton as used in mkvtoolnix-gui.exe.
Here's Log2chaps.ps1 script:


# PARAM must be first command
param ( [int]$gi_minSec=75, [float]$gr_fps=29.970, [string]$gs_chapSkel='Chap <NUM:2>',
[switch]$pal, [switch]$ntsc, [switch]$yes )

$debugging= $false

write-host -ForegroundColor Green ''
write-host -ForegroundColor Green 'Log2Chaps v24.1016'
write-host -ForegroundColor Green ''
write-host -ForegroundColor Green ' Extract chapter list from each deShake .LOG files'
write-host -ForegroundColor Green ' Generates: originalfilename_OGG.txt'
write-host -ForegroundColor Green ''
write-host -ForegroundColor Green 'Usage: Log2Chaps [[[minSec] fps] chapSkeleton] [-ntsc|-pal] [-yes]'
write-host -ForegroundColor Green ' minSec: Minimun Chapter length in seconds (default 75)'
write-host -ForegroundColor Green ' fps: Frames Per Second (default 29.970) or -pal / -ntsc'
write-host -ForegroundColor Green ' chapSkeleton: (default "Chap <NUM:2>" where NUM is chapter # using :N digits)'
write-host -ForegroundColor Green ' -ntsc: 29.970 takes precedence over fps'
write-host -ForegroundColor Green ' -pal: 25 takes precedence over ntsc'
write-host -ForegroundColor Green " -yes: unnatended"
write-host -ForegroundColor Green ''

# param ( $G_ARCHIVE = $(throw 'Need file to upload!'),
# $G_LOGFILE = $(throw 'Need logfile!') )
#
# Run as ADMIN
# Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
# 24.1016 better dispay info
# 23.0513 fps between [3..240]; only inform skipped >10 frames
# 23.0510 escaped ´: in write-host, avoids error in win10
# 22.0918 minSec first argument, newline after chapterlist
# 22.0916 switches: -yes -pal -ntsc
# 22.0914 success/ already done messages
# 22.0831 range check
# 22.0829 vars: XY_name: {X: Local, Global} {Y: Integer Long Real(float) String Fileinfo Timespan Date ...}
# Array: XAY_name (ie local string array: las_nameOfVariable)
# 22.0829 do all LOGs, ask before
# 22.0824 implement digits
# 22.0823 chapNames as MKVGui default: 'Chap <NUM:2>'
# 22.0822 ogg chapters format
# 22.0821 chapters time hh:mm:ss.ddd
# 22.0806 initial idea
#

function parse_log {
param ( [ref]$lf_inFile, [long]$li_minSec=90, `
[float]$lr_fps=29.970, `
[string]$ls_chapName='Chap <NUM>', `
[string]$ls_chapNDig='00' )
write-host -ForegroundColor Green 'Params:', $lf_inFile.value.name, `
"; chapNm:$ls_chapName; fps:$lr_fps; minSec:$li_minSec; `
chapDigStr:$ls_chapNDig" -separator '' # no separator
# parse file
###
$las_nscenes= @( get-content $lf_inFile.value | Where-Object { $_ -match "n_scene"} )
[long]$ll_minimo= $lr_fps * $li_minSec
[long]$ll_lastChapN= 0
[long]$ll_lastSkipN= 0
write-host -ForegroundColor Green "`n Chap 0 " -nonewline # `n is newLine only in double quotes
$lal_chapterFrames= @( [long]0 ) +
@( foreach( $ls_line in $las_nscenes) {
# $ll_n= [long]( $ls_line -split '[ \t]+',3)[1] # 1st method: Take 2nd element, must have first empty
$null= $ls_line -match '\D+(?<digitos>\d+)' # OR 2nd method: Seek first digits, faster and +reliable
[long]$ll_n= [long]$matches[ 'digitos']
if ( $ll_n - $ll_lastChapN -lt $ll_minimo) { # skip if less than min seconds
if ( $ll_n - $ll_lastSkipN -gt 50) { #only inform if more than 50 frames
$ll_lastSkipN= $ll_n
write-host -ForegroundColor Green " skp$ll_n" -nonewline
}
} else { # new chapter
write-host -ForegroundColor Green "`n Chap $ll_n " -nonewline
$ll_lastChapN= $ll_n
$ll_n # Returns chapter number of frames
}
} ) # end foreach $las_nscenes
if ( $ll_lastChapN -eq 0) {
write-host -ForegroundColor Red "*** no chapters ***`n"; return }
write-host -ForegroundColor Green "`n"
# write-host $lal_chapterFrames
[float]$lr_1frame_ms= 1000/ $lr_fps
[int]$li_chapNum= 1
foreach ( $ll_frames in $lal_chapterFrames) {
# *NO* $lt_chap_ms= new-timespan -seconds $lal_chapterFrames[ 2]
# [string]$ls_chapMs= new-timespan -seconds ( [float]$ll_frames* $lr_1frame_ms* 1000)
$lt_chap_ms= [timespan]::frommilliseconds( [float]$ll_frames* $lr_1frame_ms)
# $ls_chapMs= "{0}" -f $lt_chap_ms; [string]$ls_chapMs= $lt_chap_ms; $ls_chapMs= $lt_chap_ms.tostring();
[string]$ls_chapMs= $lt_chap_ms.tostring()
if ( $ls_chapMs.length -eq 8) {
$ls_chapMs+= ".0000000" } #add missing ms in case of exact seconds
$ls_chapMs= $ls_chapMs.subString( 0, 12) # keep first 3 digits of ms leaving: hh:mm:ss.fff
# write-host -ForegroundColor Green ( '{0:hh\:mm\:ss\,fff}' -f $ls_chapMs) # not for powershell v2
$ls_outOdd= "CHAPTER{0:00}={1}" -f $li_chapNum, $ls_chapMs
write-output $ls_outOdd
$chapStr= $ls_chapName -replace '<num>', $li_chapNum.tostring( "$ls_chapNDig")
$ls_outEven= ( "CHAPTER{0:00}NAME={1}" -f $li_chapNum, $chapStr)
write-output $ls_outEven
$li_chapNum+= 1
}
# @{ frame= $_.Split( ' ')[0] }
# | foreach-object { $_ -spilt " ", 2) }
# select-string -path $lf_inFile -pattern "n_scene"
# write-output $chapters
}


#
# MAIN
#
[int]$li_chapDigits=2
if ( $gs_chapSkel -match '<NUM:*(?<xnumero>\d+)>') {
[int]$li_chapDigits= $matches.xnumero }
if ( $li_chapDigits -lt 1 -or $li_chapDigits -gt 9 ) {
$li_chapDigits= 2 }
$gs_chapNDig= '0' * $li_chapDigits # number of digits to print '00'
$gs_chapSkel= $gs_chapSkel -replace '<NUM:*(?<numero>\d+)>', '<NUM>'
if ( $gr_fps -lt 3 -or $gr_fps -gt 240 -or $ntsc ) {
[float]$gr_fps= 29.970 }
if ( $pal ) {
[float]$gr_fps= 25 }
if ( $gi_minSec -lt 1 -or $gi_minSec -gt 960 ) { #not more than 16min
$gi_minSec= 75 }
write-host -ForegroundColor Yellow "Params: minSec:$gi_minSec; ",
"fps:$gr_fps; chapSkel:$gs_chapSkel; digits:$li_chapDigits"
write-host ''
if ( $debugging) { b:; cd \v } # use B:\V tor testing
if ( -not $debugging -and -not $yes
# -and $gs_chapSkel -eq 'Chap <NUM>' #no params
) {
do {
$ls_confirm= Read-Host -Prompt 'Press (Y)es to continue, (N)o to abort'
if ( $ls_confirm -match 'n') { return ' ABORT '}
} until ( $ls_confirm -match '[ys]')
}

$li_outCount= 0
foreach ( $lf_logfile in get-childitem *.log) { #all .LOGs
if ( $lf_logfile.mode -match 'd') { continue } #skip dirs
write-host -ForegroundColor Green $lf_logfile
$ls_oggFileName= $lf_logfile.basename+'_OGG.txt'
if ( -not ( test-path -path $ls_oggFileName -pathType leaf )) {
# parse
$gas_oggFileOut= parse_log ([ref]$lf_logfile) $gi_minSec $gr_fps $gs_chapSkel $gs_chapNDig
write-host -ForegroundColor blue $gas_oggFileOut
if ( $gas_oggFileOut.count -gt 1) {
out-file $ls_oggFileName -inputobject $gas_oggFileOut -encoding ASCII -Width 132 }
if ( test-path -path $ls_oggFileName -pathType leaf ) {
$li_outCount+= 1
write-host "** Generated $li_outCount`: $ls_oggFileName"
write-host
}
if ( $debugging) { break } # debug: stop after first .LOG
} else {
write-host -- Already present: $ls_oggFileName
}
} # foreach .log
write-host
if ( $li_outCount -gt 0 ) {
write-host *** TOTAL Generated Files: $li_outCount ***
} else { write-host *** Nothing to do *** }
write-host

isidroco
17th October 2024, 23:40
And here's the log2chaps.bat batch caller (directory may be specified), help included:


@echo off
set log2chapsVersion=log2chaps v24.1016, isidrococo @ gmail

setlocal enableextensions enabledelayedexpansion & REM to get var value at exec with !varNm!

rem Log2Chaps [PATH] [minSec] [chapSkeleton] [fps]|[-pal]|[-ntsc] [-yes]
rem 75 "Chap <NUM:2>" 29.970 -yes

title %isiVersion%
echo/
echo/%log2chapsVersion%
echo/
echo/ Extract chapter list from each deShake .LOG files based in n_scene marks
echo/ Generates: originalfilename_OGG.txt
echo/
echo/Usage: Log2Chaps [logsFullPath] [[[minSec] fps] chapSkeleton]
echo/ [-ntsc^|-pal] [-yes] [-noPause]
echo/
echo/ logsFullPath: Path of all deshaker .LOG
echo/ minSec: Minimum Chapter length in seconds (default 75)
echo/ fps: Frames Per Second (default 29.970) or -pal / -ntsc
echo/ chapSkeleton: ^(default "Chap <NUM:2>" where NUM is chapter # using :N digits^)
echo/ -ntsc: 29.970 takes precedence over fps
echo/ -pal: 25 takes precedence over ntsc
echo/ -yes: unnatended
echo/
echo/

rem 24.1016 added pathDir and elevate command sending current dir, change parameters order, noPause
rem 22.0918 simple call to powershell

set selfDir="%~dp0"
set selfFullPath="%~f0"
echo Current dir "%cd%", batch dir %selfDir%

rem If 1st param has :\ try changing to it and remove it from PARAM
rem ~ remove and [re-]add quotes
set param1="%~1"
rem needs to be % instead of !, to avoid :: comment out
if not %param1% == %param1::\=% (
cd /d %param1% 2>nul& rem make current dir
rem remove first param
shift
)
echo Current dir %cd%

rem
set PARAM=
:getParam
rem Include trailing space
set paramN=%1 &rem dummy
set "PARAM=!PARAM!!paramN!"
shift
if not "!paramN!"==" " goto getParam

REM Check privileges; https://stackoverflow.com/questions/7044985/how-can-i-auto-elevate-my-batch-file-so-that-it-requests-from-uac-administrator/12264592#12264592
net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
REM ELEVATE AND RERUN -WorkingDirectory "%cd%"
rem echo powershell -NoProfile -Exec Bypass Start-Process -FilePath %selfFullPath% -ArgumentList '"%cd%" %PARAM%' -verb runas
powershell -NoProfile -Exec Bypass Start-Process -FilePath %selfFullPath% -ArgumentList '"%cd%" %PARAM%' -verb runas
rem >NUL 2>NUL
exit /b
)

REM ensure powershell privileges to run scripts {not recommended, better use -ExecutionPolicy ByPass on run}
rem powershell Set-ExecutionPolicy RemoteSigned -Scope LocalMachine
REM Change directory to current script. "runas" starts in C:\Windows\System32
rem cd /d %~dp0

net file 1>NUL 2>NUL
if not '%errorlevel%' == '0' (
echo Must execute as adminstrator !!!
pause
exit
)

echo powershell -noprofile -exec ByPass -file "%selfDir:"=%log2chaps.ps1" %PARAM%
powershell -noprofile -exec ByPass -file "%selfDir:"=%log2chaps.ps1" %PARAM%

IF "%PARAM:nop=%"=="%PARAM%" pause

ReinerSchweinlin
28th November 2024, 07:31
The Deshaker source code is now on GitHub:

https://github.com/gu-t/Deshaker


By accident, I cam across this thread...

Thank you !!

Your plugins have been a great support for me over the years, thanx for the contribution and all the work!

tormento
5th December 2024, 16:18
By accident, I cam across this thread
We just need someone who provides native AVS+ plugin now. :D

ReinerSchweinlin
16th December 2024, 12:16
We just need someone who provides native AVS+ plugin now. :D

Indeed - or Vapoursynth :) Would be lovely :) I have been dreaming about learning to code stuff like that for yearts - but sadly I don`t have the time or am too stupid...

nji
5th June 2025, 09:58
I would like to annotate that DeShaker doesn't account
- field of view (FoV)
- movements within a frame.

As consequence it produces good results only for parallel projection
(telephoto lenses) that have no movement within the scene;
like a photocopier where you move the paper while scanning ;).

But already for a "standard view" objective (50 degrees),
DeShaker will produce kind of "wobbling" (you get sea-sick),
the more the farther away from the centre.
The wrong transformation also effects sub-optimal filling of borders
and "colour masked areas".

Movements within the frames:
DeShaker analyses the movements between frames,
but then doesn't use that vector field (dense optical flow),
but takes only a "main" movement of the frame; global transformation.
For particular movements this leads to another sub-optimal reconstruction
of filling borders and "colour masked areas".

As the author thankfully provides the source code,
it could be improved by someone who's able to...
(FoV might be easier than particular movements).

I know of 2 other stabilising filters accounting FoV around here:

There is "lens transform" from @shekh.
https://forum.doom9.org/showthread.php?t=172886
But it uses only a simple interpolation (info lost) and border filling
and doesn't account rolling shutter. No code provided.
Still its results are much better FoV-wise than DeShaker.

Then there is something for AviSynth (of course there is :) ) from @wonkey_monkey:
https://forum.doom9.org/showthread.php?p=1690146
But it is only for FoV; stuck in its very first stage/ proof of concept,
and lacks for accounting all other aspects. No code anyway.

So, sadly, there is no real good deshaking so far.
We've the choice between shaken or sea-sicked ;)

AVIL
6th June 2025, 22:11
Hi nji:

I often use stabbo to stabilize vhs footage:

https://forum.doom9.org/showthread.php?t=171250

I'm very please with the result (one pass only)