DV Info Net

DV Info Net (https://www.dvinfo.net/forum/)
-   What Happens in Vegas... (https://www.dvinfo.net/forum/what-happens-vegas/)
-   -   Help to crop pictures on a slideshow (https://www.dvinfo.net/forum/what-happens-vegas/377250-help-crop-pictures-slideshow.html)

Marcus Martell September 9th, 2009 02:10 AM

Help to crop pictures on a slideshow
 
Hola chicos,
i have a question for you: I have 300 pictures that i'm putting on a slideshow, now i ask you how can i avoid to open every single picture to crop it as 16:9?I tryed to do the following things: edited the first clip then , selected the events to end , then i've added a bit of quick blur and cropped to 16:9 but it pastes just the quick blur to every single clip but not the aspect ratio.What can i do?

Thx a lot

Chris Harding September 9th, 2009 02:23 AM

Hi Marcus

Go to track motion and make sure that the aspect ratio icon and size around centre icon is selected then just drag the box until any one of the images fill the screen correctly.

By using track motion all events on the track are resized!

I personally prefer to resize my images to the correct aspect first.That way you can control what part of the image is important. Allowing track motion to resize might chop off parts that may be important. However 300 pics are a lot of work!! By cropping you will also lose a bit of resolution if the aspect is a normal image aspect of 1.33!!

In PAL land we need to make our images for an SD DVD, 1048x576 to be widescreen!!!

Chris

Marcus Martell September 9th, 2009 03:21 AM

Hallo, how can i avoid to set for every single picture the "reduce interlace flicker" function?

Thx

Edward Troxel September 9th, 2009 06:57 AM

Marcus, this is where scripting comes in really handy. There are scripts out there that will do a "Match Output Aspect" on every selected image. There are also scripts that will apply the "Reduce Interlace Flicker" to selected images. Using Excalibur, I can do both of these changes AND add Ken Burns style movements at the touch of a button - seconds later, all are finished. Excalibur does cost but there are free solutions out there for matching the output aspect and adding reduce interlace flicker.

Marcus Martell September 9th, 2009 08:40 AM

Hey Ed,thank you for your attention, unfortunately i don't know any free script.....:(
If i have to tell u the truth: almost never use the scripts

maybe it's time to get started

Edward Troxel September 9th, 2009 09:51 AM

Scripts are really WONDERFUL time savers.

For the Reduce Interlace Flicker, just select all the images, right-click ONE of them, choose Switches - Reduce Interlace Flicker, and they should all change.

For Match Output Aspect, copy this to Notepad and save as "MatchAspect.js"

Code:

// "Match Output Aspect" on all selected video events.
// No selection = ALL

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

var zero : int = 0;

function GetSelectionCount (mediaType)
{
    var cTracks  = Vegas.Project.Tracks.Count;
    var cSelected = zero;
    var ii;
   
    for (ii = zero; ii < cTracks; ii ++)
    {
        var track = Vegas.Project.Tracks[ii];
       
        if (track.MediaType == mediaType)
        {           
            var eventEnum : Enumerator = new Enumerator(track.Events);
       
            while ( ! eventEnum.atEnd() )
            {           
                if (eventEnum.item().Selected)
                {               
                    cSelected ++;     
                }
               
                eventEnum.moveNext();                           
            }
        }                                 
    }
   
    return cSelected;
}

function GetActiveMediaStream (trackEvent : TrackEvent)
{
    try
    {
        if ( ! trackEvent.ActiveTake.IsValid())
        {
            throw "empty or invalid take";
        }               
       
        var media = Vegas.Project.MediaPool.Find (trackEvent.ActiveTake.MediaPath);
       
        if (null == media)
        {
            throw "missing media";
        }
       
        var mediaStream = media.Streams.GetItemByMediaType (MediaType.Video, trackEvent.ActiveTake.StreamIndex);       
       
        return mediaStream;
    }
    catch (e)
    {
        //MessageBox.Show(e);
        return null;
    }   
}

function MatchOutputAspect (keyframe : VideoMotionKeyframe, dMediaPixelAspect : double, dAspectOut : double)
{
    var keyframeSave = keyframe;
       
    try
    {
        var rotation = keyframe.Rotation;   
       
        // undo rotation so that we can get at correct aspect ratio.
        //
        keyframe.RotateBy (-rotation);

        var dWidth        = Math.abs(keyframe.TopRight.X  - keyframe.TopLeft.X);
        var dHeight        = Math.abs(keyframe.BottomLeft.Y - keyframe.TopLeft.Y);
        var dCurrentAspect = dMediaPixelAspect * dWidth / dHeight;
        var centerY        = keyframe.Center.Y;
        var centerX        = keyframe.Center.X;       
       
        var dFactor;
       
        var bounds = new VideoMotionBounds(keyframe.TopLeft, keyframe.TopRight, keyframe.BottomRight, keyframe.BottomLeft);

        if (dCurrentAspect < dAspectOut)
        {
            // alter y coords           
            dFactor = dCurrentAspect / dAspectOut;           
                       
            bounds.TopLeft.Y    = (bounds.TopLeft.Y    - centerY) * dFactor + centerY;
            bounds.TopRight.Y    = (bounds.TopRight.Y    - centerY) * dFactor + centerY;
            bounds.BottomLeft.Y  = (bounds.BottomLeft.Y  - centerY) * dFactor + centerY;
            bounds.BottomRight.Y = (bounds.BottomRight.Y - centerY) * dFactor + centerY;           
        }
        else
        {                         
            // alter x coords
            dFactor = dAspectOut / dCurrentAspect;           
                       
            bounds.TopLeft.X    = (bounds.TopLeft.X    - centerX) * dFactor + centerX;
            bounds.TopRight.X    = (bounds.TopRight.X    - centerX) * dFactor + centerX;
            bounds.BottomLeft.X  = (bounds.BottomLeft.X  - centerX) * dFactor + centerX;
            bounds.BottomRight.X = (bounds.BottomRight.X - centerX) * dFactor + centerX;
        }
       
        // set it to new bounds
        keyframe.Bounds = bounds;
       
        // restore rotation.       
        keyframe.RotateBy (rotation);
       
    }
    catch (e)
    {
        // restore original settings on error
        keyframe = keyframeSave;
        MessageBox.Show("MatchOuput: " + e);
    }   
}


var dWidthProject  = Vegas.Project.Video.Width;
var dHeightProject = Vegas.Project.Video.Height;
var dPixelAspect  = Vegas.Project.Video.PixelAspectRatio;
var dAspect        = dPixelAspect * dWidthProject / dHeightProject;
var cSelected      = GetSelectionCount (MediaType.Video);


var cTracks = Vegas.Project.Tracks.Count;
var ii;

for (ii = zero; ii < cTracks; ii ++)
{
    var track  = Vegas.Project.Tracks[ii];
   
    if (! track.IsVideo())
    {
        continue;
    }
   
    var eventEnum : Enumerator = new Enumerator(track.Events);       
   
    while ( ! eventEnum.atEnd() )
    {
        var trackEvent : TrackEvent = eventEnum.item();                                   
       
        if ( !cSelected || trackEvent.Selected )
        {                                           
            var mediaStream = GetActiveMediaStream (trackEvent);               
           
            if (mediaStream)
            {                                   
                var videoStream = VideoStream (mediaStream);
                   
                var dMediaPixelAspect = videoStream.PixelAspectRatio;
                var videoEvent        = VideoEvent(eventEnum.item());   
                var keyframes        = videoEvent.VideoMotion.Keyframes;
               
                var cKeyframes = keyframes.Count;
                var jj;
               
                for (jj = zero; jj < cKeyframes; jj ++)
                {
                    MatchOutputAspect (keyframes[jj], dMediaPixelAspect, dAspect);                                                                   
                }
            }
        }
       
        eventEnum.moveNext();
    }
}


Vegas.UpdateUI();


Marcus Martell September 11th, 2009 10:37 AM

Thank you Ed, should i get it as a word file or what else?Never worked with the scripts....
Send a big thank you

Mike Kujbida September 11th, 2009 10:49 AM

Marcus, open up Notepad, copy all the code in the script Edward provided and paste this into Notepad.
From Notepad, do File-Save As.
In the window that comes up, enter MatchAspect.js in the File Name box, change the option in the Save as type: dropdown box from Text Documents (*.txt) to All Files.
Doing this ensures that it gets saved with the proper extension.
One you save it, copy/move it to the Script directory in your version of Vegas.

Marcus Martell September 12th, 2009 10:52 AM

Hi Mike, sorry 4 da question:
where can i find the notepad?
Mike remember: u r My MJ!LOL
thx

Mike Kujbida September 12th, 2009 11:50 AM

Thanks again for the compliment Marcus :-)
Notepad is found (in XP) by going Start - Programs - Accessories - Notepad.

Edward Troxel September 12th, 2009 12:49 PM

The key is that you want it to be a PLAIN TEXT file - you do NOT want any formatting Word would put into the document.


All times are GMT -6. The time now is 01:09 AM.

DV Info Net -- Real Names, Real People, Real Info!
1998-2024 The Digital Video Information Network