Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums VEGAS Pro Advanced Scripting Question – Creating MediaStreams

  • Advanced Scripting Question – Creating MediaStreams

    Posted by Matt Carlson on March 21, 2013 at 2:22 am

    I wrote a function to take a selected clip from the media pool and like a mini-edl import edit it with respect to selected events on the timeline. For the moment it works to solve my current problem but there are a few things that in the future I would like to have ironed out.

    The script is slow because creating Subclips takes time with multiple iterations. This is a workaround for my initial idea of just creating a mediastream from the selected media. That does not seem to be possible, however. A media object does not have an .AddMediaStream function or something similar, only read functions. Ideally I would like this function to mimic splitting a clip on the timeline i.e. creating streams on the original selected media. I did create the script at one point to use the media (physically) dragged to the timeline. The splitting and moving of the events was instantaneous but the creation of a new timeline order did cause some iteration logic errors in complex situations. I also would prefer not having the instance on the timeline in the first place.

    Here is the function.

    private void SyncSelected(Media selectedMedia, TrackEvent selectedEvent, Track sTrack, Track destinationTrack, Int32 descriptor, Boolean dogroup, Vegas vegas)
    {
    Take selectedTake = selectedEvent.ActiveTake;

    Subclip sClip = new Subclip(selectedMedia.FilePath, selectedTake.Offset,selectedTake.Length,false,”SyncClip” + descriptor.ToString());

    VideoEvent newevent = new VideoEvent(selectedEvent.Start,selectedEvent.Length);
    destinationTrack.Events.Add(newevent);
    MediaStream ms = sClip.Streams[0];
    Take synced = new Take(ms);
    newevent.Takes.Add(synced);

    if (dogroup)
    {
    TrackEventGroup group = new TrackEventGroup();
    vegas.Project.Groups.Add(group);
    group.Add(newevent);
    group.Add(selectedEvent);
    }
    }

    Is there a way to create a media stream on “selectedMedia” without going the subclip route? I figured I would try here first before going to the much less read Sony scripting forum.

    Matt Carlson replied 13 years, 4 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy