public void onVideoEvent(VideoEvent videoEvent, int code)
 {
     if (OnVideoEvent != null)
     {
         OnVideoEvent(videoEvent, code);
     }
 }
Beispiel #2
0
        private static void PutSourcePropertyValue(ITable table, VideoEvent evnt, bool isNew)
        {
            string name;
            string infoName;

            if (evnt.Name.StartsWith("raw_"))
            {
                name     = $"RawProperty/{evnt.Name}";
                infoName = $"RawPropertyInfo/{evnt.Name}";
            }
            else
            {
                name     = $"Property/{evnt.Name}";
                infoName = $"PropertyInfo/{evnt.Name}";
            }

            switch (evnt.PropertyKind)
            {
            case PropertyKind.Boolean:
                if (isNew)
                {
                    table.SetDefaultBoolean(name, evnt.Value != 0);
                }
                else
                {
                    table.PutBoolean(name, evnt.Value != 0);
                }
                break;

            case PropertyKind.Enum:
            case PropertyKind.Integer:
                if (isNew)
                {
                    table.SetDefaultNumber(name, evnt.Value);
                    table.PutNumber($"{infoName}/min", NativeMethods.GetPropertyMin(evnt.PropertyHandle));
                    table.PutNumber($"{infoName}/max", NativeMethods.GetPropertyMax(evnt.PropertyHandle));
                    table.PutNumber($"{infoName}/step", NativeMethods.GetPropertyStep(evnt.PropertyHandle));
                    table.PutNumber($"{infoName}/default", NativeMethods.GetPropertyDefault(evnt.PropertyHandle));
                }
                else
                {
                    table.PutNumber(name, evnt.Value);
                }
                break;

            case PropertyKind.String:
                if (isNew)
                {
                    table.SetDefaultString(name, evnt.ValueStr);
                }
                else
                {
                    table.PutString(name, evnt.ValueStr);
                }
                break;

            default:
                break;
            }
        }
Beispiel #3
0
        private VideoEvent AddEffect(VideoEvent videoEvent, string effectName, string preset = null)
        {
            var pin    = Getters.EffectsGetter.GetPlugIn(effectName);
            var effect = new Effect(pin);

            return(AddEffect(videoEvent, effect, preset));
        }
 public void onBufferingProgress(VideoEvent videoEvent, int progress, int speed)
 {
     if (OnBufferingProgress != null)
     {
         OnBufferingProgress(videoEvent, progress, speed);
     }
 }
//
// Adds a given media fileName to the current track at the specified cursorPosition
//
    void InsertFileAt(Vegas vegas, string fileName, Timecode cursorPosition)
    {
        PlugInNode plugIn = vegas.Transitions.FindChildByName("VEGAS Linear Wipe");

        VideoEvent videoEvent = null;

        Media      media      = new Media(fileName);
        VideoTrack videoTrack = FindSelectedVideoTrack(vegas.Project);

        videoEvent = videoTrack.AddVideoEvent(cursorPosition, Timecode.FromSeconds(stillLength));
        Take take = videoEvent.AddTake(media.GetVideoStreamByIndex(0));

        videoEvent.MaintainAspectRatio = false;

        VideoMotionKeyframe key1 = new VideoMotionKeyframe(Timecode.FromSeconds(stillLength));

        videoEvent.VideoMotion.Keyframes.Add(key1);
        VideoMotionKeyframe key0 = videoEvent.VideoMotion.Keyframes[0];

        key0.ScaleBy(new VideoMotionVertex(initialScale, initialScale));
        key0.RotateBy(initialRotationRadians);


        Effect fx = new Effect(plugIn);

        videoEvent.FadeIn.Transition = fx;
        fx.Preset = "Top-Down, Soft Edge";
    }
Beispiel #6
0
        public void GetEndTimeStampTest()
        {
            DateTime   dtEnd = DateTime.Now;
            VideoEvent ve    = new VideoEvent(new GRLocation(0, 0), "", "", dtEnd.ToString());

            Assert.AreEqual(dtEnd.ToString(), ve.EndTimeStamp);
        }
Beispiel #7
0
    void processBlips()
    {
        selectedVideoEvent = util.GetFirstSelectedVideoEvent();

        if (selectedVideoEvent == null)
        {
            util.ShowError("No video event selected");
            return;
        }

        //Create a temporary WAV file, and export the audio span of selected video event
        string wavePath = wavUtil.CreateVideoEventWAV(selectedVideoEvent);

        if (wavePath == null)
        {
            util.ShowError("Unable to export temporary WAV");
            return;
        }

        short[] leftChannel, rightChannel;
        bool    wavReadStatus = wavUtil.ReadWav(wavePath, out leftChannel, out rightChannel);

        if (wavReadStatus == false)
        {
            util.ShowError("Unable to read WAV export file.");
            return;
        }

        //Delete the temporary file
        File.Delete(wavePath);

        //Find all blips in the right channel and split tracks at blips
        blips = wavUtil.FindBlips(rightChannel);
    }
        public void FromVegas(Vegas vegas)
        {
            try
            {
                _vegas = vegas;

                Track      track     = vegas.Project.AddVideoTrack();
                PlugInNode generator = vegas.Generators.GetChildByName("VEGAS Titles & Text");

                foreach (var region in vegas.Project.Regions)
                {
                    string text = region.Label;

                    VideoEvent e = new VideoEvent(vegas.Project, Timecode.FromMilliseconds(region.Position.ToMilliseconds()), region.Length, null);
                    track.Events.Add(e);

                    e.FadeIn.Curve  = CurveType.Linear;
                    e.FadeOut.Curve = CurveType.Linear;
                    text            = HandleAegisubTags(e, text);

                    CreateTextPreset("RegionsToTextbox", "Impress BT", 14, 0.5, 0.08, 10.0, text);
                    Media       media  = new Media(generator, "RegionsToTextbox");
                    MediaStream stream = media.Streams[0];
                    Take        take   = new Take(stream);
                    e.Takes.Add(take);
                }
            }
            catch (Exception e)
            {
                vegas.ShowError(e);
            }
        }
//
// Adds a given media fileName to the current track at the specified cursorPosition
//
    void InsertFileAt(Vegas vegas, string fileName, Timecode cursorPosition)
    {
        VideoEvent videoEvent = null;

        Media      media      = new Media(fileName);
        VideoTrack videoTrack = FindSelectedVideoTrack(vegas.Project);

        videoEvent = videoTrack.AddVideoEvent(cursorPosition, Timecode.FromSeconds(stillLength));
        Take take = videoEvent.AddTake(media.GetVideoStreamByIndex(0));

        videoEvent.MaintainAspectRatio = false;

        VideoMotionKeyframe key1 = new VideoMotionKeyframe(Timecode.FromSeconds(stillLength));

        videoEvent.VideoMotion.Keyframes.Add(key1);
        VideoMotionKeyframe key0 = videoEvent.VideoMotion.Keyframes[0];

        key0.ScaleBy(new VideoMotionVertex(initialScale, initialScale));
        key0.RotateBy(initialRotationRadians * (double)rnd.Next(-1, 1));
        key0.MoveBy(new VideoMotionVertex((float)rnd.Next(-15, 15), (float)rnd.Next(-20, 20)));

        PlugInNode plugIn = vegas.Transitions.FindChildByName(desiredTransitions[rnd.Next(0, desiredTransitions.Length - 1)]);

        Effect fx = new Effect(plugIn);

        videoEvent.FadeIn.Transition = fx;
    }
Beispiel #10
0
        public Task PublishVideoEvent(string exchange, string routing, VideoEvent video)
        {
            using (var channel = _connection.CreateModel())
            {
                channel.ExchangeDeclare(exchange: exchange, type: ExchangeType.Topic, arguments: null);
                var message = JsonConvert.SerializeObject(video);
                var body    = Encoding.UTF8.GetBytes(message);

                IBasicProperties properties = channel.CreateBasicProperties();
                properties.Persistent   = true;
                properties.DeliveryMode = 2;

                channel.ConfirmSelect();
                channel.BasicPublish(exchange: exchange, routingKey: routing, mandatory: true, basicProperties: properties, body: body);
                channel.WaitForConfirmsOrDie();

                channel.BasicAcks += (sender, eventArgs) =>
                {
                    Console.WriteLine("Sent to Event Bus");
                    //implement ack handle
                };
                channel.ConfirmSelect();
                return(Task.CompletedTask);
            }
        }
Beispiel #11
0
    public void FromVegas(Vegas vegas)
    {
        foreach (Track track in vegas.Project.Tracks)
        {
            if (track.IsValid() && track.IsVideo() && track.Selected)
            {
                foreach (TrackEvent trackEvent in track.Events)
                {
                    if (trackEvent.IsVideo())
                    {
                        VideoEvent videoEvent       = (VideoEvent)trackEvent;
                        string     currentMediaPath = videoEvent.ActiveTake.MediaPath;
                        string     pathExtension    = Path.GetExtension(currentMediaPath);

                        if (pathExtension.Equals(findExtension, StringComparison.OrdinalIgnoreCase))
                        {
                            string      replacementPath = Path.ChangeExtension(currentMediaPath, replaceExtension);
                            Media       media           = new Media(replacementPath);
                            MediaStream mediaStream     = media.GetVideoStreamByIndex(0);
                            Timecode    oldTakeOffset   = videoEvent.ActiveTake.Offset;
                            videoEvent.AddTake(mediaStream, true);
                            videoEvent.ActiveTake.Offset = oldTakeOffset;
                        }
                    }
                }
            }
        }
    }
Beispiel #12
0
        public void GetVideoFilePathTest()
        {
            string     expectedPath = "video.avi";
            VideoEvent ve           = new VideoEvent(new GRLocation(0, 0), expectedPath, "", "");

            Assert.AreEqual(expectedPath, ve.VideoFilePath);
        }
Beispiel #13
0
        private VideoEvent createText(Media media, VideoTrack track, TrackEvent eventBelow)
        {
            VideoEvent txtEvent = track.AddVideoEvent(eventBelow.Start, eventBelow.End - eventBelow.Start);
            Take       take     = txtEvent.AddTake(media.GetVideoStreamByIndex(0));

            return(txtEvent);
        }
Beispiel #14
0
 private static void OnVideo(Message msg, bool isEdited)
 {
     VideoEvent?.Invoke(new MessageEventArgs()
     {
         msg = msg, isEdited = isEdited
     });
 }
Beispiel #15
0
        // 画像トラックの作り方
        // https://www.youtube.com/watch?v=GdrXo_HiNZM
        TrackEvent AddMedia(Project project, string mediaPath, int trackIndex, Timecode start, Timecode length)
        {
#if false
            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);
            }

            // サンプル:画像はこれで追加できる
            //AddMediaImage(vegas.Project, @"C:\Users\Administrator\Desktop\mouse.png", 0, );
            {
                Media media = Media.CreateInstance(vegas.Project, @"C:\Users\Administrator\Desktop\mouse.png");
                Track track = vegas.Project.Tracks[0];
                if (track.MediaType == MediaType.Video)
                {
                    VideoTrack videoTrack = (VideoTrack)track;
                    VideoEvent videoEvent = videoTrack.AddVideoEvent(Timecode.FromSeconds(1), Timecode.FromSeconds(5));
                    Take       take       = videoEvent.AddTake(media.GetVideoStreamByIndex(0));
                    return(videoEvent);
                }
            }
#endif
            return(null);
        }
Beispiel #16
0
        void AddMedias(Vegas vegas, string file)
        {
            // トラックを追加
            Track track = new VideoTrack(0, _trackName);

            vegas.Project.Tracks.Add(track);
            track.Selected = true;
            // テキストファイルを開く
            // 1行につき1イベントを作ります
            System.IO.StreamReader sr = new System.IO.StreamReader(file, System.Text.Encoding.GetEncoding("shift_jis"));
            string line = "";

            while ((line = sr.ReadLine()) != null)
            {
                // ビデオイベント作成
                VideoEvent videoEvent = new VideoEvent(Timecode.FromSeconds(_currentTime), Timecode.FromSeconds(_timeLength));
                track.Events.Add(videoEvent);
                // Takeを作成。ここにMediaのText情報が入っている
                Take take = GenerateTakeText(vegas, line);
                if (take != null)
                {
                    videoEvent.Takes.Add(take); // イベントにテキストTakeを登録
                }
                // 次の開始位置を決める
                _currentTime += _timeLength + _timeInterval;
            }
            sr.Close();
        }
Beispiel #17
0
        public void GetStartTimeStampTest()
        {
            DateTime   dtStart = DateTime.Now;
            VideoEvent ve      = new VideoEvent(new GRLocation(0, 0), "", dtStart.ToString(), "");

            Assert.AreEqual(dtStart.ToString(), ve.StartTimeStamp);
        }
        public static string HandleAegisubTags(VideoEvent e, string text)
        {
            MatchCollection tagmatches = Regex.Matches(text, @"\{\\[^\}]+\}");

            foreach (Match tagmatch in tagmatches)
            {
                MatchCollection functionmatches = Regex.Matches(tagmatch.Value, @"\\[\w\d][^\}\\]*");
                foreach (Match functionmatch in functionmatches)
                {
                    Match fad = Regex.Match(functionmatch.Value, @"fad\(\d+(,\d+)?\)");

                    if (fad.Success)
                    {
                        MatchCollection values = Regex.Matches(fad.Value, @"\d+");

                        e.FadeIn.Length = new Timecode(int.Parse(values[0].Value));
                        if (values.Count == 2)
                        {
                            e.FadeOut.Length = new Timecode(int.Parse(values[1].Value));
                        }
                    }
                }
            }

            return(Regex.Replace(text, @"\{\\[^\}]+\}", ""));
        }
    public void FromVegas(Vegas vegas)
    {
        myVegas = vegas;
        Timecode fourF = Timecode.FromMilliseconds(133);
        Timecode sixF  = Timecode.FromMilliseconds(200);

        foreach (Track track in myVegas.Project.Tracks)
        {
            if (track.IsVideo())
            {
                foreach (TrackEvent evnt in track.Events)
                {
                    if (evnt.Selected)
                    {
                        VideoEvent videoEvent = (VideoEvent)evnt;

                        Envelope VelEnv = new Envelope(EnvelopeType.Velocity);
                        videoEvent.Envelopes.Add(VelEnv);

                        Timecode t = evnt.Start - evnt.Start;

                        EnvelopePoint a = VelEnv.Points.GetPointAtX(t);
                        if (a != null)
                        {
                            a.Y = 1.5;
                        }
                        ;

                        EnvelopePoint bTest = VelEnv.Points.GetPointAtX(fourF);
                        if (bTest == null)
                        {
                            EnvelopePoint b = new EnvelopePoint(fourF, 0.50);
                            VelEnv.Points.Add(b);
                        }
                        ;

                        a.Curve = CurveType.Fast;

                        EnvelopePoint cTest = VelEnv.Points.GetPointAtX(evnt.Length - sixF);
                        if (cTest == null)
                        {
                            EnvelopePoint c = new EnvelopePoint(evnt.Length - fourF, 0.50);
                            VelEnv.Points.Add(c);
                            c.Curve = CurveType.Slow;
                        }
                        ;

                        EnvelopePoint dTest = VelEnv.Points.GetPointAtX(evnt.Length);
                        if (dTest == null)
                        {
                            EnvelopePoint d = new EnvelopePoint(evnt.Length, 10);
                            VelEnv.Points.Add(d);
                        }
                        ;
                    }
                }
            }
        }
    }
Beispiel #20
0
    void ImportTrackEvent(XmlElement parent, TrackEvents events)
    {
        TrackEvent trackEvent = null;
        AudioEvent audioEvent = null;
        VideoEvent videoEvent = null;

        if (parent.Name == "AudioEvent")
        {
            audioEvent = new AudioEvent();
            trackEvent = (TrackEvent)audioEvent;
        }
        else if (parent.Name == "VideoEvent")
        {
            videoEvent = new VideoEvent();
            trackEvent = (TrackEvent)videoEvent;
        }
        events.Add(trackEvent);
        try { trackEvent.Name = ChildString(parent, "Name"); } catch {}
        trackEvent.Start = ChildTimecode(parent, "Start");
        Timecode length = ChildTimecode(parent, "Length");

        if (0 >= length.Nanos)
        {
            throw new ApplicationException("invalid event length");
        }
        trackEvent.Length = length;
        try { trackEvent.PlaybackRate = ChildDouble(parent, "PlaybackRate"); } catch {}
        try { trackEvent.Mute = ChildBoolean(parent, "Mute"); } catch {}
        try { trackEvent.Locked = ChildBoolean(parent, "Locked"); } catch {}
        try { trackEvent.Loop = ChildBoolean(parent, "Loop"); } catch {}
        try { trackEvent.Selected = ChildBoolean(parent, "Selected"); } catch {}
        if (null != audioEvent)
        {
            try { audioEvent.Normalize = ChildBoolean(parent, "Normalize"); } catch {}
            try { audioEvent.InvertPhase = ChildBoolean(parent, "InvertPhase"); } catch {}
            try { audioEvent.Channels = ChildChannelRemapping(parent, "Channels"); } catch {}
        }
        else if (null != videoEvent)
        {
            try { videoEvent.UnderSampleRate = ChildDouble(parent, "UnderSampleRate"); } catch {}
            try { videoEvent.MaintainAspectRatio = ChildBoolean(parent, "MaintainAspectRatio"); } catch {}
            try { videoEvent.ReduceInterlace = ChildBoolean(parent, "ReduceInterlace"); } catch {}
            try { videoEvent.ResampleMode = ChildVideoResampleMode(parent, "ResampleMode"); } catch {}
        }
        Take activeTake = ImportTakes(parent, trackEvent.Takes, trackEvent.MediaType);

        if (null != activeTake)
        {
            trackEvent.ActiveTake = activeTake;
        }
        ImportFade(parent, "FadeIn", trackEvent.FadeIn);
        ImportFade(parent, "FadeOut", trackEvent.FadeOut);
        if (null != videoEvent)
        {
            ImportEnvelopes(parent, videoEvent.Envelopes);
            ImportEffects(parent, videoEvent.Effects, myVegas.VideoFX);
            ImportVideoMotion(parent, videoEvent.VideoMotion);
        }
    }
Beispiel #21
0
    void ExportTrackEvent(XmlElement parent, TrackEvent trackEvent)
    {
        Type       type       = trackEvent.GetType();
        VideoEvent videoEvent = null;
        AudioEvent audioEvent = null;

        if (type.Name == "AudioEvent")
        {
            audioEvent = (AudioEvent)trackEvent;
        }
        else if (type.Name == "VideoEvent")
        {
            videoEvent = (VideoEvent)trackEvent;
        }
        XmlElement elt = AddChild(parent, type.Name);

        ChildString(elt, "Name", trackEvent.Name);
        ChildInt32(elt, "Index", trackEvent.Index);
        ChildObject(elt, "MediaType", trackEvent.MediaType);
        ChildTimecode(elt, "Start", trackEvent.Start);
        ChildTimecode(elt, "Length", trackEvent.Length);
        ChildTimecode(elt, "End", trackEvent.End);
        ChildDouble(elt, "PlaybackRate", trackEvent.PlaybackRate);
        ChildBoolean(elt, "Mute", trackEvent.Mute);
        ChildBoolean(elt, "Locked", trackEvent.Locked);
        ChildBoolean(elt, "Loop", trackEvent.Loop);
        ChildBoolean(elt, "Selected", trackEvent.Selected);
        if (null != audioEvent)
        {
            ChildBoolean(elt, "Normalize", audioEvent.Normalize);
            ChildBoolean(elt, "InvertPhase", audioEvent.InvertPhase);
            ChildObject(elt, "Channels", audioEvent.Channels);
        }
        else if (null != videoEvent)
        {
            ChildDouble(elt, "UnderSampleRate", videoEvent.UnderSampleRate);
            ChildBoolean(elt, "MaintainAspectRatio", videoEvent.MaintainAspectRatio);
            ChildBoolean(elt, "ReduceInterlace", videoEvent.ReduceInterlace);
            ChildObject(elt, "ResampleMode", videoEvent.ResampleMode);
        }
        ExportTakes(elt, trackEvent.Takes);
        if (null == trackEvent.ActiveTake)
        {
            AddChild(elt, "ActiveTake");
        }
        else
        {
            ChildString(elt, "ActiveTake", trackEvent.ActiveTake.Name);
        }
        ExportFade(elt, "FadeIn", trackEvent.FadeIn);
        ExportFade(elt, "FadeOut", trackEvent.FadeOut);
        if (null != videoEvent)
        {
            ExportEnvelopes(elt, videoEvent.Envelopes);
            ExportEffects(elt, videoEvent.Effects, true);
            ExportVideoMotion(elt, videoEvent.VideoMotion);
        }
    }
Beispiel #22
0
        public void RemoveEffect(VideoEvent tEvent, string effectName)
        {
            var effect = tEvent.Effects.SingleOrDefault(e => e.PlugIn.Name == effectName);

            if (effect != null)
            {
                RemoveEffect(tEvent, effect);
            }
        }
Beispiel #23
0
    public void FromVegas(Vegas vegas)
    {
        int       trackCount  = 10;
        int       eventCount  = 10;
        Timecode  eventLength = Timecode.FromSeconds(10);
        MediaType mediaType   = MediaType.Audio;

        for (int i = 0; i < trackCount; i++)
        {
            // create a track
            Track track;
            if (mediaType == MediaType.Audio)
            {
                track = new AudioTrack(i, "Audio " + ((i / 2) + 1));
            }
            else
            {
                track = new VideoTrack(i, "Video " + ((i / 2) + 1));
            }

            // add the track
            vegas.Project.Tracks.Add(track);

            Timecode startTime = Timecode.FromSeconds(0);

            for (int j = 0; j < eventCount; j++)
            {
                // create an event
                TrackEvent trackEvent;
                if (mediaType == MediaType.Audio)
                {
                    trackEvent = new AudioEvent(startTime, eventLength, "Audio Event " + (j + 1));
                }
                else
                {
                    trackEvent = new VideoEvent(startTime, eventLength, "Video Event " + (j + 1));
                }

                // add the event to the track
                track.Events.Add(trackEvent);

                // increment the start time
                startTime += eventLength;
            }

            // toggle the media type
            if (mediaType == MediaType.Audio)
            {
                mediaType = MediaType.Video;
            }
            else
            {
                mediaType = MediaType.Audio;
            }
        }
    }
Beispiel #24
0
    // --------------------------------------------------------------------
    // パーツを連結
    // --------------------------------------------------------------------
    private void ConcatParts(List <VideoPart> oVideoParts, Double oAudioLen, Double oInterval)
    {
        // トラック作成
        VideoTrack aVideoTrack = new VideoTrack(mVegas.Project, 0, TRACK_NAME);

        mVegas.Project.Tracks.Add(aVideoTrack);

        // パーツ使用数
        Int32        aUseNum = (Int32)Math.Ceiling(oAudioLen / oInterval);
        PartsUseMode aPartsUseMode;

        if (oVideoParts.Count >= aUseNum * 3)
        {
            aPartsUseMode = PartsUseMode.OnceGroup;
        }
        else if (oVideoParts.Count >= aUseNum)
        {
            aPartsUseMode = PartsUseMode.Once;
        }
        else
        {
            aPartsUseMode = PartsUseMode.Reuse;
        }

        // パーツ追加
        Random aRandom = new Random();

        for (Int32 i = 0; i < aUseNum; i++)
        {
            // パーツ番号
            Int32 aPartsIndex = aRandom.Next(0, oVideoParts.Count);

            // パーツ
            VideoEvent aVideoEvent = aVideoTrack.AddVideoEvent(new Timecode(i * oInterval), new Timecode(oInterval));
            Take       aTake       = aVideoEvent.AddTake(oVideoParts[aPartsIndex].VideoStream);
            aTake.Offset = oVideoParts[aPartsIndex].Offset;

            // パーツ廃棄
            switch (aPartsUseMode)
            {
            case PartsUseMode.Once:
                oVideoParts.RemoveAt(aPartsIndex);
                break;

            case PartsUseMode.OnceGroup:
                for (Int32 j = aPartsIndex + 1; j >= aPartsIndex - 1; j--)
                {
                    if (0 <= j && j < oVideoParts.Count)
                    {
                        oVideoParts.RemoveAt(j);
                    }
                }
                break;
            }
        }
    }
 public static void PanFromCenterToLeft(Vegas vegas, VideoEvent videoEvent)
 {
     using (UndoBlock undo = new UndoBlock("Add pan/crop"))
     {
         VideoMotionKeyframe key0 = videoEvent.VideoMotion.Keyframes[0];
         int videoWidth           = vegas.Project.Video.Width;
         VideoMotionKeyframe key1 = new VideoMotionKeyframe(Timecode.FromMilliseconds(Config.splitOffset));
         videoEvent.VideoMotion.Keyframes.Add(key1);
         key1.MoveBy(new VideoMotionVertex(videoWidth, 0));
     }
 }
Beispiel #26
0
        public void VideoEventTest()
        {
            string     expectedPath = "video.avi";
            DateTime   dtStart      = DateTime.Now;
            DateTime   dtEnd        = DateTime.Now;
            VideoEvent ve           = new VideoEvent(new GRLocation(0, 0), expectedPath, dtStart.ToString(), dtEnd.ToString());

            Assert.AreEqual(expectedPath, ve.VideoFilePath);
            Assert.AreEqual(dtStart.ToString(), ve.StartTimeStamp);
            Assert.AreEqual(dtEnd.ToString(), ve.EndTimeStamp);
        }
    private VideoEvent GetEventDifferentFrom(VideoEvent[] ve, VideoEvent comparison)
    {
        foreach (VideoEvent videoEvent in ve)
        {
            if (!videoEvent.Equals(comparison))
            {
                return(videoEvent);
            }
        }

        return(null);
    }
    private OFXEffect GetOFXFromEvent(VideoEvent ve, string effect_name)
    {
        foreach (Effect fx in ve.Effects)
        {
            if (fx.Description.Equals(effect_name))
            {
                return(fx.OFXEffect);
            }
        }

        return(null);
    }
        public MainForm(Vegas vegas)
        {
            InitializeComponent();
            MyVegas = vegas;
            R = new Random();
            TargetEvent = FirstSelectedEvent();
            TargetEvent.VideoMotion.Keyframes.Clear();
            TargetEvent.VideoMotion.Keyframes[0].Position = new Timecode(0);

            vegas.Transport.CursorPosition = TargetEvent.Start;
            UpdatePreview();
        }
Beispiel #30
0
    void ProcessBlips()
    {
        selectedVideoEvent = util.GetFirstSelectedVideoEvent();

        if (selectedVideoEvent == null)
        {
            util.ShowError("No video event selected");
            return;
        }

        TrackEventGroup selectedVideoEventGroup = selectedVideoEvent.Group;

        //take the first audio track in the selected video's group
        foreach (TrackEvent trackEventInGroup in selectedVideoEventGroup)
        {
            if (trackEventInGroup is AudioEvent)
            {
                selectedAudioEvent = trackEventInGroup as AudioEvent;
                break;
            }
        }

        if (selectedAudioEvent == null)
        {
            util.ShowError("Selected video event has no audio event in its group");
            return;
        }

        //Create a temporary WAV file, and export the audio span of selected video event
        string wavePath = wavUtil.CreateVideoEventWAV(selectedVideoEvent);

        if (wavePath == null)
        {
            util.ShowError("Unable to export temporary WAV");
            return;
        }

        short[] leftChannel, rightChannel;
        bool    wavReadStatus = wavUtil.ReadWav(wavePath, out leftChannel, out rightChannel);

        if (wavReadStatus == false)
        {
            util.ShowError("Unable to read WAV export file.");
            return;
        }

        //Delete the temporary file
        File.Delete(wavePath);

        //Find all blips in the left channel and split tracks at blips
        blips = wavUtil.FindBlips(rightChannel);
    }
Beispiel #31
0
    public void FromVegas(Vegas vegas)
    {
        TrackEvent[] tes = FindSelectedEvents(vegas.Project);
        VideoEvent[] ves = GetVideoEvents(tes);

        if (ves.Length != 1)
        {
            MessageBox.Show("You have to select exactly 1 video events (in no particular order) in order for this script to work.\n\nTerminating...", "Wrong selections", MessageBoxButtons.OK, MessageBoxIcon.Information);
            return;
        }

        VideoEvent ve = ShowFXNames(ves);
    }