Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.IO;
- using ScriptPortal.Vegas;
- using System.Windows.Forms;
- namespace AddingmediatoVegas
- {
- public class EntryPoint
- {
- public void FromVegas(Vegas myVegas)
- {
- try
- {
- Timecode cursorPosition = myVegas.Transport.CursorPosition;
- var gap = 10;
- string videoPath = "D:\\Home Videos\\green.png";
- VideoEvent V1event = (VideoEvent)AddMedia(myVegas.Project, videoPath, 0, Timecode.FromSeconds(0), Timecode.FromSeconds(gap));
- string videoPath2 = "D:\\Home Videos\\red.png";
- VideoEvent V2event = (VideoEvent)AddMedia(myVegas.Project, videoPath2, 0, Timecode.FromSeconds(0+gap), Timecode.FromSeconds(gap));
- string videoPath3 = "D:\\Home Videos\\green.png";
- VideoEvent V3event = (VideoEvent)AddMedia(myVegas.Project, videoPath3, 0, Timecode.FromSeconds(0+2*gap), Timecode.FromSeconds(gap));
- }
- catch (Exception ex)
- {
- MessageBox.Show(ex.Message);
- }
- }
- TrackEvent AddMedia(Project project, string mediaPath, int trackIndex, Timecode start, Timecode length)
- {
- Media media = Media.CreateInstance(project, mediaPath);
- Track track = project.Tracks[trackIndex];
- if (track.MediaType == MediaType.Video)
- {
- VideoTrack videoTrack = (VideoTrack)track;
- VideoEvent videoEvent = videoTrack.AddVideoEvent(start, length);
- Take take = videoEvent.AddTake(media.GetVideoStreamByIndex(0));
- return videoEvent;
- }
- else if (track.MediaType == MediaType.Audio)
- {
- AudioTrack audioTrack = (AudioTrack)track;
- AudioEvent audioEvent = audioTrack.AddAudioEvent(start, length);
- Take take = audioEvent.AddTake(media.GetAudioStreamByIndex(0));
- return audioEvent;
- }
- return null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment