Пример #1
0
        private async void btStart_Click(object sender, EventArgs e)
        {
#if !NETCOREAPP
            if (onvifControl != null)
            {
                onvifControl.Disconnect();
                onvifControl.Dispose();
                onvifControl = null;

                btONVIFConnect.Text = "Connect";
            }
#endif

            mmLog.Clear();

            VideoCapture1.Debug_Mode = cbDebugMode.Checked;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_RecordAudio = cbIPAudioCapture.Checked;
            VideoCapture1.Audio_PlayAudio   = cbIPAudioCapture.Checked;

            VideoCapture1.Video_Renderer_SetAuto();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            // source
            VideoCapture1.IP_Camera_Source = new IPCameraSourceSettings
            {
                URL = cbIPURL.Text
            };

            switch (cbIPCameraType.SelectedIndex)
            {
            case 0:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_VLC;
                break;

            case 1:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_FFMPEG;
                break;

            case 2:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_LAV;
                break;

            case 3:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_Live555;
                break;

            case 4:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_FFMPEG;
                break;

            case 5:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.MMS_WMV;
                break;

            case 6:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_UDP_FFMPEG;
                break;

            case 7:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_TCP_FFMPEG;
                break;

            case 8:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_HTTP_FFMPEG;
                break;

            case 9:
            {
                // audio not supported
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_MJPEG_LowLatency;
                VideoCapture1.Audio_RecordAudio     = false;
                VideoCapture1.Audio_PlayAudio       = false;
                cbIPAudioCapture.Checked            = false;
            }
            break;

            case 10:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = false;
                break;

            case 11:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = true;
                break;

            case 12:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.NDI;
                break;
            }

            VideoCapture1.IP_Camera_Source.AudioCapture = cbIPAudioCapture.Checked;
            VideoCapture1.IP_Camera_Source.Login        = edIPLogin.Text;
            VideoCapture1.IP_Camera_Source.Password     = edIPPassword.Text;
            VideoCapture1.IP_Camera_Source.VLC_ZeroClockJitterEnabled = cbVLCZeroClockJitter.Checked;
            VideoCapture1.IP_Camera_Source.VLC_CustomLatency          = Convert.ToInt32(edVLCCacheSize.Text);

            if (cbIPCameraONVIF.Checked)
            {
                VideoCapture1.IP_Camera_Source.ONVIF_Source = true;

                if (cbONVIFProfile.SelectedIndex != -1)
                {
                    VideoCapture1.IP_Camera_Source.ONVIF_SourceProfile = cbONVIFProfile.Text;
                }
            }

            if (rbPreview.Checked)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPPreview;
            }
            else if (rbCapture.Checked)
            {
                VideoCapture1.Mode            = VFVideoCaptureMode.IPCapture;
                VideoCapture1.Output_Filename = edOutput.Text;

                switch (cbOutputFormat.SelectedIndex)
                {
                case 0:
                {
                    var aviOutput = new VFAVIOutput();
                    SetAVIOutput(ref aviOutput);
                    VideoCapture1.Output_Format = aviOutput;

                    break;
                }

                case 1:
                {
                    var wmvOutput = new VFWMVOutput();
                    SetWMVOutput(ref wmvOutput);
                    VideoCapture1.Output_Format = wmvOutput;

                    break;
                }

                case 2:
                {
                    var mp4Output = new VFMP4v8v10Output();
                    SetMP4Output(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 3:
                {
                    var mp4Output = new VFMP4v11Output();
                    SetMP4v11Output(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 4:
                {
                    var gifOutput = new VFAnimatedGIFOutput();
                    SetGIFOutput(ref gifOutput);

                    VideoCapture1.Output_Format = gifOutput;

                    break;
                }

                case 5:
                {
                    var tsOutput = new VFMPEGTSOutput();
                    SetMPEGTSOutput(ref tsOutput);
                    VideoCapture1.Output_Format = tsOutput;

                    break;
                }

                case 6:
                {
                    var movOutput = new VFMOVOutput();
                    SetMOVOutput(ref movOutput);
                    VideoCapture1.Output_Format = movOutput;

                    break;
                }
                }
            }

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();
            lbLogos.Items.Clear();
            ConfigureVideoEffects();

            await VideoCapture1.StartAsync();

            tcMain.SelectedIndex = 3;
            tmRecording.Start();
        }
Пример #2
0
        private void btStart_Click(object sender, EventArgs e)
        {
            if (onvifControl != null)
            {
                onvifControl.Disconnect();
                onvifControl.Dispose();
                onvifControl = null;

                btONVIFConnect.Text = "Connect";
            }

            mmLog.Clear();

            VideoCapture1.Video_Renderer.Zoom_Ratio  = 0;
            VideoCapture1.Video_Renderer.Zoom_ShiftX = 0;
            VideoCapture1.Video_Renderer.Zoom_ShiftY = 0;

            VideoCapture1.Debug_Mode = cbDebugMode.Checked;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_RecordAudio = true;
            VideoCapture1.Audio_PlayAudio   = true;

            if (VideoCapture.Filter_Supported_EVR())
            {
                VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRenderer.EVR;
            }
            else if (VideoCapture.Filter_Supported_VMR9())
            {
                VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRenderer.VMR9;
            }
            else
            {
                VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRenderer.VideoRenderer;
            }

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            // source
            VideoCapture1.IP_Camera_Source = new IPCameraSourceSettings
            {
                URL = edIPUrl.Text
            };

            switch (cbIPCameraType.SelectedIndex)
            {
            case 0: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_VLC;
                break;

            case 1: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_FFMPEG;
                break;

            case 2: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_LAV;
                break;

            case 3: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_Live555;
                break;

            case 4: VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_FFMPEG;
                break;

            case 5: VideoCapture1.IP_Camera_Source.Type = VFIPSource.MMS_WMV;
                break;

            case 6: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_UDP_FFMPEG;
                break;

            case 7: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_TCP_FFMPEG;
                break;

            case 8: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_HTTP_FFMPEG;
                break;
            }

            VideoCapture1.IP_Camera_Source.AudioCapture = cbIPAudioCapture.Checked;
            VideoCapture1.IP_Camera_Source.Login        = edIPLogin.Text;
            VideoCapture1.IP_Camera_Source.Password     = edIPPassword.Text;
            VideoCapture1.IP_Camera_Source.VLC_ZeroClockJitterEnabled = cbVLCZeroClockJitter.Checked;
            VideoCapture1.IP_Camera_Source.VLC_CustomLatency          = Convert.ToInt32(edVLCCacheSize.Text);

            if (cbIPCameraONVIF.Checked)
            {
                VideoCapture1.IP_Camera_Source.ONVIF_Source = true;

                if (cbONVIFProfile.SelectedIndex != -1)
                {
                    VideoCapture1.IP_Camera_Source.ONVIF_SourceProfile = cbONVIFProfile.Text;
                }
            }

            if (rbPreview.Checked)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPPreview;
            }
            else if (rbCaptureAVI.Checked)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPCapture;

                VideoCapture1.Output_Filename = edOutputAVI.Text;

                var aviOutput = new VFAVIOutput
                {
                    ACM =
                    {
                        Name       = this.cbAudioCodecs.Text,
                        Channels   = Convert.ToInt32(this.cbChannels.Text),
                        BPS        = Convert.ToInt32(this.cbBPS.Text),
                        SampleRate = Convert.ToInt32(this.cbSampleRate.Text)
                    },
                    Video_Codec = this.cbVideoCodecs.Text
                };

                VideoCapture1.Output_Format = aviOutput;
            }
            else
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPCapture;

                VideoCapture1.Output_Filename = edOutputMP4.Text;

                var mp4Output = new VFMP4Output();

                if (IsWindows7OrNewer())
                {
                    mp4Output.MP4Mode = VFMP4Mode.v10;
                }
                else
                {
                    mp4Output.MP4Mode = VFMP4Mode.v8;
                }

                VideoCapture1.Output_Format = mp4Output;
            }

            VideoCapture1.Start();
        }
Пример #3
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            if (onvifControl != null)
            {
                onvifControl.Disconnect();
                onvifControl.Dispose();
                onvifControl = null;

                btONVIFConnect.Content = "Connect";
            }

            mmLog.Clear();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            VideoCapture1.Debug_Mode = cbDebugMode.IsChecked == true;
            VideoCapture1.Debug_Dir  =
                Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_RecordAudio = cbIPAudioCapture.IsChecked == true;
            VideoCapture1.Audio_PlayAudio   = cbIPAudioCapture.IsChecked == true;

            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            // source
            VideoCapture1.IP_Camera_Source = new IPCameraSourceSettings
            {
                URL = edIPUrl.Text
            };

            switch (cbIPCameraType.SelectedIndex)
            {
            case 0:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_VLC;
                break;

            case 1:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_FFMPEG;
                break;

            case 2:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_LAV;
                break;

            case 3:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_Live555;
                break;

            case 4:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_FFMPEG;
                break;

            case 5:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.MMS_WMV;
                break;

            case 6:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_UDP_FFMPEG;
                break;

            case 7:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_TCP_FFMPEG;
                break;

            case 8:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_HTTP_FFMPEG;
                break;

            case 9:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_MJPEG_LowLatency;
                cbIPAudioCapture.IsChecked          = false;
                VideoCapture1.Audio_RecordAudio     = false;
                VideoCapture1.Audio_PlayAudio       = false;

                break;

            case 10:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = false;
                break;

            case 11:
                VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = true;
                break;
            }

            VideoCapture1.IP_Camera_Source.AudioCapture = cbIPAudioCapture.IsChecked == true;
            VideoCapture1.IP_Camera_Source.Login        = edIPLogin.Text;
            VideoCapture1.IP_Camera_Source.Password     = edIPPassword.Text;
            VideoCapture1.IP_Camera_Source.VLC_ZeroClockJitterEnabled = cbVLCZeroClockJitter.IsChecked == true;
            VideoCapture1.IP_Camera_Source.VLC_CustomLatency          = Convert.ToInt32(edVLCCacheSize.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate            = Convert.ToDouble(edIPForcedFramerate.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate_InstanceID = edIPForcedFramerateID.Text[0];

            if (cbIPCameraONVIF.IsChecked == true)
            {
                VideoCapture1.IP_Camera_Source.ONVIF_Source = true;

                if (cbONVIFProfile.SelectedIndex != -1)
                {
                    VideoCapture1.IP_Camera_Source.ONVIF_SourceProfile = cbONVIFProfile.Text;
                }
            }

            if (cbIPDisconnect.IsChecked == true)
            {
                VideoCapture1.IP_Camera_Source.DisconnectEventInterval = 5000;
            }

            if (rbPreview.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPPreview;
            }
            else if (rbCapture.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPCapture;

                VideoCapture1.Output_Filename = edOutput.Text;

                switch (cbOutputFormat.SelectedIndex)
                {
                case 0:
                {
                    var aviOutput = new VFAVIOutput();
                    SetAVIOutput(ref aviOutput);
                    VideoCapture1.Output_Format = aviOutput;

                    break;
                }

                case 1:
                {
                    var mkvOutput = new VFMKVv1Output();
                    SetMKVOutput(ref mkvOutput);
                    VideoCapture1.Output_Format = mkvOutput;

                    break;
                }

                case 2:
                {
                    var wmvOutput = new VFWMVOutput();
                    SetWMVOutput(ref wmvOutput);
                    VideoCapture1.Output_Format = wmvOutput;

                    break;
                }

                case 3:
                {
                    var dvOutput = new VFDVOutput();
                    SetDVOutput(ref dvOutput);
                    VideoCapture1.Output_Format = dvOutput;

                    break;
                }

                case 4:
                {
                    var webmOutput = new VFWebMOutput();
                    SetWebMOutput(ref webmOutput);
                    VideoCapture1.Output_Format = webmOutput;

                    break;
                }

                case 5:
                {
                    var ffmpegDLLOutput = new VFFFMPEGDLLOutput();
                    SetFFMPEGDLLOutput(ref ffmpegDLLOutput);
                    VideoCapture1.Output_Format = ffmpegDLLOutput;

                    break;
                }

                case 6:
                {
                    var ffmpegOutput = new VFFFMPEGEXEOutput();
                    SetFFMPEGEXEOutput(ref ffmpegOutput);
                    VideoCapture1.Output_Format = ffmpegOutput;

                    break;
                }

                case 7:
                {
                    var mp4Output = new VFMP4v8v10Output();
                    SetMP4Output(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 8:
                {
                    var mp4Output = new VFMP4v11Output();
                    SetMP4v11Output(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 9:
                {
                    var gifOutput = new VFAnimatedGIFOutput();
                    SetGIFOutput(ref gifOutput);

                    VideoCapture1.Output_Format = gifOutput;

                    break;
                }

                case 10:
                {
                    var encOutput = new VFMP4v8v10Output();
                    SetMP4Output(ref encOutput);
                    encOutput.Encryption        = true;
                    encOutput.Encryption_Format = VFEncryptionFormat.MP4_H264_SW_AAC;

                    VideoCapture1.Output_Format = encOutput;

                    break;
                }

                case 11:
                {
                    var tsOutput = new VFMPEGTSOutput();
                    SetMPEGTSOutput(ref tsOutput);
                    VideoCapture1.Output_Format = tsOutput;

                    break;
                }

                case 12:
                {
                    var movOutput = new VFMOVOutput();
                    SetMOVOutput(ref movOutput);
                    VideoCapture1.Output_Format = movOutput;

                    break;
                }
                }
            }

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();
            lbLogos.Items.Clear();
            ConfigureVideoEffects();

            VideoCapture1.Start();

            tcMain.SelectedIndex = 3;
            tmRecording.Start();
        }
Пример #4
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            if (onvifControl != null)
            {
                onvifControl.Disconnect();
                onvifControl.Dispose();
                onvifControl = null;

                btONVIFConnect.Text = "Connect";
            }

            mmLog.Clear();

            VideoCapture1.Debug_Mode = cbDebugMode.Checked;
            VideoCapture1.Debug_Dir  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), "VisioForge");

            VideoCapture1.Audio_RecordAudio = cbIPAudioCapture.Checked;
            VideoCapture1.Audio_PlayAudio   = cbIPAudioCapture.Checked;

            VideoCapture1.Video_Renderer_SetAuto();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            // source
            VideoCapture1.IP_Camera_Source = new IPCameraSourceSettings
            {
                URL = new Uri(cbIPURL.Text, UriKind.Absolute)
            };

            bool lavGPU = false;

            switch (cbIPCameraType.SelectedIndex)
            {
            case 0:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.Auto_VLC;
                break;

            case 1:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.Auto_FFMPEG;
                break;

            case 2:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.Auto_LAV;
                break;

            case 3:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.Auto_LAV;
                lavGPU = true;
                break;

            case 4:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.MMS_WMV;
                break;

            case 5:
            {
                // audio not supported
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.HTTP_MJPEG_LowLatency;
                VideoCapture1.Audio_RecordAudio     = false;
                VideoCapture1.Audio_PlayAudio       = false;
                cbIPAudioCapture.Checked            = false;
            }
            break;

            case 6:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = false;
                break;

            case 7:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.RTSP_LowLatency;
                VideoCapture1.IP_Camera_Source.RTSP_LowLatency_UseUDP = true;
                break;

            case 8:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.NDI;
                break;

            case 9:
                VideoCapture1.IP_Camera_Source.Type = IPSourceEngine.NDI_Legacy;
                break;
            }

            VideoCapture1.IP_Camera_Source.AudioCapture = cbIPAudioCapture.Checked;
            VideoCapture1.IP_Camera_Source.Login        = edIPLogin.Text;
            VideoCapture1.IP_Camera_Source.Password     = edIPPassword.Text;
            VideoCapture1.IP_Camera_Source.VLC_ZeroClockJitterEnabled = cbVLCZeroClockJitter.Checked;
            VideoCapture1.IP_Camera_Source.VLC_CustomLatency          = Convert.ToInt32(edVLCCacheSize.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate            = Convert.ToInt32(edIPForcedFramerate.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate_InstanceID = edIPForcedFramerateID.Text[0];

            if (VideoCapture1.IP_Camera_Source.Type == IPSourceEngine.Auto_LAV)
            {
                VideoCapture1.IP_Camera_Source.LAV_GPU_Use  = lavGPU;
                VideoCapture1.IP_Camera_Source.LAV_GPU_Mode = LAVGPUDecoder.DXVA2CopyBack;
            }

            if (cbIPCameraONVIF.Checked)
            {
                VideoCapture1.IP_Camera_Source.ONVIF_Source = true;

                if (cbONVIFProfile.SelectedIndex != -1)
                {
                    VideoCapture1.IP_Camera_Source.ONVIF_SourceProfile = cbONVIFProfile.Text;
                }
            }

            if (cbIPDisconnect.Checked)
            {
                VideoCapture1.IP_Camera_Source.DisconnectEventInterval = TimeSpan.FromSeconds(10);
            }

            if (rbPreview.Checked)
            {
                VideoCapture1.Mode = VideoCaptureMode.IPPreview;
            }
            else if (rbCapture.Checked)
            {
                VideoCapture1.Mode            = VideoCaptureMode.IPCapture;
                VideoCapture1.Output_Filename = edOutput.Text;

                switch (cbOutputFormat.SelectedIndex)
                {
                case 0:
                {
                    var aviOutput = new AVIOutput();
                    SetAVIOutput(ref aviOutput);
                    VideoCapture1.Output_Format = aviOutput;

                    break;
                }

                case 1:
                {
                    var wmvOutput = new WMVOutput();
                    SetWMVOutput(ref wmvOutput);
                    VideoCapture1.Output_Format = wmvOutput;

                    break;
                }

                case 2:
                {
                    var mp4Output = new MP4Output();
                    SetMP4Output(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 3:
                {
                    var mp4Output = new MP4HWOutput();
                    SetMP4HWOutput(ref mp4Output);
                    VideoCapture1.Output_Format = mp4Output;

                    break;
                }

                case 4:
                {
                    var gifOutput = new AnimatedGIFOutput();
                    SetGIFOutput(ref gifOutput);

                    VideoCapture1.Output_Format = gifOutput;

                    break;
                }

                case 5:
                {
                    var tsOutput = new MPEGTSOutput();
                    SetMPEGTSOutput(ref tsOutput);
                    VideoCapture1.Output_Format = tsOutput;

                    break;
                }

                case 6:
                {
                    var movOutput = new MOVOutput();
                    SetMOVOutput(ref movOutput);
                    VideoCapture1.Output_Format = movOutput;

                    break;
                }
                }
            }

            VideoCapture1.Video_Effects_Enabled = true;
            ConfigureVideoEffects();

            VideoView1.StatusOverlay = new TextStatusOverlay();

            await VideoCapture1.StartAsync();

            tcMain.SelectedIndex = 3;
            tmRecording.Start();
        }
Пример #5
0
        private void btStart_Click(object sender, RoutedEventArgs e)
        {
            if (onvifControl != null)
            {
                onvifControl.Disconnect();
                onvifControl.Dispose();
                onvifControl = null;

                btONVIFConnect.Content = "Connect";
            }

            mmLog.Clear();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

            VideoCapture1.Debug_Mode = cbDebugMode.IsChecked == true;
            VideoCapture1.Debug_Dir  = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\VisioForge\\";

            VideoCapture1.Audio_RecordAudio = false;
            VideoCapture1.Audio_PlayAudio   = false;

            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            // source
            VideoCapture1.IP_Camera_Source = new IPCameraSourceSettings
            {
                URL = this.edIPUrl.Text
            };

            switch (cbIPCameraType.SelectedIndex)
            {
            case 0: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_VLC;
                break;

            case 1: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_FFMPEG;
                break;

            case 2: VideoCapture1.IP_Camera_Source.Type = VFIPSource.Auto_LAV;
                break;

            case 3: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_Live555;
                break;

            case 4: VideoCapture1.IP_Camera_Source.Type = VFIPSource.HTTP_FFMPEG;
                break;

            case 5: VideoCapture1.IP_Camera_Source.Type = VFIPSource.MMS_WMV;
                break;

            case 6: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_UDP_FFMPEG;
                break;

            case 7: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_TCP_FFMPEG;
                break;

            case 8: VideoCapture1.IP_Camera_Source.Type = VFIPSource.RTSP_HTTP_FFMPEG;
                break;
            }

            VideoCapture1.IP_Camera_Source.AudioCapture = cbIPAudioCapture.IsChecked == true;
            VideoCapture1.IP_Camera_Source.Login        = edIPLogin.Text;
            VideoCapture1.IP_Camera_Source.Password     = edIPPassword.Text;
            VideoCapture1.IP_Camera_Source.VLC_ZeroClockJitterEnabled = cbVLCZeroClockJitter.IsChecked == true;
            VideoCapture1.IP_Camera_Source.VLC_CustomLatency          = Convert.ToInt32(edVLCCacheSize.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate            = Convert.ToDouble(edIPForcedFramerate.Text);
            VideoCapture1.IP_Camera_Source.ForcedFramerate_InstanceID = edIPForcedFramerateID.Text[0];

            if (cbIPCameraONVIF.IsChecked == true)
            {
                VideoCapture1.IP_Camera_Source.ONVIF_Source = true;

                if (cbONVIFProfile.SelectedIndex != -1)
                {
                    VideoCapture1.IP_Camera_Source.ONVIF_SourceProfile = cbONVIFProfile.Text;
                }
            }

            if (cbIPDisconnect.IsChecked == true)
            {
                VideoCapture1.IP_Camera_Source.DisconnectEventInterval = 5000;
            }

            if (rbPreview.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPPreview;
            }
            else if (rbCaptureAVI.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPCapture;

                VideoCapture1.Output_Filename = edOutputAVI.Text;

                var aviOutput = new VFAVIOutput
                {
                    ACM =
                    {
                        Name       = this.cbAudioCodecs.Text,
                        Channels   = Convert.ToInt32(this.cbChannels.Text),
                        BPS        = Convert.ToInt32(this.cbBPS.Text),
                        SampleRate = Convert.ToInt32(this.cbSampleRate.Text)
                    },
                    Video_Codec = this.cbVideoCodecs.Text
                };

                VideoCapture1.Output_Format = aviOutput;
            }
            else
            {
                VideoCapture1.Mode = VFVideoCaptureMode.IPCapture;

                VideoCapture1.Output_Filename = edOutputMP4.Text;

                var mp4Output = new VFMP4Output();

                int tmp;

                // Main settings
                mp4Output.MP4Mode = VFMP4Mode.v10;

                // Video H264 settings
                switch (cbH264Profile.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileAuto;
                    break;

                case 1:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileBaseline;
                    break;

                case 2:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileMain;
                    break;

                case 3:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh;
                    break;

                case 4:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh10;
                    break;

                case 5:
                    mp4Output.Video_H264.Profile = VFH264Profile.ProfileHigh422;
                    break;
                }

                switch (cbH264Level.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.Level = VFH264Level.LevelAuto;
                    break;

                case 1:
                    mp4Output.Video_H264.Level = VFH264Level.Level1;
                    break;

                case 2:
                    mp4Output.Video_H264.Level = VFH264Level.Level11;
                    break;

                case 3:
                    mp4Output.Video_H264.Level = VFH264Level.Level12;
                    break;

                case 4:
                    mp4Output.Video_H264.Level = VFH264Level.Level13;
                    break;

                case 5:
                    mp4Output.Video_H264.Level = VFH264Level.Level2;
                    break;

                case 6:
                    mp4Output.Video_H264.Level = VFH264Level.Level21;
                    break;

                case 7:
                    mp4Output.Video_H264.Level = VFH264Level.Level22;
                    break;

                case 8:
                    mp4Output.Video_H264.Level = VFH264Level.Level3;
                    break;

                case 9:
                    mp4Output.Video_H264.Level = VFH264Level.Level31;
                    break;

                case 10:
                    mp4Output.Video_H264.Level = VFH264Level.Level32;
                    break;

                case 11:
                    mp4Output.Video_H264.Level = VFH264Level.Level4;
                    break;

                case 12:
                    mp4Output.Video_H264.Level = VFH264Level.Level41;
                    break;

                case 13:
                    mp4Output.Video_H264.Level = VFH264Level.Level42;
                    break;

                case 14:
                    mp4Output.Video_H264.Level = VFH264Level.Level5;
                    break;

                case 15:
                    mp4Output.Video_H264.Level = VFH264Level.Level51;
                    break;
                }

                switch (cbH264TargetUsage.SelectedIndex)
                {
                case 0:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.Auto;
                    break;

                case 1:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.BestQuality;
                    break;

                case 2:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.Balanced;
                    break;

                case 3:
                    mp4Output.Video_H264.TargetUsage = VFH264TargetUsage.BestSpeed;
                    break;
                }

                mp4Output.Video_H264.PictureType = VFH264PictureType.Auto;

                mp4Output.Video_H264.RateControl = (VFH264RateControl)cbH264RateControl.SelectedIndex;
                mp4Output.Video_H264.GOP         = cbH264GOP.IsChecked == true;
                mp4Output.Video_H264.BitrateAuto = cbH264AutoBitrate.IsChecked == true;

                int.TryParse(edH264Bitrate.Text, out tmp);
                mp4Output.Video_H264.Bitrate = tmp;

                // Audio AAC settings
                int.TryParse(cbAACBitrate.Text, out tmp);
                mp4Output.Audio_AAC.Bitrate = tmp;

                mp4Output.Audio_AAC.Version = (VFAACVersion)cbAACMPEGVersion.SelectedIndex;
                mp4Output.Audio_AAC.Output  = (VFAACOutput)cbAACOutput.SelectedIndex;
                mp4Output.Audio_AAC.Object  = (VFAACObject)(cbAACObject.SelectedIndex + 1);

                VideoCapture1.Output_Format = mp4Output;
            }

            VideoCapture1.Start();
        }