I have a huge quanity of stills I need to change from square pixels to dv sized pixels.
I tried to modify the ChangeMediaAspectRatio script but had no sucess, anyone can help me on this one ?
As I understand, your script only works with video events and changes the pixel aspect ratio of all the video files in the media pool.
What I would need is the same script but to convert still images (my images are .psd file) I need to convert them from 1.000 to 0.9091. Also if possible, i'd need this script to affect files only in a specified media pool directory. If not possible it could affect only .psd file or only still images on a specified track.
Thanks for your help !
Nat, There is no way to affect just one media bin that I can see from the Script API. I also don’t think there’s even a way to just affect the selected files because clips in the media bins don’t have a selected attribute. So I modified my script to process media based on file extension and set it up to process .psd files for you. I’ll probably modify it to add a dialog box which prompts for the file extension but this should get you up and running for now:
/**
* Program: ChangeMediaPoolAspectRatioPSD.js
* Description: This script will change the aspect ration of all the video media in
* the project's media pool that end with the extension .psd
* to match that of the project.
*
* Author: Johnny (Roy) Rofrano john_rofano at hotmail dot com
*
* Date: March 28, 2004
* April 27, 2004 - Updated for Vegas 5 libraries
* April 29, 2004 - Modified to only affect PSD files.
*
**/
import System.IO;
import System.Windows.Forms;
//import SonicFoundry.Vegas;
import Sony.Vegas;
// Get the aspect ration of the project
var aspectRatio = Vegas.Project.Video.PixelAspectRatio;
// Change this to the extension you want to affect
var extFilter = ".psd";
var counter = 0;
try
{
for (var media in Vegas.Project.MediaPool)
{
// only add the effect if the media object has a video stream.
if (media.HasVideo())
{
// only process files with the correct extension
if (String.Compare(Path.GetExtension(media.FilePath), extFilter, true) == 0)
{
// get the video stream
var video : VideoStream = media.Streams.GetItemByMediaType(MediaType.Video,0);
// Set the aspect ratio
video.PixelAspectRatio = aspectRatio;
counter++;
}
}
}
MessageBox.Show(counter + " Video stream(s) changed to " + aspectRatio);
}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
/* END OF FILE */