OT - DeShaker Batch render?

Comments

Marco. wrote on 5/24/2007, 1:51 PM
Thanks John,

I did that but it did not solve the problem.

Then I even went the way vice versa. I modified the registry names to make the template name fit the name given in the script. No way, does not help. Though I know it's definetely only the name.
I also tried some WMV templates. Them work in the way the script runs without error message. Just VirtualDub refuses to take WMV files which does not surprise me. But this shows the script itself works fine but something is odd with the german template names somewhere in the system.

Edit:
Using the BatchRender script with same render template works fine. Very odd.

Marco
Marco. wrote on 5/24/2007, 3:05 PM
Is it possible modify the script on my own so it does not find the Vegas renderer (that "Video for Windows") by name but by number instead? It's the 16th entry in the render drop down list. So any way to tell the script take Vegas renderer #16 in the dropdown list?

Marco
johnmeyer wrote on 5/24/2007, 3:45 PM
There may be a way to do it with a number, but you should easily be able to specify a name, as long as you get the right name.

I started to reply to you earlier, but as I have mentioned, I am extremely busy now. I started to reply four hours ago. Here is what I started to write then:

Well, I guess I am being a typical American, because I am not accustomed to thinking about the subtle problems when translation is involved. I think I now know what is happening. My instructions were for changing the

So, you need to change BOTH parts of that string.


var VegasRenderTemplate : RenderTemplate =
Vegas.Renderers.FindByName("Video for Windows").Templates.FindByName("Default Template (uncompressed)");
|_________________| |______________________________|
^ ^
change this change this


Here is a script that will automatically save all the renderers to a text file so you can get the exact string you need for the first part above. You can then copy and paste the appropriate entry into the "FindByName" section of that long string. Just copy this information; paste it into Notepad, and save with an extension ".js". Then, from within Vegas, run this script and choose a name and a location to which you want to save the file. Then open that file, find the renderer name, and copy/past that into the script.

I know this is a little awkward, but you only have to do it once. I just looked at the SDK for Vegas, and to do this in a completely international way, I have to figure out the "GUID" that Ed referred to in a previous post. One such ID is:

"7f6b9fb2-61d8-4d24-999b-405396b27769";

Was ist das? Ich weiß nicht.

So, unfortunately, it is not as simple as 1,2,3,4, ...


// Quick hack to export the names of all Vegas renderers to a text file
// John Meyer, May 24, 2007

import System.IO;
import System.Windows.Forms;
import Sony.Vegas;

var MyOutput : String = "";
var writer : StreamWriter = null;

var outputFilename = ShowSaveFileDialog("Text File (*.txt)|All files (*.*)", "Save As","Renderers.txt");
writer = new StreamWriter(outputFilename, false, System.Text.Encoding.UTF8, 512);
FindRenderer();
writer.WriteLine(MyOutput);
writer.Close();

// End of script

function FindRenderer() {
var rendererEnum : Enumerator = new Enumerator(Vegas.Renderers);
while (!rendererEnum.atEnd()) {
var renderer : Renderer = Renderer(rendererEnum.item());
MyOutput = MyOutput + renderer + "\r\n";
rendererEnum.moveNext();
}
return null;
}

function ShowSaveFileDialog(filter, title, defaultFilename) : String {
var saveFileDialog = new SaveFileDialog();
if (null == filter) {
filter = "All Files (*.*)|*.*";
}
saveFileDialog.Filter = filter;
if (null != title)
saveFileDialog.Title = title;
saveFileDialog.CheckPathExists = true;
saveFileDialog.AddExtension = true;
if (null != defaultFilename) {
var initialDir = Path.GetDirectoryName(defaultFilename);
if (Directory.Exists(initialDir)) {
saveFileDialog.InitialDirectory = initialDir;
}
saveFileDialog.DefaultExt = Path.GetExtension(defaultFilename);
saveFileDialog.FileName = Path.GetFileName(defaultFilename);
}
if (System.Windows.Forms.DialogResult.OK == saveFileDialog.ShowDialog()) {
return Path.GetFullPath(saveFileDialog.FileName);
} else {
return null;
}
}



When I ran this script on my computer, running Vegas 7.0d, this is the text file it produced:

Video for Windows (*.avi)
Wave (Microsoft) (*.wav)
Sony Wave64 (*.w64)
MainConcept MPEG-2 (*.mpg)
MainConcept MPEG-1 (*.mpg)
Sony MXF (*.mxf)
Dolby Digital AC-3 (*.ac3)
MP3 Audio (*.mp3)
MainConcept AVC/AAC (*.mp4)
Sony AVC/AAC (*.mp4)
Windows Media Video V9 (*.wmv)
Windows Media Audio V9 (*.wma)
DebugMode FrameServer (*.avi)
Sony Perfect Clarity Audio (*.pca)
ATRAC Audio (*.aa3)
Audio Interchange File Format (AIFF) (*.aif)
OggVorbis (*.ogg)
Scott Studios Wave (*.wav)
RealMedia 9 (*.rm)

Marco. wrote on 5/24/2007, 4:03 PM
Thanks again John, I appreciate your help. But again this does not work. The name your script prints is exactly same to the name I first typed and then copied and pasted. Though I tried again with using the print result of that script and I even tried with and without that "(*.avi)" extension.

The error message's always same.

To me it almost looks like there might be a Vegas internal mismatch of the renderer names.

Marco
johnmeyer wrote on 5/24/2007, 4:08 PM
Well, you can't say I didn't try. Sorry, I am not going to be able to help you. Maybe someone from Sony can give us a clue ??
Marco. wrote on 5/24/2007, 4:26 PM
Just saw the edit of your previous post. I always did modify both the render and the template name. Also saved that template with another, more simple name and used that one in the script. Doesn't work either. Because a renderer like WMV works so far I think the problem is the render name instead of the template name.
Thanks again, John.

"Was ist das? Ich weiß nicht. "

Ich leider auch nicht. ;-(

Maybe Edward or a Sony tech knows if this should have helped - I replaced that "FindByName ..." by:

Renderers.FindByClassID(ea9d287b-c85a-11d3-bb3a-0050da1a5b06)

Another error messages appearing now ...

Marco



jetdv wrote on 5/24/2007, 7:06 PM
Renderers.FindByClassID(ea9d287b-c85a-11d3-bb3a-0050da1a5b06)

Change that to:


Renderers.FindByClassID(new Guid("ea9d287b-c85a-11d3-bb3a-0050da1a5b06"))
johnmeyer wrote on 5/24/2007, 10:41 PM
If Ed's approach doesn't work, go back to the list of templates you created using my script. The template name that the script provides has too much information in it. For instance, the renderer name it reports is:

Video for Windows (*.avi)

but you only want to include the first part of that:

Video for Windows

as the name for the renderer. If you include the part in the parenthesis, or the trailing blank space, it probably won't work.
Marco. wrote on 5/25/2007, 1:42 AM
As strange as it is - Renderer name definately does not work in this case (with the AVI renderer) no matter which way I try it.

But the Guid approach works fine now. Great!!!

Thanks John and Edward!

Marco
Laurence wrote on 5/25/2007, 12:18 PM
OK, now I'm looking at new possible workflows:

How does this sound:

1- Capture with HDV Split.
2- Put mt2 clips onto Vegas timeline.
3- Select any that need stabilization and run Deshaker script (using Cineform compression option).
4- Sort clips deleting ones that won't be used and trimming those that will.
5- Run Gearshift selecting "none" for proxy type and Cineform for HD file type with a destination directory defined for what will become your working files.
6- Delete temp files

File are now all ready for work in new Vegas project.
john-beale wrote on 5/25/2007, 12:29 PM
Yes, this script does work OK for me. Great work! I tried modifying it to produce Cineform Intermediate but got an error something like "this application not authorized to render to Cineform". (I gather I'd need to buy Cineform as a standalone for it to work with virtualdub, rather than what came with Vegas?)

Using the default uncompressed output works. The first thing that happens, before the VD deshake passes, is some rendering in Vegas which seems to use only about 5% of my CPU. I gather there's some disk I/O limiting things there. Maybe if I can get it to store intermediate files using my second RAID instead of the source RAID that would improve things.

Is there any quick and easy guide to the meaning of the command-line arguments the script passes to deshake? I tried to smooth out a sudden start to a tilt on a tripod shot (&@!#! sticky 501 head) and it did get smoother, but the process actually added some rotation unsteadiness, so I want to lock down the rotation (roll) parameter.
johnmeyer wrote on 5/25/2007, 1:15 PM
But the Guid approach works fine now. Great!!!

I'm glad it worked for you. Despite an email from Ed, I couldn't get it to work on my system.


I tried modifying it to produce Cineform Intermediate but got an error something like "this application not authorized to render to Cineform".

Yup, you did everything correctly. That Cineform is in VirtualDub courtesy of your Vegas install. The license from Cineform to Vegas does not include the ability to encode outside of Vegas. For that, you need to purchase a license from them.

The first thing that happens, before the VD deshake passes, is some rendering in Vegas which seems to use only about 5% of my CPU.

Yes, you are correct, although it is not really rendering. Vegas somehow needs to send each frame to VirtualDub/Deshaker. I could have used Frameserver to avoid the disk I/O, but I couldn't figure out how to batch that, and also it would be one additional thing to install, and this was getting complicated enough as is. Since uncompressed files are 10x DV size -- and even more compared to HDV -- the disk I/O is definitely a possible bottleneck.

Is there any quick and easy guide to the meaning of the command-line arguments the script passes to deshake?

Not really. The settings for the Deshaker plug-in are passed from the Vegas script to VirtualDub though a single variable called "DeshakerParams." Here is the string for normal 4:3 NTSC DV video:

9|1|30|4|0.911585|2|1|0|640|480|1|2|1|3000|3000|3000|0|4|1|0|2|5|40|300|4|c:\\Deshaker.log|0|0|0|0|0|0|0|0|0|0|0|1|0|1|99|99|99|15|1|1|30|30|0|0|0|0|1|0|0|10|1|15

This all appears on one line in the script. As you look at this, you can see that most of the parameters are pretty easy to equate to the settings in the Deshaker dialog. The"|" character is used as the delimeter to separate each variable. For instance, in the string above, you will see 3000|3000|3000|0. Those are Motion Smoothness settings in the pass 2 area. For what you want to do, you'll want to set the Rotation motion smoothness to 0, which how what Zoom motion smoothness is set. However, rather than try to figure out which of the three 3000 number settings to change, I would recommend that you open VirtualDub, load the Deshaker plugin, and set the parameters in all three columns the way you want. The dialog below shows the exact settings used as the default for NTSC 4:3 DV. For other video types, the only thing that the script changes are the settings in the first column.



Once you have set Deshaker the way you want, click on OK, and then, in VirtualDub click on File -> Save Processing Settings. Then, open the VCF file you created, using Notepad. Copy the string from the VirtualDub.video.filters.instance line into the User Modification Area in the deshake.js script. Paste it into the the line that reads:

var OverrideDeshakerParams : String = "none";

and replace "none" with this string.

I very much wanted to do a dialog in the Vegas script that would mimic the Deshaker dialog, but that turns out to be a rather complicated task.
johnmeyer wrote on 5/25/2007, 1:25 PM
Marco, before you deleted your message, if you were going to show me the exact line in the script you used, I'd sure like to see it (the one with the Guid that works).

John
Laurence wrote on 5/25/2007, 1:39 PM
If I want to pass a Cineform avi rather than an uncompressed one from Vegas to Virtualdub, what line of code would I change in this script?

Saime question with DV codec: If I wanted to pass DV codec video between Vegas and Virtualdub instead of the current uncompressed format, what would I need to change?

I picture having several scripts: one general purpose for all formats where data is passed back and forth uncompressed, one for 4:3 SD using the DV codec, one for 16:9 SD using the DV codec again, and one for HDV using Cineform.
johnmeyer wrote on 5/25/2007, 5:14 PM
If I want to pass a Cineform avi rather than an uncompressed one from Vegas to Virtualdub, what line of code would I change in this script?

I put all the modifiable variables in a section at the start of the actual code and called that section "***** USER MODIFICATION AREA ****". In that area is a variable called: VegasRenderTemplate. That controls what renderer and template are used to pass the video from Vegas to VirtualDub. Quite frankly, I wouldn't change this unless you are having a specific problem. I know of one user who has a quirky file where the fields are getting reversed by VirtualDub and it is possible that the solution may be to change this template.

So, unless you have a good reason, don't change it. However if you do want to change it, I provided painstakingly detailed instructions earlier in this thread:


Changing Vegas Template Settings

For what you are doing, leave alone the renderer portion of the line of code, and only change the template.


On my system, the edited line for Cineform looks like this:

var VegasRenderTemplate : RenderTemplate = Vegas.Renderers.FindByName("Video for Windows").Templates.FindByName("HDV 1080-60i intermediate");

and for DV:
var VegasRenderTemplate : RenderTemplate = Vegas.Renderers.FindByName("Video for Windows").Templates.FindByName("NTSC DV");

johnmeyer wrote on 5/25/2007, 7:24 PM
Here's the link to the post where from which you can get the newest revised script (as of May 25):

May 25 0.7.1 version

I am linking to my post rather than directly to the file so that I can maintain the links to the file.

Grazie gave me a problem file that revealed that when any application (well, Vegas and VirtualDub for sure) renders PAL video in uncompressed format, the aspect ratio flag for widescreen gets hosed (technical term), and the field order gets reversed (true for both normal and widescreen). Nothing I can do. While you can change both Vegas and VD to render in something other than uncompressed, if you do, then you have to change this every time you use this, and you have to change them both. I figured out a way to let Vegas fix things up after the deshaken file is returned. The one gotcha is that if you want to use the deshaken AVI in some other project, you will manually, within Vegas, need to change the PAR and field order. If you are going to need to re-use these files, then by all means change the script to use something other than uncompressed.

There are a few other small changes (if you forget to select any event, it tells you rather than just sitting there and doing nothing).
Laurence wrote on 5/25/2007, 8:35 PM
I haven't done any programming since college (back in the 80s), but looking at the code, it looks like you could move the lines where the compression types are established into the format condtion sections, that way, if the clip had DV dimensions, it would use the Main Concept DV codec, if it had HDV dimensions it would use the Cineform codec, and if it was neither of these, it would pass the file back uncompressed. Is that a good idea?
riredale wrote on 5/25/2007, 9:31 PM
You know, John, for a guy who said he didn't want to get very deep into this script thing, I'd say you've kinda gotten in deep...

The number of comments on this thread shows that there must have been a pent-up need for exactly this kind of project. It was good of you to take it on.

EDIT:
By the way, before folks try to run EVERYTHING through DeShaker, keep in mind that in addition to the processing time and slight vertical resolution loss there is also an issue when using wide-angle lenses. Due, I suspect, to barrel distortion, there are times when a wide-angle shot DeShaken has a subtle "warp wiggle" in the corners of the video. That's an official term I just coined to describe a sort of breathing movement. It's obvious on some scenes once you are looking for it, but in general I'd still take the stabilized footage over raw, and I guess one solution is to not shoot through extreme wide-angle lenses.
Laurence wrote on 5/25/2007, 9:44 PM
OK, I tried it and it seems to work. I added lines that redefined the compression variable for cases where there are 480, 576 or 1080 lines so that for DV dimensions, the Main Concept DV codec would be used and for HDV dimensions the Cineform codec would be chosen. Wha-d-ya-know, it works! DV clips get deshaken to DV codec and HDV codec clips get deshaken to Cineform. The modified lines look like this:

------------------------------------------------------------------------------------


switch (thismedia.Height) {
case 576: // PAL
VirtualDubCompressor = "dvsd"; //set VirtualDub compressor to Main Concept DV codec
.
.
.
.
.
case 1080: // HDV, 1080i -- sorry no 720p you'll need to enter your own custom string (see above notes)
VirtualDubCompressor = "cfhd"; // Set Virtualdub compression format to Cineform
.
.
.
.
.
.
case 480: // NTSC
VirtualDubCompressor = "dvsd"; //set VirtualDub compressor to Main Concept DV codec
.
.
.
.
------------------------------------------------------------------------------------

I don't have any wierd format clips to test, but hopefully they should be deshaken to the uncompressed format.

Edit:
I can see problems with my approach since the aspect ratio of Main Concept DV clips is defined in the codec setup rather than through anything Virtualdub or Vegas has access to, none-the-less, I rarely do anything other than 16:9 when I'm working in SD, and in cases where I would want to deshake 4:3 footage, I can easily right click and correct the aspect ratio of the deshaken clips.

The same issue would exist for interlaced vs. progressive for the Cineform codec. Again, it could be right click corrected. My camera (a Sony HVR-A1) doesn't do progressive, but for those with Sony V1s or Canon A1s this could be an issue.
Laurence wrote on 5/25/2007, 9:52 PM
Since the audio on the Vegas timeline is still from the original clip, how would I turn the audio off on the clips being transferred back to Vegas from VirtualDub?
Grazie wrote on 5/25/2007, 10:11 PM
You guys HAVE been busy since I went to bed?

I wake up and .. . well!

Glad to see I've been vindicated. And that I wasn't just "seeing" stuff that wasn't there NOR was I doing something wrong.

16:9 footage gets squished to a 4:3 ration and the field order gets "inverted".

I have been informed that to have VD to use MainConcept outside of the Vegas Uncompressed, then I'd need to purchase the MC codec? Correct? OR have we now moved FAR beyond needing to do this - since the need to bring 16:9 AND field order back in line appeared?

Do I still need to purchase the MC Codec?

Laurence wrote on 5/25/2007, 10:11 PM
Yeah there has been a HUGE need for exactly this sort of a program.

Another problem with Deshaken footage (in addition to the extreme wide angle problem) is that sometimes the pieces from previous or following frames that are used to fill in the edges aren't exactly the same. Examples of this are as follows:

1 somebody who is walking across the frame might end up with the lower part of his legs cut off and moved sideways.

2 branches waving in the wind might be in two different places at the top of the frame.

3 waves in a lake might have breaks in them.

This is why doing it with takes is so brilliant (in addition to it being the only possible solution). If for some reason the deshaking doesn't look right, you can easily choose the original take and be back where you started. If you want you can even do it again with more of a zoom.

This brings me to the next idea for this script:

It needs an option for more zoom and less filling in edges from other frames for those cases where you need to use that approach.

The simplest way would be two separate script options, especially since in actual use, most likely an editor would be redoing clips that looked wrong the first time the script was run.

In other words, let's say you ran the script and a couple of clips had motion problems around their edges. You would select the original takes of these and run the second variation of the script: the one with more zoom and less filling in edges from nearby frames.
Marco. wrote on 5/26/2007, 12:19 AM
I did right what Edward told me, I replaced



Renderers.FindByName("Video for Windows")


against



Renderers.FindByClassID(new Guid("ea9d287b-c85a-11d3-bb3a-0050da1a5b06"))


Marco
dreamlx wrote on 5/26/2007, 1:15 AM
I don't know if this was already said but I haven't enough time to read the whole thread. For people having problems with dull colors, the cineform codec shoould be set also to RGB (as johnmeyer described). As well, in virtualdub -> video -> video color depth, autoselect and same as decompression format should be checked.