Example #1
0
        private async void btStart_Click(object sender, EventArgs e)
        {
            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.Video_Sample_Grabber_Enabled = true;

            // from screen
            bool allScreens = cbScreenCaptureDisplayIndex.SelectedIndex == cbScreenCaptureDisplayIndex.Items.Count - 1;

            if (allScreens)
            {
                int n = cbScreenCaptureDisplayIndex.Items.Count - 1;
                VideoCapture1.Screen_Capture_Source = CreateScreenCaptureSource(
                    Convert.ToInt32(cbScreenCaptureDisplayIndex.Items[0]),
                    true);

                if (n > 1)
                {
                    for (int i = 1; i < n; i++)
                    {
                        var source = CreateScreenCaptureSource(
                            Convert.ToInt32(cbScreenCaptureDisplayIndex.Items[i]),
                            true);
                        VideoCapture1.PIP_Mode = VFPIPMode.Horizontal;
                        VideoCapture1.PIP_Sources_Add_ScreenSource(source, 0, 0, 0, 0);
                    }
                }
            }
            else
            {
                VideoCapture1.Screen_Capture_Source = CreateScreenCaptureSource(
                    Convert.ToInt32(cbScreenCaptureDisplayIndex.Text),
                    false);
            }

            // audio source
            if (cbRecordAudio.Checked)
            {
                VideoCapture1.Audio_RecordAudio = true;
                VideoCapture1.Audio_PlayAudio   = false;

                VideoCapture1.Audio_CaptureDevice        = cbAudioInputDevice.Text;
                VideoCapture1.Audio_CaptureDevice_Format = cbAudioInputFormat.Text;
                VideoCapture1.Audio_CaptureDevice_Line   = cbAudioInputLine.Text;
            }
            else
            {
                VideoCapture1.Audio_RecordAudio = false;
                VideoCapture1.Audio_PlayAudio   = false;
            }

            // apply capture params
            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();
            lbLogos.Items.Clear();
            ConfigureVideoEffects();

            if (rbPreview.Checked)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.ScreenPreview;
            }
            else
            {
                VideoCapture1.Mode            = VFVideoCaptureMode.ScreenCapture;
                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;
                }
                }
            }

            await VideoCapture1.StartAsync();

            tcMain.SelectedIndex = 3;
            tmRecording.Start();
        }
        private async void btStart_Click(object sender, RoutedEventArgs e)
        {
            mmLog.Clear();

            VideoCapture1.Video_Sample_Grabber_Enabled = true;

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

            // from screen
            bool allScreens = cbScreenCaptureDisplayIndex.SelectedIndex == cbScreenCaptureDisplayIndex.Items.Count - 1;

            if (allScreens)
            {
                int n = cbScreenCaptureDisplayIndex.Items.Count - 1;
                VideoCapture1.Screen_Capture_Source = CreateScreenCaptureSource(
                    Convert.ToInt32(cbScreenCaptureDisplayIndex.Items[0]),
                    true);

                if (n > 1)
                {
                    for (int i = 1; i < n; i++)
                    {
                        var source = CreateScreenCaptureSource(
                            Convert.ToInt32(cbScreenCaptureDisplayIndex.Items[i]),
                            true);
                        VideoCapture1.PIP_Mode = VFPIPMode.Horizontal;
                        VideoCapture1.PIP_Sources_Add_ScreenSource(source, 0, 0, 0, 0);
                    }
                }
            }
            else
            {
                VideoCapture1.Screen_Capture_Source = CreateScreenCaptureSource(
                    Convert.ToInt32(cbScreenCaptureDisplayIndex.Text),
                    false);
            }

            if (cbRecordAudio.IsChecked == true)
            {
                VideoCapture1.Audio_RecordAudio = true;
                VideoCapture1.Audio_PlayAudio   = false;

                VideoCapture1.Audio_CaptureDevice        = cbAudioInputDevice.Text;
                VideoCapture1.Audio_CaptureDevice_Format = cbAudioInputFormat.Text;
                VideoCapture1.Audio_CaptureDevice_Line   = cbAudioInputLine.Text;
            }
            else
            {
                VideoCapture1.Audio_RecordAudio = false;
                VideoCapture1.Audio_PlayAudio   = false;
            }

            // apply capture parameters
            VideoCapture1.Video_Renderer.Video_Renderer = VFVideoRendererWPF.WPF;

            VideoCapture1.Video_Effects_Enabled = true;
            VideoCapture1.Video_Effects_Clear();

            if (rbPreview.IsChecked == true)
            {
                VideoCapture1.Mode = VFVideoCaptureMode.ScreenPreview;
            }
            else
            {
                VideoCapture1.Mode = VFVideoCaptureMode.ScreenCapture;

                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();
        }