New Deshaker

Andy E wrote on 5/1/2009, 10:45 AM 1st May 2009. Change/Bug fix release.

Fix: Change made to generated VirtualDub command line.
Fix: Checkbox for "Ignore pixels inside" on Pass 1 now saved/loaded.
Fix: Clear method on event's VideoMotion Keyframes collection doesn't remove first keyframe. All keyframes now individually removed.

Change: log4net logging removed to due to extremely crap behaviour and replaced with my own.
Change: Logging default is now INFO instead of DEBUG.
Change: Tooltips added to dialogs.
Change: Choosing location of the VD script file now defaults to showing *.vds files.
Change: Support for Deshaker Filter presets added.
Change: Presets can be imported and exported.
Change: Removing effects and pan/crop settings prior to render is now optional (default is removal).

New Features

Presets have been added to Version They can be edited, deleted, saved, imported and exported. New presets are created by editing an existing one and changing the name of the preset. On click OK you will be prompted to answer "YES" to create a new preset or "NO" to overwrite the existing one. All presets can be deleted but there can never be zero presets. If you delete all of your own a preset called "Original" will be automatically added to the list - this is a preset that matches the original Deshaker settings. Saving presets saves them to New Deshaker's configuration file (nowhere else). Import and Export allow taking presets from and saving them to an external file. Use this option to move presets to another computer or to share presets with other users.

On the Preset dialog itself are four new items. An edit box to change the name, an undo button which will undo all the changes you made after clicking on the Edit Preset button (sorry that's as granular as the undo is at the moment) and a "reset to original" button which removes everything you've done and sets the preset back to the original Deshaker settings (useful if you want to start from scratch).

In addition, there is a "toggle tooltips" button. Tooltips have been added to both dialogs. However this button does not affect the tooltips that are displayed when you hover over buttons etc at the top of the Preset dialog or the whole of New Deshaker dialog itself. This only affects giving help on the filter settings. The help text is, in some cases, somewhat large and has been lifted directly from the filter homepage. Everywhere that "I" is mentioned relates to the author of the filter and not me. A browser link to the filter's homepage has also been added at the bottom next to the OK and Cancel buttons.

Another new option is the ability to choose whether or to remove Video Effects or Pan/Crop settings prior to deshaking the video. The default is removal (as per the original Deshaker) and these checkboxes will initially be ticked. Unchecking these options will result in warning dialogs being displayed and if left unchecked the text background of these options will be red to draw attention to that fact.

It is important to understand the ramifications of unchecking these options. *All* effects and pan/crop settings will end up being rendered out and therefore part of the new take. The corollary is that they are then disabled (in the case of effects) or removed (pan/crop) from the original event. This is to prevent them being applied twice to the new take. Obviously, they will no longer be available to the original take - although in the case of the video effects they can at least be re-enabled. If that's not what you want, *don't* uncheck these options.

Edit: Meant to add that John Meyer has very kindly sent me some Deshaker settings that I'll put up on the website for download and import over the weekend - haven't had a chance to play with them myself yet :-)

These are the result of a good few hours of work on his behalf and my thanks go to him for his willingness to share.


Grazie wrote on 5/2/2009, 2:33 AM
Oh, this is GOOD!

Nice, clean, USER Friendly Menu.

The tooltips are essential for me. AND you have made them relevant and pertinent to what I could be "challenged" about. PLUS you have added that extra umph!: A Reason why I SHOULD do something. I like that, and something I wish other developers would embrace too.

Testing some really old VHS DV converted material - EXCELLENT!

I'll be looking forward to trying out others "filters" as and when they come available.

Andy - You are a Vegas Star-Man in the firmament of "Vegas Stars"!


JJKizak wrote on 5/2/2009, 6:39 AM
In Vista 64 ultimate when you open the main menu in New Deshaker the "save" button is lined up in the proper place. If you stretch the menu at the bottom the "save" button remains in place and all the other buttons stretch properly. No big deal though as everything works OK. The initial installation has "Sony\Vegas Pro 8.0C\Script" and "Program Files" is left out. Is this on purpose? I installed mine in "Program Files (x86).
Tim L wrote on 5/2/2009, 7:16 AM

I downloaded and installed this using the self-extracting zips and using default locations for everything. I also have default locations for my Vegas install.

Vegas 8.0c, Win XP 32, SP3

In Vegas I select Tools > Scripting > New Deshaker and I get a pop-up window that says "An error occurred during execution of the script C:\Program Files\Sony\Vegas Pro 8.0\Script Menu\New Deshaker.dll. Exception thrown by method called"

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not find file 'C:\Program Files\Sony\Vegas Pro 8.0\New Deshaker.log'.

Maybe its looking to open the log file, but doesn't create a new one if it doesn't exist already? Or do I have something else going on?


UPDATE: I went into my Vegas folder, right-clicked and made an empty file (via notepad) called "New Deshaker.log", and then the script executed properly.

I should point out, though, that when I was trying this I wasn't really thinking and just had an empty Vegas project with no event selected (in fact, no media at all in the project). So initially, I got the "exception thrown" dialog, then I created an empty log file, then I got the "No event was selected" message (of course). I dragged in a piece of media, got the config window (had to set my temporary render location), and then everything worked fine.

As with John Meyers' earlier version, this is VERY much appreciated. I'm a hobbyist, and would probably be too intimidated to learn the manual process of running deshaker from virtual dub, but John and now you have put this process at my fingertips in a very user-friendly process.

I also like your new addition of the inbound render, as I tend to leave my projects on my hard drives and the old uncompressed deshake files were pretty large.

Thank You to both of you (and to Grazie for posting the link on the Vegas forum).
goodrichm wrote on 5/2/2009, 7:39 AM
I got the same "Exception thrown by method called" error as Tim L when I tried to run the latest 1.1 script. Script doesn't load/nothing happens after clicking OK on error message.

To get it working, I created an empty file in NotePad called 'New Deshaker.log' and saved it in Vegas' exe directory. Everything works great now. After running the script and closing down Vegas, I checked out the blank 'New Deshaker.log' I created and it has log info it now so script is definitely using it.

Looks like the script isn't automatically generating the 'New Deshaker.log' if it's missing.

Thank you so much Andy for sharing this little gem! It's awesome!

Here's a copy of the error I got before I made the bandaid fix (Vegas 8.0c, Win XP 32, SP2):

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.FileNotFoundException: Could not find file 'G:\Vegas_Pro_8\New Deshaker.log'.
File name: 'G:\Vegas_Pro_8\New Deshaker.log'
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileInfo.get_Length()
at ASC_Design.Utils.Logger.Initialise(String path, Level level)
at ASC_Design.Utils.Logger.Initialise(String path, String level)
at New_Deshaker.EntryPoint.InitializeModule(Vegas vegas)
at New_Deshaker.EntryPoint.FromVegas(Vegas vegas)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sony.Vegas.ScriptHost.ScriptManager.Run(Assembly asm, String className, String methodName)
at Sony.Vegas.ScriptHost.PrecompiledScriptManager.Run()
at Sony.Vegas.ScriptHost.RunScript(Boolean fCompileOnly)
johnmeyer wrote on 5/2/2009, 9:20 AM
I do not understand the default in the second line of the dialog:

This is pointing to my old script file, something that is totally irrelevant to this new version. I went ahead and started the script with the default values and got this error:

Error during script execution at line 1, column 2: parse error

I then got another error in an alert titled: "New Deshaker" which said:

Despite planning for all possible contingencies
Deshaker script had the following error:

System.NullReferenceException: Object reference not set to an instance of an object.
at New_Deshaker.EntryPoint.Deshake(VideoEvent ve)
at New_Deshaker.EntryPoint.NewDeshaker(Object sender,EventArgs args)

I then changed the second line of the script to read instead:

C:\Program Files\Video\Deshaker.vds

and everything ran just fine.

I don't know how Grazie managed to get around this :)

So, the problem is that for some reason -- depending on some installation that some of us have -- the wrong value is being used as the default for this setting.

JJKizak wrote on 5/2/2009, 9:29 AM
All of my New Deshaker files were correctly pointed too after deleting the old files and installing the new files. But I did have to add "Program Files (x86) to the install chain in Vista 64.
johnmeyer wrote on 5/2/2009, 9:46 AM
I tried saving and then importing presets, but could not get this feature to work.

I clicked on the far right-hand icon ("Export Deshaker Filter presets to external file") and saved it in a file called "test". I then opened this file in Notepad and change "Default" to JHM and changed one value. This is what it looked like:


I saved this file.

I then clicked on the "Import Deshaker Filter presets ..." button and selected this file. However, when I clicked on the "Filter preset" listbox, my JHM preset was not there.

I then exported the presets to a new file, and opened this in Notepad. This preset file did indeed contain both the default AND my new preset.

So, it looks like the preset import/export logic is working, but it doesn't look like the new presets are being hooked up to the selection dialog.

[edit] I just found that if I SAVE the preset, quit out of the script, and then run the script again, my preset DOES show up. Merely saving does NOT cause it to show up. I have to first quit the script and then re-start the script.
Andy E wrote on 5/2/2009, 9:56 AM
So, it looks like the preset import/export logic is working, but it doesn't look like the new presets are being hooked up to the selection dialog.

Sounds like I need to update a couple of things sharpish....

There were a lot of changes that went into this release (not all visible) and I should have also thanked Einar Ritsmer for his work in testing the new functionality over the last few days (well he did volunteer).

johnmeyer wrote on 5/2/2009, 10:05 AM

I have liked everything you've done so far. This is really good stuff!!

Having tried, I know what a pain it is to get the list of Virtualdub codecs (there is probably some code buried in various VD filters that could be "borrowed" ...). This is not a high priority, and in fact doesn't need to be done for most people. However, since you DID provide the "Virtuadub Compressor" setting (normally set to zero), perhaps you can provide a short readme file in one of your zips (you can have these pop up at the end of the unzipping process). In that readme, you could tell them to simply copy the FOURCC code shown in the VirtualDub Video --> Compression dialog:

into this area of the dialog.
Andy E wrote on 5/2/2009, 10:28 AM
I think I might provide a more detailed tooltip that gives that info as well.

I'm just going to have a spot of grub and then I'll post an updated bugfix release.
Andy E wrote on 5/2/2009, 12:34 PM 2nd May 2009. Change/Bug fix release.

Fix: Checking the logfile size now checks to see if it actually exists first.
Fix: Datasource for presets combo box is now reset prior to preset import.
Fix: Dialogs are now fixed size.

Change: Tooltip expanded for VirtualDub compressor.
Change: Readme included with archive.

John - Can't explain that issue with the old JS file appearing at all. Defaults are only used if you've not got New Deshaker installed at all. New settings are taken from the "New Deshaker.dll.config" file and placed in a file called "User.config". If you do a search under C:\Documents and Settings\<username> you'll find one or more of those files. If you open up "New Deshaker.dll.config" you won't find any of your changes in there - only the shipped defaults - they'll all be in User.config.

JJK - Don't understand what's going on with Vista - but that's a general issue with me as regards Vista :-). What I really need to do is write a proper installer for the next version.

Speaking of the next version, it's been under development for a while to include a VirtualDub compression dialog. I ended up having to wade through the VD source code. My problem is that I end up with more compression codecs that VD does. I have a solution that works but I will need the assistance of the good folks here to check whether it works for others - and most importantly for others using different OSes (Vista being the obvious issue here).

I shall be posting a test script shortly which will output a list of codecs which I will need compared with the list shown by VirtualDub. If they're the same we're good to go.

johnmeyer wrote on 5/2/2009, 5:17 PM
New settings are taken from the "New Deshaker.dll.config" file and placed in a file called "User.config". If you do a search under C:\Documents and Settings\<username> you'll find one or more of those files.I did a search on all my drives and found two instances of the "New Deshaker.dll.config" file, and also the "User.config" file that relates to your script. I deleted them all, then re-copied the contents of the zip file, and then re-ran the script. This time it gave me the correct file. Very strange.

Sorry that I cannot duplicate the problem.
Tom Pauncz wrote on 5/4/2009, 7:19 AM
Kudos for all your hard work. Love it!

A QQ - I installed the new deshaker as an extension as per readme. If I go via 'View > Extensions' it doesn't show. If I go to 'Tools > Extensions' it does. Is this easily explained?

It would be nice to the new deshaker as a tab where i have Project Media,Media FX, Media Manager, Trimmer etc...

jetdv wrote on 5/4/2009, 8:06 AM
If I go via 'View > Extensions' it doesn't show. If I go to 'Tools > Extensions' it does.

There are three different types of extensions:
Edit - Extensions
View - Extensions
Tools - Extensions

Custom Commands can be setup to work in any of those three.
Tom Pauncz wrote on 5/4/2009, 9:01 AM
Gotcha. Thanks Ed.
Now is the choice up to the author or the user?
Is it simply where the files are placed?
Thanks ...
jetdv wrote on 5/4/2009, 9:13 AM
The choice is up to the author of the Custom Command. In my case, I put Excalibur and Project Inspector under View as they open windows that really should be open an extended period of time. I put Auto Save under Tools as it's more of a "tool" but doesn't need a window that stays open.

However, the author is free to choose whether it should be "Edit", "View", or "Tools".
Tom Pauncz wrote on 5/4/2009, 9:23 AM
Again, thanks.
I downloaded the SDK and read up on it. Got a much better feel and understanding.,
Andy E wrote on 5/4/2009, 1:00 PM
Actually the author has made it possible for the user to choose :-)

If you open up the "New Deshaker.dll.config" file and search for CommandCategory you can change the value from Tools to something else.

You can also change the icon and command name if you want to as well.
jetdv wrote on 5/4/2009, 1:11 PM
I will say... that's a cool idea.
Tom Pauncz wrote on 5/4/2009, 6:27 PM
Hmmm ...

Tried it, set it to 'View' as I'd like to have it in a tab and always open, but doesn't show up under 'View >Extensions'. Seems like it had no effect.

I have the package in both Script Menu and Application Data... \Application Extensions.

Andy E wrote on 5/5/2009, 1:00 AM
Tried it, set it to 'View' as I'd like to have it in a tab and always open, but doesn't show up under 'View >Extensions'. Seems like it had no effect.

When testing this myself, I was merrily changing the CommandCategory within my development environment, rebuilding and retesting and of course it all works lovely.

Turns out there's a limitation in the reading of configuration files for .NET libraries (.DLLs) as opposed to applications (.EXEs). No thanks for Microsoft for this info, it took some trawling on the Web to find.

I'll need to provide an update to get this to work....
ritsmer wrote on 5/6/2009, 6:25 AM
Hi Andy

Have you put the Deshaker presets on the net for download?

Looking forward to see- and use them.
Andy E wrote on 5/6/2009, 6:59 AM
PM sent.
Andy E wrote on 5/7/2009, 10:33 PM
Update fixes the issue with being unable to change the CommandCategory (also affected changing the logging level as well). There is now a version for Vegas 7. Should work against 7.0d but only tested on my behalf against 7.0e. 7th May 2009. Change/Bug fix release.

Fix: The CommandCategory can now be successfully changed in the config file (Vegas 8 only).

Change: Application-scope settings are now read from the config file.
Change: Checks for correct file locations and render path validity now made on startup.
Change: Common code-base now supports both Vegas 7 and Vegas 8 via conditional compilation.
Change: Vegas 8 version changed from from 1.* to 8.*.
Change: Windows installers created for both Vegas 7 & Vegas 8 versions.