Using Gunnar Thalin's excellent Deshaker-plugin can be tedious because of settings. This script generates the necessary AviSynth and VirtualDub-scripts with some default-settings so that it can be done in a single stroke. Note that VirtualDub and AviSynth are seperate applications. Do not reach out to the creators of these application because of this tools' incapability to generate working scripts.
The idea is do most of the heavy lifting in AviSynth, yet VirtualDub is used for analysis passes. This makes it easier to use a different tool for these passes. Additionally AviSynth maintains decent documentation and description of internal filters. The general steps are:
- Count number of frames (this can be cancelled once started).
- Run first deshaker pass
- Run second deshaker pass and first video analysis pass
- Repeat the second deshaker pass and run second video analysis pass
Consequently, running the second deshaker pass twice circumvents having to use a lossless intermediate video at the cost of some compute. Moreover this tool, now rewritten in luigi, scaffolds a few scripts that are entirely open for modification. In some cases a script be rerun with different settings without having to rerun all. Naturally, changes cascades through the chain of scripts. So any change made affect later tasks. A working Powershell version is also available but not maintained.
- VirtualDub x86-version
- Deshaker-plugin x86-version (the VDF should be unzipped into repository root).
- Avisynth ^2.6
- Some video formats requires FFMPEG DLLs for AviSynth FFMS ^2
- Move files from
ffm2-2.20-icl/x86
toProgram Files (x86)/AviSynth 2.5/plugins
Common use case there is little more to it than:
- Setup repository root a PYTHONPATH.
- Run
luigi --module tasks DeshakeAllPasses --path video/MVI_2970.MOV --local-scheduler
(replace the video file) - This starts VirtualDub and start reporting on total number of frames via the AviSynth-logger. You can close this almost immediately. A total of six scripts should have been created.
- deshake.MVI_2970.all.jobs
- deshake.MVI_2970.framecount.avs
- deshake.MVI_2970.framecount.script
- deshake.MVI_2970.pass1.avs
- deshake.MVI_2970.pass2.avs
- deshake.MVI_2970.stats.log
- Open VirtualDub and select Job Control in the File-menu.
- Navigate to the location of scripts and open deshake.GOPR0260.all.jobs
- Create a job as per usual i.e:
PS > .\deshake.ps1 C:\**\GOPR0260.MP4
- Interupt the framecounter once a total number of frames has been captured
- Change number of scripts by adding additional sources with FFAudioSource and FFVideoSource
- Splice them together with AudioDub and AlignedSplice.
- Simulating color correction in dark scenarios using the following
Tweak(sat=1.20)
andLevels(25, 1.33, 245, 0, 255)
LoadVirtualDubPlugin ("C:\devwork\ps-avisynth-deshake\Deshaker.vdf", "deshaker", preroll=0)
A1 = FFAudioSource("X:\2016-11-06\HERO5 Black 2\260\GOPR0260.MP4")
V1 = FFVideoSource("X:\HERO5 Black 2\260\GOPR0260.MP4")
A2 = FFAudioSource("X:\HERO5 Black 2\260\GP010260.MP4")
V2 = FFVideoSource("X:\HERO5 Black 2\260\GP010260.MP4")
# AlignedSplice(AudioDub(V1, A1).ConvertToRGB32(matrix="PC.709"),AudioDub(V2, A2).ConvertToRGB32(matrix="PC.709"))
AlignedSplice(AudioDub(V1, A1),AudioDub(V2, A2))
Trim(28853, 29508)
ConvertToYUY2()
Tweak(sat=1.20)
Levels(25, 1.33, 245, 0, 255)
# Deshaker("19|1|30|4|1|0|1|0|640|480|1|2|1000|1000|1000|1000|4|1|3|2|8|30|300|4|C:\\usr\\xyz\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|0|0|1|10|10|5|10|0|0|30|30|0|0|1|0|1|1|0|10|1000|1|90|1|1|20|5000|100|20|1|0|ff00ff")
- Blog post on how to do this on linux with WINE
- http://avisynth.nl/index.php/FAQ_loading_clips