public void StartRecording(string path, string name)
        {
            job = new LiveJob();
            dvs = job.AddDeviceSource(Video, Audio);
            job.ActivateSource(dvs);

            WindowsMediaOutputFormat outputFormat = new WindowsMediaOutputFormat();
            AdvancedVC1VideoProfile profile = new AdvancedVC1VideoProfile();
            profile.Bitrate = new ConstantBitrate(1280, false);
            profile.Size = new System.Drawing.Size(640, 360);

            WmaAudioProfile audioProfile = new WmaAudioProfile();

            outputFormat.AudioProfile = audioProfile;
            outputFormat.VideoProfile = profile;
            job.OutputFormat = outputFormat;

            CurrentVideoPath = Path.Combine(path, name);

            FileArchivePublishFormat fileOut = new FileArchivePublishFormat();
            fileOut.OutputFileName = CurrentVideoPath;

            job.PublishFormats.Add(fileOut);
            job.StartEncoding();

            IsRecording = true;
        }
Esempio n. 2
0
        private void btnStartStopRecording_Click(object sender, EventArgs e)
        {
            // Is it Recoring ?
            if (_bStartedRecording)
            {
                // Yes
                // Stops encoding
                _job.StopEncoding();
                btnStartStopRecording.Text = "Start Recording";
                toolStripStatusLabel1.Text = "";
                _bStartedRecording         = false;
            }
            else
            {
                // Sets up publishing format for file archival type
                FileArchivePublishFormat fileOut = new FileArchivePublishFormat();

                // Sets file path and name
                fileOut.OutputFileName = String.Format("C:\\WebCam{0:yyyyMMdd_hhmmss}.wmv", DateTime.Now);


                // Adds the format to the job. You can add additional formats as well such as
                // Publishing streams or broadcasting from a port
                _job.PublishFormats.Add(fileOut);

                // Start encoding
                _job.StartEncoding();

                btnStartStopRecording.Text = "Stop Recording";
                toolStripStatusLabel1.Text = fileOut.OutputFileName;
                _bStartedRecording         = true;
            }
        }
Esempio n. 3
0
 public bool StartRecording()
 {
     FileArchivePublishFormat = new FileArchivePublishFormat(Directory.GetCurrentDirectory() + "\\medi.um");
     LiveJob.PublishFormats.Add(FileArchivePublishFormat);
     LiveJob.StartEncoding();
     isRecording = true;
     return true;
 }
Esempio n. 4
0
        public StoryPlugin(IMessageDispatcher remote, IUIThreadDispatcher uiThreadDispatcher)
        {
            this._remote             = remote;
            this._uiThreadDispatcher = uiThreadDispatcher;
            uiThreadDispatcher.BlockingInvoke(() =>
            {
                story                 = new StoryPage();
                pluginContainer       = new Viewbox();
                pluginContainer.Child = story;
            });
            _remote.RegisterReceiveHandler("story.stopRecording",
                                           new MessageHandlerDelegateWrapper(m => endVideoCapture()));
            _remote.RegisterReceiveHandler("story.startRecording",
                                           new MessageHandlerDelegateWrapper(m => startVideoCapture(m)));
            _remote.RegisterReceiveHandler("story.saveRecording",
                                           new MessageHandlerDelegateWrapper(m => saveRecording(m)));

            foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Video))
            {
                //Debug.WriteLine("found a video deviced named: " + edv.Name);
                videoDevice = edv;
            }
            foreach (EncoderDevice edv in EncoderDevices.FindDevices(EncoderDeviceType.Audio))
            {
                //Debug.WriteLine("found a audio deviced named: " + edv.Name);
                if (edv.Name.ToLower().Contains("microphone"))
                {
                    audioDevice = edv;
                }
            }

            story.SizeChanged += new System.Windows.SizeChangedEventHandler(story_SizeChanged);
            job = new LiveJob();


            if (!System.IO.Directory.Exists("C:\\Dropbox\\" + System.Windows.Forms.SystemInformation.ComputerName + "\\videos\\"))
            {
                System.IO.Directory.CreateDirectory("C:\\Dropbox\\" + System.Windows.Forms.SystemInformation.ComputerName + "\\videos\\");
            }

            fileOut = new FileArchivePublishFormat();
            fileOut.OutputFileName = "C:\\Dropbox\\" + System.Windows.Forms.SystemInformation.ComputerName + "\\videos\\tempVideo.wmv";
            System.Console.WriteLine(fileOut.OutputFileName);
        }
        public string StartRecording(string path, string name)
        {
            job = new LiveJob();
            dvs = job.AddDeviceSource(null, audioEncoder);
            job.ActivateSource(dvs);

            WindowsMediaOutputFormat outputFormat = new WindowsMediaOutputFormat()
            {
                AudioProfile = new WmaAudioProfile()
            };

            job.OutputFormat = outputFormat;

            string currentRecordingPath = Path.Combine(path, name);
            FileArchivePublishFormat fileOut = new FileArchivePublishFormat();
            fileOut.OutputFileName = currentRecordingPath;

            job.PublishFormats.Add(fileOut);
            job.StartEncoding();

            IsRecording = true;

            return currentRecordingPath;
        }
Esempio n. 6
0
        private string VideoCapture(Collection <EncoderDevice> Vdevices)
        {
            // Starts new job for preview window
            LiveJob _job = new LiveJob();

            // Create a new device source. We use the first audio and video devices on the system
            LiveDeviceSource _deviceSource = _job.AddDeviceSource(Vdevices[0], null);

            // Make this source the active one
            _job.ActivateSource(_deviceSource);

            FileArchivePublishFormat fileOut = new FileArchivePublishFormat();


            // Sets file path and name
            string path   = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);
            string output = String.Format(@"{0}\Constellation{1:yyyyMMdd_hhmmss}", path, DateTime.Now);

            fileOut.OutputFileName = string.Format("{0}.wmv", output);


            // Adds the format to the job. You can add additional formats
            // as well such as Publishing streams or broadcasting from a port
            _job.PublishFormats.Add(fileOut);


            // Starts encoding
            _job.StartEncoding();

            Thread.Sleep(3000);

            _job.StopEncoding();

            _job.RemoveDeviceSource(_deviceSource);
            return(output);
        }
Esempio n. 7
0
        /// <summary>
        /// Starts/Stops recording of the video from chosen device
        /// </summary>
        void recordVideo()
        {
            try
            {
                // Is it Recoring ?
                if (_bStartedRecording)
                {
                    // Yes
                    // Stops encoding
                    _job.StopEncoding();

                    _bStartedRecording = false;
                    this.Invoke(new EventHandler(DisplayRecordStatus));
                }
                else
                {
                    // Sets up publishing format for file archival type
                    FileArchivePublishFormat fileOut = new FileArchivePublishFormat();

                    // Sets file path and name
                    fileOut.OutputFileName = String.Format("C:\\WebCam{0:yyyyMMdd_hhmmss}.wmv", DateTime.Now);

                    // Adds the format to the job. You can add additional formats as well such as
                    // Publishing streams or broadcasting from a port
                    _job.PublishFormats.Add(fileOut);

                    // Start encoding
                    _job.StartEncoding();

                    _bStartedRecording = true;
                    this.Invoke(new EventHandler(DisplayRecordStatus));
                }
            }
            catch (Exception error)
            {
                debugText = error.Message;
            }
        }
Esempio n. 8
0
        private void btnGrabar_Click(object sender, EventArgs e)
        {
            if (ID <= 0)
            {
                return;
            }

            btnGrabar.Enabled  = false;
            btnDetener.Enabled = true;

            try
            {
                ListaDispositivos = new List <ObjVideo>();

                foreach (var item in ugDispositivos.Rows)
                {
                    item.Cells["Estado"].Value = "Grabando...";
                    ObjVideo dispositivo = new ObjVideo();

                    EncoderDevice video = null;
                    EncoderDevice audio = null;

                    GetSelectedVideoAndAudioDevices(out video, out audio, item.Cells["ID"].Value.ToString());

                    if (video == null)
                    {
                        return;
                    }

                    dispositivo.Job = new LiveJob();

                    if (!dispositivo.BStartedRecording)
                    {
                        if (video != null)
                        {
                            dispositivo.DeviceSource = dispositivo.Job.AddDeviceSource(video, audio);

                            dispositivo.DeviceSource.PickBestVideoFormat(new Size(1280, 720), 1);
                            SourceProperties sp = dispositivo.DeviceSource.SourcePropertiesSnapshot();
                            dispositivo.Job.OutputFormat.VideoProfile.Size = new Size(sp.Size.Width, sp.Size.Height);
                            dispositivo.Job.ActivateSource(dispositivo.DeviceSource);
                        }
                        else
                        {
                            MessageBox.Show("No Video/Audio capture devices have been found.", "Warning");
                        }
                    }

                    if (dispositivo.BStartedRecording)
                    {
                        dispositivo.Job.StopEncoding();
                        dispositivo.BStartedRecording = false;
                        video = null;
                        audio = null;
                    }
                    else
                    {
                        FileArchivePublishFormat fileOut = new FileArchivePublishFormat();
                        Random rnd = new Random();
                        dispositivo.FileName = "C:\\Video\\CAM{0:yyyyMMdd_hhmmss}-" + rnd.Next(10) + ".wmv";

                        fileOut.OutputFileName = String.Format(dispositivo.FileName, DateTime.Now);

                        dispositivo.FileName = fileOut.OutputFileName;

                        dispositivo.Job.PublishFormats.Add(fileOut);
                        dispositivo.Job.StartEncoding();

                        dispositivo.BStartedRecording = true;
                    }

                    dispositivo.Id = item.Cells["ID"].Value.ToString();
                    ListaDispositivos.Add(dispositivo);
                }
            }
            catch (Exception ex)
            {
                btnDetener.Enabled = true;
                btnGrabar.Enabled  = false;
                ListaDispositivos.Clear();
                ListaDispositivos = null;

                this.SetMensaje(ex.Message, 5000, Color.Red, Color.White);
            }
        }
Esempio n. 9
0
 /// <summary>
 /// Record video of the selected webcam and save into a wmv file
 /// </summary>
 /// <param name="outputPath">Path of the output file (ex: "C:\... \video1.wmv")</param>
 /// <returns>Return true if the recording is starting with success</returns>
 public bool StartRecording(String outputPath)
 {
     if (outputPath.Length > 0)
     {
         FileArchivePublishFormat = new FileArchivePublishFormat();
         FileArchivePublishFormat.OutputFileName = outputPath;
         LiveJob.PublishFormats.Add(FileArchivePublishFormat);
         LiveJob.StartEncoding();
         IsRecording = true;
         return true;
     }
     return false;
 }
Esempio n. 10
0
 /// <summary>
 /// Starts the recording of the video
 /// </summary>
 private void startRecord()
 {
     this.isRecording = true;
     //change the status of the WaLLBoT
     this.SetTextStatus(mainScreen.BoTStatusStr[(int)mainScreen.BoTStatus.Recording]);
     //more in-your face message
     Messenger message = new Messenger("WaLLBoT Recording");
     message.ShowDialog();
     //start the recoding limit of 5 minutes
     recordingLimTimer.Enabled = true;
     // Sets up publishing format for file archival type
     fileOut = new FileArchivePublishFormat();
     // Sets file path and name
     //check the number of videos recorded at start by counting how many videos have been recorded
     //System.IO.DirectoryInfo dir = new System.IO.DirectoryInfo(mainFrame.theSettings.savePath);
     //MessageBox.Show(
     //mainFrame.numRecorded = dir.GetFiles().Length;
     fileOut.OutputFileName = mainFrame.theSettings.savePath + "Message_" + (mainFrame.numRecorded+1) + ".wmv";
     //prepares to publish the file, even as one of the 3 file types
     mainFrame.audVidJob.PublishFormats.Add(fileOut);
     // Start encoding (recording video)
     mainFrame.audVidJob.StartEncoding();
 }
Esempio n. 11
0
        private void btnStartStopRecording_Click(object sender, EventArgs e)
        {
            // Is it Recoring ?
            if (_bStartedRecording)
            {
                // Yes
                // Stops encoding
                _job.StopEncoding();
                btnStartStopRecording.Text = "Start Recording";
                toolStripStatusLabel1.Text = "";
                _bStartedRecording = false;
            }
            else
            {
                // Sets up publishing format for file archival type
                FileArchivePublishFormat fileOut = new FileArchivePublishFormat();

                // Sets file path and name
                fileOut.OutputFileName = String.Format("D:\\Radical Graphics Storage\\Meat Project\\WebCam{0:yyyyMMdd_hhmmss}.wmv", DateTime.Now);

                // Adds the format to the job. You can add additional formats as well such as
                // Publishing streams or broadcasting from a port
                _job.PublishFormats.Add(fileOut);

                // Start encoding
                _job.StartEncoding();

                btnStartStopRecording.Text = "Stop Recording";
                toolStripStatusLabel1.Text = fileOut.OutputFileName;
                _bStartedRecording = true;
            }
        }
Esempio n. 12
0
        public void StartCapture()
        {
            if (!IsCapturing)
            {
                job = new LiveJob();
                dvs = job.AddDeviceSource(SelectedVideoDevice, SelectedAudioDevice);
                job.ActivateSource(dvs);
                job.ApplyPreset(LivePresets.VC1HighSpeedBroadband4x3);

                double epoch = GetUnixEpoch(DateTime.UtcNow);
                string timestamp = epoch.ToString();
                VideoFileName = string.Format(VIDEO_FILE, timestamp);

                FileArchivePublishFormat fileOut = new FileArchivePublishFormat();
                fileOut.OutputFileName = Path.Combine(FileLocationUtility.GetVideoFolderLoctation(), VideoFileName);

                job.PublishFormats.Add(fileOut);
                job.StartEncoding();

                started = DateTime.UtcNow;
                IsCapturing = true;
            }
        }