예제 #1
0
        public override void StartCaptionVideo(string path)
        {
            var date = DateTime.Now.Year + "y-" + DateTime.Now.Month + "m-" + DateTime.Now.Day + "d-" +
                       DateTime.Now.Hour + "h-" + DateTime.Now.Minute + "m-" + DateTime.Now.Second + "s";

            string currentpath;

            if (String.IsNullOrEmpty(path))
            {
                currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mp4";
            }
            else
            {
                currentpath = path + "\\" + date + ".mp4";
            }

            MotionDirectoryPath = path;

            MotionFilePath = currentpath;

            Mpeg4Recorder = new MPEG4Recorder(currentpath);
            Mpeg4Recorder.MultiplexFinished += Mpeg4RecorderMultiplexFinished;

            Connector.Connect(_camera.AudioChannel, Mpeg4Recorder.AudioRecorder);
            Connector.Connect(_camera.VideoChannel, Mpeg4Recorder.VideoRecorder);

            Log.Motion("Video capture has been started");
            Log.Write("The captured video will be saved at the location: " + currentpath);
        }
예제 #2
0
        public override void StartCaptionVideo(string path)
        {
            if (_camera == null)
            {
                return;
            }

            var date = DateTime.Now.Year + "y-" + DateTime.Now.Month + "m-" + DateTime.Now.Day + "d-" +
                       DateTime.Now.Hour + "h-" + DateTime.Now.Minute + "m-" + DateTime.Now.Second + "s";

            string currentpath;

            if (String.IsNullOrEmpty(path))
            {
                currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mp4";
            }
            else
            {
                currentpath = path + "\\" + date + ".mp4";
            }

            Mpeg4Recorder  = new MPEG4Recorder(currentpath);
            MotionFilePath = currentpath;

            _microphone.Start();
            Connector.Connect(_microphone, Mpeg4Recorder.AudioRecorder);
            Connector.Connect(_camera, Mpeg4Recorder.VideoRecorder);

            Log.Motion("Video capture has been started");
            Log.Write("The captured video will be saved at the location: " + currentpath);
        }
예제 #3
0
        private void btnStartrec3_Click(object sender, EventArgs e)
        {
            try
            {
                var Path = "C:\\Users\\Public\\Documents";
                var date = DateTime.Now.Year + "y-" + DateTime.Now.Month + "m-" + DateTime.Now.Day + "d-" +
                           DateTime.Now.Hour + "h-" + DateTime.Now.Minute + "m-" + DateTime.Now.Second + "s";
                string currentpath3;

                if (String.IsNullOrEmpty(Path))
                {
                    currentpath3 = date + ".mp4";
                }
                else
                {
                    currentpath3 = Path + "\\" + date + ".mp4";
                }

                _mpeg4Recorder3 = new MPEG4Recorder(currentpath3);
                _mpeg4Recorder3.MultiplexFinished += Mpeg4Recorder_MultiplexFinished3;

                _connector3.Connect(_mjpegConnection3.AudioChannel, _mpeg4Recorder3.AudioRecorder);
                _connector3.Connect(_mjpegConnection3.VideoChannel, _mpeg4Recorder3.VideoRecorder);
                if (_mpeg4Recorder3 != null)
                {
                    MessageBox.Show("Video saved to : " + Path);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Camera is not connected");
            }
        }
예제 #4
0
 public void StartRecording()
 {
     _firstFrameTime = new Stopwatch();
     _firstFrameTime.Start();
     _filePath = _configuration.VideosFolderPath + _configuration.GenerateFileName() + _configuration.VideoFormat;
     _recorder = new MPEG4Recorder(_filePath);
     _recorder.MultiplexFinished += recorder_MultiplexFinished;
     _connector.Connect(_videoSender, _recorder.VideoRecorder);
 }
        private void StartCapture_Click(object sender, RoutedEventArgs e)
        {
            if (_videoSender == null)
            {
                return;
            }
            var date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" +
                       DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second;
            var currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mpeg4";

            _recorder = new MPEG4Recorder(currentpath);
            _recorder.MultiplexFinished += _recorder_MultiplexFinished;
            _connector.Connect(_videoSender, _recorder.VideoRecorder);
        }
예제 #6
0
        private void CaptureStart()
        {
            if (_camera.VideoChannel == null)
            {
                return;
            }
            var date = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day + "-" +
                       DateTime.Now.Hour + "-" + DateTime.Now.Minute + "-" + DateTime.Now.Second;

            var currentpath = "c:\\" + date + ".mpeg4"; //AppDomain.CurrentDomain.BaseDirectory + date + ".mpeg4";

            _recorder = new MPEG4Recorder(currentpath);
            _recorder.MultiplexFinished += _recorder_MultiplexFinished;

            _connector.Connect(_camera.VideoChannel, _recorder.VideoRecorder);
        }
예제 #7
0
        private void StartVideoCapture(string path)
        {
            var date = DateTime.Now.Year + "y-" + DateTime.Now.Month + "m-" + DateTime.Now.Day + "d-" +
                       DateTime.Now.Hour + "h-" + DateTime.Now.Minute + "m-" + DateTime.Now.Second + "s";
            string currentpath;

            if (String.IsNullOrEmpty(path))
            {
                currentpath = date + ".mp4";
            }
            else
            {
                currentpath = path + "\\" + date + ".mp4";
            }

            _mpeg4Recorder = new MPEG4Recorder(currentpath);
            _mpeg4Recorder.MultiplexFinished += Mpeg4Recorder_MultiplexFinished;
            _connector.Connect(_camera.AudioChannel, _mpeg4Recorder.AudioRecorder);
            _connector.Connect(_camera.VideoChannel, _mpeg4Recorder.VideoRecorder);
        }
        public override void StartCaptionVideo(string path)
        {
            var date = DateTime.Now.Year + "y-" + DateTime.Now.Month + "m-" + DateTime.Now.Day + "d-" +
                       DateTime.Now.Hour + "h-" + DateTime.Now.Minute + "m-" + DateTime.Now.Second + "s";

            string currentpath;
            if (String.IsNullOrEmpty(path))
                currentpath = AppDomain.CurrentDomain.BaseDirectory + date + ".mp4";
            else
                currentpath = path + "\\" + date + ".mp4";

            MotionDirectoryPath = path;

            MotionFilePath = currentpath;

            Mpeg4Recorder = new MPEG4Recorder(currentpath);
            Mpeg4Recorder.MultiplexFinished += Mpeg4RecorderMultiplexFinished;

            Connector.Connect(_camera.AudioChannel, Mpeg4Recorder.AudioRecorder);
            Connector.Connect(_camera.VideoChannel, Mpeg4Recorder.VideoRecorder);

            Log.Motion("Video capture has been started");
            Log.Write("The captured video will be saved at the location: " + currentpath);
        }
        /// <summary>
        /// Start capturing video 
        /// </summary>
        void StartVideoCapturing()
        {
            Log.Write("StartVideoCapturing() started");

            if (camera.VideoChannel != null)
            {
                Log.Write("StartVideoCapturing() Camera" + id + ".CurrentFrameRate: " + camera.CurrentFrameRate.ToString());
                videoResizer.SetOptions(camera.Resolution, camera.CurrentFrameRate);
                Log.Write("StopVideoCapturing() Connecting camera.VideoChannel and videoResizer");
                connector.Connect(camera.VideoChannel, videoResizer);

                var filePath = GetFileName();
                Log.Write("StartVideoCapturing() Video file path set to: " + filePath);
                recorder = new MPEG4Recorder(filePath);
                Log.Write("StopVideoCapturing() Connecting videoResizer and recorder.VideoRecorder");
                connector.Connect(videoResizer, recorder.VideoRecorder);
                recorder.MultiplexFinished += recorder_MultiplexFinished;
                //connector.Connect(_camera.AudioChannel, _recorder.AudioRecorder);

                if (Settings.RecordOnMotion)
                {
                    StartTimer(minRecTimer, Settings.MinVideoLength);
                    StartTimer(maxRecTimer, Settings.MaxVideoLength);
                }
                //Raise recording event
                OnVideoCapturingStateChanged(this, new VideoCapturingEventArgs(VideoCapturingState.Recording));
            }
            Log.Write("StartVideoCapturing() ended");
        }
        void MinRecordingTimeElapsed(object sender, MPEG4Recorder recorder)
        {
            Log.Write("MinRecordingTimeElapsed() started");

            StopTimer(minRecTimer);
            Log.Write("MinRecordingTimeElapsed() MinTimer ended!");

            //If a false MotionDetectionEvent has been raised, stop the capturing and reset the maxRecTimer
            //otherwise continue with the recording
            Log.Write("motion.Detection == " + inMotion);
            if (!inMotion)
            {
                Log.Write("MinRecordingTimeElapsed() Motion has stopped, stopping the video capturing");
                StopTimer(maxRecTimer);
                Log.Write("MinRecordingTimeElapsed() MaxTimer forced to end!");
                StopVideoCapturing();
            }
            else
                Log.Write("MinRecordingTimeElapsed() There is still motion, so continue with the video capturing");
            //connector.Disconnect(camera.VideoChannel, recorder.VideoRecorder);
            Log.Write("MinRecordingTimeElapsed() ended");
        }
        /// <summary>
        /// Maximum video length time has ellapsed
        /// Stop all recording, 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="recorder"></param>
        void MaxRecordingTimeElapsed(object sender, MPEG4Recorder recorder)
        {
            Log.Write("MaxRecordingTimeElapsed() started");
            if (!videoCapturingState.Equals(VideoCapturingState.Recording))
                return;

            StopTimer(minRecTimer);
            Log.Write("MaxRecordingTimeElapsed() MaxTimer ended!");
            StopVideoCapturing();

            //If there is still motion, start a new recording
            if (inMotion)
            {
                Log.Write("MaxRecordingTimeElapsed() inMotion == true, so starting a new recording");
                StartVideoCapturing();
            }
            //connector.Disconnect(camera.VideoChannel, recorder.VideoRecorder);
            Log.Write("MaxRecordingTimeElapsed() ended");
        }