Playback rate (30fps to 29.97) change script.

Laurence wrote on 7/24/2010, 5:08 PM
Is there any script that will slow down the playback rate of all selected clips 1/1000. If I go into the properties of each individual clip and slow them down to .999 of their original speed, 30fps becomes 29.97 (which is exactly what I want).

Excalibur only works to 100ths precision. I can slow down all the selected clips to .99 of their original speed, but not .999 which is the exact number I need to correct the frame rate.

Better yet, if a script could go through a project and only slow down the clips that were at exactly 30fps and leave ones that were already at 29.97, that would be even better.

Comments

JohnnyRoy wrote on 7/25/2010, 8:12 AM
> Excalibur only works to 100ths precision. I can slow down all the selected clips to .99 of their original speed, but not .999 which is the exact number I need to correct the frame rate.

Ultimate S Pro 4 can do this. It replicates the Video Event Properties window exactly and allows you to change any of the properties exactly the same way Vegas does. Both Playback rate and Undersample are accurate to .999 just like Vegas.

Are you sure you want to adjust the playback rate and not the undersample rate? I would think that you would want to change the undersample rate.

~jr
Laurence wrote on 7/25/2010, 11:21 AM
What exactly is the difference between the undersample rate and the playback rate? What I want to do is slow down the playback slightly so that it is 29.97 instead of 30 frames per second. It seems like a slightly slower playback rate would be the way to accomplish this but I'm not sure.

When I render out the 30 fps footage at 29.97 I see all sorts of double images and ghosting. When I slow down the playback rate to .999 of it's original speed, the ghosts and double images disappear. Because this worked I didn't try changing the undersample rate but it is entirely possible that that is a better way to do it.
altarvic wrote on 7/25/2010, 1:17 PM
Use Search Media Bins & Select Timeline Events built-in commands for quick finding and selecting 30fps clips.In addition to those already mentioned tools you can freely try Vegasaur. It contains Quick Properties tool that allows you to change various event properties, create transitions etc.
Rosebud wrote on 7/25/2010, 2:25 PM
When I render out the 30 fps footage at 29.97 I see all sorts of double images and ghosting.

You should have a look to Proxy Stream 1.5e. It allow you to anable/disable the resample switch of the imported clip.
Laurence wrote on 7/25/2010, 5:24 PM
Disabling the resample would get rid of the ghosting, but you'd have a dropped frame every so often (which with Murphy's law would almost certainly happen at the most inopportune and obvious times). I'd rather just slow it down an exact amount if I could.
JohnnyRoy wrote on 7/25/2010, 5:53 PM
> What exactly is the difference between the undersample rate and the playback rate?

Playback rate will synthesize/blend frames to speed up or slow down playback. Undersample will only slow down by sampling less frames. I don't think it will blend frames (just drop them).

> What I want to do is slow down the playback slightly so that it is 29.97 instead of 30 frames per second. It seems like a slightly slower playback rate would be the way to accomplish this but I'm not sure.

While I would obviously rather you purchase Ultimate S Pro ;-)... Here is a script to do what you want.


//****************************************************************************
//* Program: Fix30pMedia.cs
//* Author: John Rofrano
//* Description: This script changes the playback rate of 30p media to 29.97
//* Created: July 25, 2010
//* Updated: Jul 28, 2010 (JR) Added Disable Resample
//* Aug 4, 2010 (JR) Changed audio to match video
//*
//* Copyright: (c) 2010, Sundance Media Group / VASST. All Rights Reserved
//****************************************************************************
using System;
using System.Collections;
using System.Windows.Forms;
using Sony.Vegas;

class EntryPoint
{
public void FromVegas(Vegas vegas)
{
int counter = 0;
try
{
foreach (Track track in vegas.Project.Tracks)
{
if (!track.IsVideo()) continue;

foreach (VideoEvent videoEvent in track.Events)
{
VideoStream videoStream = videoEvent.ActiveTake.MediaStream as VideoStream;
decimal frameRate = Math.Round((decimal)videoStream.FrameRate, 2);

// only affect 30fps media
if (frameRate == 30.00m)
{
videoEvent.AdjustPlaybackRate(0.999, true);
videoEvent.ResampleMode = VideoResampleMode.Disable;
counter++;

// check for audio in the same file and change it too
if (videoEvent.IsGrouped)
{
foreach (TrackEvent trackEvent in videoEvent.Group)
{
if (!trackEvent.IsAudio()) continue;

// see if they are from the same file
if (trackEvent.ActiveTake != null && trackEvent.ActiveTake.MediaPath.Equals(videoEvent.ActiveTake.MediaPath))
{
AudioEvent audioEvent = trackEvent as AudioEvent;
audioEvent.AdjustPlaybackRate(0.999, true);
}
}
}
}
}
}

// let the user know we are done
MessageBox.Show(String.Format("{0} events changed", counter), "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
catch (Exception e)
{
MessageBox.Show(e.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
}
}

Edit: (Jul 28, 2010) Added Disable Resample
Edit: (Aug 4, 2010) Changed audio to match video

~jr
Laurence wrote on 7/25/2010, 5:57 PM
Actually, I have Ultimate-S Pro and Excalibur already. This is something I'm going to do so often though that I really appreciate the custom script.
Laurence wrote on 7/25/2010, 6:04 PM
JR, when I run your script I get the following error message:

An error occurred during execution of the script c:\Program Files\Sony\Vegas Pro 9.0\Script menu\30 to 29.97.js

or the long version:

C:\Program Files\Sony\Vegas Pro 9.0\Script Menu\30 to 29.97.js(8) : Syntax error. Write 'var identifier : Type' rather than 'Type identifier' to declare a typed variable
Laurence wrote on 7/25/2010, 8:16 PM
I just figured out that I can change the properties on one clip, control-c that clip, then select all the clips I want to change in the same way and choose "paste event properties". Cool. Not as cool as if the JR script worked, but pretty cool none-the-less. The "paste attributes" is yet another thing that probably everybody else already knows, but hey, it's new to me! :-)
jetdv wrote on 7/26/2010, 8:50 AM
Laurence, it's a simple matter to change to three decimal points vs. two decimal points. If you wish, I can can send you an updated version that allows three decimal places. Just send me an e-mail if you wish.
JohnnyRoy wrote on 7/26/2010, 11:15 AM
> JR, when I run your script I get the following error message:
> An error occurred during execution of the script c:\Program Files\Sony\Vegas Pro 9.0\Script menu\30 to 29.97.js
> Error 0x80131500 (message missing)

Laurence, Sorry, I should have been more clear. If you read the comments at the top of the script, the name is "Fix 30p PlaybackRate.cs" not ".js". This is not JavaScript it's C#. The filename must end with ".cs". Just rename your file and you should be fine.

~jr
Laurence wrote on 7/26/2010, 9:31 PM
JR:

Your script is wonderful! I absolutely love it! I love how it goes through a project and just fixes the clips that need the rate change and leaves the rest alone. Great programming!

Now it just needs one small tweak. How about adding a line so that it turns off the smart resample in all the converted clips. That way if the new frame rate isn't exactly perfect, there won't be any added ghosting. I haven't noticed any ghosting as I go pause at still frames to check, but you never know what you might run into and I'd rather have an odd doubled or dropped frame than the ghosting.

This script is really something that a lot of people should find useful. It should be posted somewhere where it will receive more attention.

Laurence
Laurence wrote on 7/27/2010, 12:01 AM
I also wanted to mention that the 30fps to 29.97 change script works really well with DVFilm Epic 1.
JohnnyRoy wrote on 7/28/2010, 8:09 PM
> Now it just needs one small tweak. How about adding a line so that it turns off the smart resample in all the converted clips. That way if the new frame rate isn't exactly perfect, there won't be any added ghosting

Done. I edited the original post to add disable resample. Just take another copy from there.

Enjoy,

~jr
Laurence wrote on 7/29/2010, 1:16 PM
Thanks JR. Now it is simply perfect. I really want to share it with other DVFilm Epic users. How do you want me to do this? If you post it on your site, I'll link to it. If not I can post it somewhere. What would you prefer? This is a real problem solver for Canon DSLR users.
JohnnyRoy wrote on 7/29/2010, 2:02 PM
I will post it on my site when I get home from work tonight. I'll update this post and put the URL here. Glad to help out the community with this.

~jr
Laurence wrote on 7/29/2010, 3:29 PM
Awesome. From there I will post it in the Vegas and DV Film Epic forums. This script takes a major problem with Canon footage and makes it a non-issue.
JohnnyRoy wrote on 7/30/2010, 5:16 AM
OK, I created a page for them. I will add some more when I get some time this weekend. I have a bunch of free scripts that I've written over the years.

If you can hold off posting this for another day, I'd rather have a bigger list of scripts. I just don't have time to do that right now.

Here is the URL: http://www.johnrofrano.com/vegasscripts.htm

~jr
Laurence wrote on 7/30/2010, 8:39 AM
No problem. Let me know when you are ready.
JohnnyRoy wrote on 7/30/2010, 8:14 PM
Go for it. I've got seven scripts up there now. I'll add more as time goes on. Thanks,

~jr
Laurence wrote on 8/2/2010, 1:04 PM
On the 30fps to 29.97 slowdown script, is there anyway to slow down the audio an equal amount as well?

Edit: Maybe with elastique audio (I'm adding hopefully).
JohnnyRoy wrote on 8/4/2010, 4:36 AM
> is there anyway to slow down the audio an equal amount as well?

Yup, just added it to the script above. I also updated the version on my web site so you can grab it from there was well. In my testing on Vegas Pro 9.0e, élastique was the default stretch method (there was no way to select it from a script).

~jr
Laurence wrote on 8/4/2010, 6:01 PM
Thanks so much J.R. This makes my life so much easier. I absolutely LOVE my Canon SX1-IS. The sensor is too small and it looks pretty horrible indoors, but outdoors it looks just stunning, so that's where I use it. Unlike the Canon DSLR, the SX1-IS has an articulated screen and with the facial recognition and lens stabilization it is literally point and shoot pressing one button for pictures and the other for video. Video is full 1080p. One thing with this camera is that when the screen flips out to the left side and points up, it rests on your left hand and gives you surprisingly stable footage hand held with no extra stabilization bracket. Very cool. The audio is amazingly good as well for stereo b-roll. About on par with my Olympus LS-10 I would say using the built in mics on both devices. Now with Epic 1 and your script, I can use this footage really easily.

Another slight modification to the script that would be really useful to me would be to have a version that slowed the footage down to 23.97 for 24p projects. For instance I am going to Kenya and Tanzania for a three week documentary shoot and am bringing my SX-1 IS in addition to my Sony HVR-Z7U. We are shooting 24p, but there are times when I might use the SX-1 IS for b-roll. In the past I have just used the 30p to 24p slowdown with Cineform's HD-Link, but a 30p to 24p version of your script would work really well and use up less hard disk space. I have found the slight slowdown looks like very subtle slow motion and is quite appealing visually.

The editing of the Africa shoot is going to be done by someone else in FCP, but I have a feeling I'll be prepping the footage so that they can use it.

Thanks again for taking the time to write this script. About half of why I like Vegas is my collection of scripts, many of which you wrote.
Kanst wrote on 12/5/2010, 1:08 PM
IMHO this script have a mistake...
It Adjust Playback Rate instead Undersample Rate