Example #1
0
        static void Main(string[] args)
        {
            Capturer capturer = new Capturer(); // create new screen capturer object


            capturer.CapturingType = CaptureAreaType.catScreen;    // set capturing area type to catScreen to capture whole screen

            capturer.OutputFileName = "EntireScreenCaptured.webm"; // set output video filename to .WMV, WEBM or .AVI file

            // set output video width and height
            capturer.OutputWidth  = 640;
            capturer.OutputHeight = 480;

            // WEBM output uses WMVVideoBitrate property to control output video bitrate
            // so try to increase it by x2 or x3 times if you think the output video are you are getting is laggy
            // capturer.WMVVideoBitrate = capturer.WMVVideoBitrate * 2;

            // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering)
            // capturer.CaptureTransparentControls = true;


            // set border around captured area if we are not capturing entire screen
            if (
                capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen
                )
            {
                // set border style
                capturer.CaptureAreaBorderType  = CaptureAreaBorderType.cabtDashed;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Color.Red);
            }

            // uncomment to set Bytescout Lossless Video format output video compression method
            // do not forget to set file to .avi format if you use Video Codec Name
            // capturer.CurrentVideoCodecName = "Bytescout Lossless";

            capturer.Run(); // run screen video capturing

            // IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are
            // using Thread.Sleep(1) inside the checking loop, so you have the loop like
            // Do {
            // Thread.Sleep(1)
            // }
            // While(StopButtonNotClicked);


            Console.WriteLine("Capturing entire screen for 20 seconds...");

            Thread.Sleep(15000); // wait for 15 seconds

            capturer.Stop();     // stop video capturing

            // Release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(capturer);
            capturer = null;

            Console.WriteLine("Done");

            Process.Start("EntireScreenCaptured.webm");
        }
        static void Main(string[] args)
        {
            Capturer capturer = new Capturer(); // create new screen capturer object


            capturer.CapturingType = CaptureAreaType.catScreen; // set capturing area type to catScreen to capture whole screen

            // Set webcamera device by name (.CurrentWebCamname property)
            // or set it by index using .CurrentWebCam property
            capturer.CurrentWebCam = 0;

            // Set rectangle to show overlaying video from webcam into the rectangle 160x120 (starting with left point at 10, 10)
            capturer.SetWebCamVideoRectangle(10, 10, 160, 120);

            // Enable webcam overlaying capture device
            capturer.AddWebCamVideo = true;

            capturer.OutputFileName = "ScreenWithWebCameraCaptured.wmv";             // set output video filename to .WMV or .AVI file

            // set output video width and height
            capturer.OutputWidth  = 640;
            capturer.OutputHeight = 480;

            // WMV and WEBM output use WMVVideoBitrate property to control output video bitrate
            // so try to increase it by x2 or x3 times if you think the output video are you are getting is laggy
            // capturer.WMVVideoBitrate = capturer.WMVVideoBitrate * 2;


            // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering)
            // capturer.CaptureTransparentControls = true;


            capturer.Run(); // run screen video capturing

            //' IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are
            //' using Thread.Sleep(1) inside the checking loop, so you have the loop like
            //' Do {
            //' Thread.Sleep(1)
            //' }
            //' While(StopButtonNotClicked);

            Console.WriteLine("Capturing entire screen for 10 seconds...");

            Thread.Sleep(10000); // wait for 10 seconds

            capturer.Stop();     // stop video capturing

            // Release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(capturer);
            capturer = null;

            Console.WriteLine("Done");

            Process.Start("ScreenWithWebCameraCaptured.wmv");
        }
Example #3
0
        bool SetProject(Project project, ProjectType projectType, CaptureSettings props)
        {
            if (OpenedProject != null)
            {
                CloseOpenedProject(true);
            }

            Log.Debug("Loading project " + project.ID + " " + projectType);

            PlaysFilter = new EventsFilter(project);
            project.CleanupTimers();
            guiToolkit.OpenProject(project, projectType, props, PlaysFilter,
                                   out analysisWindow);
            Player            = analysisWindow.Player;
            Capturer          = analysisWindow.Capturer;
            OpenedProject     = project;
            OpenedProjectType = projectType;

            if (projectType == ProjectType.FileProject)
            {
                // Check if the file associated to the project exists
                if (!project.Description.FileSet.CheckFiles())
                {
                    if (!guiToolkit.SelectMediaFiles(project))
                    {
                        CloseOpenedProject(true);
                        return(false);
                    }
                }
                try {
                    Player.Open(project.Description.FileSet);
                } catch (Exception ex) {
                    Log.Exception(ex);
                    guiToolkit.ErrorMessage(Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
                    CloseOpenedProject(false);
                    return(false);
                }
            }
            else if (projectType == ProjectType.CaptureProject ||
                     projectType == ProjectType.URICaptureProject ||
                     projectType == ProjectType.FakeCaptureProject)
            {
                try {
                    Capturer.Run(props, project.Description.FileSet.First());
                } catch (Exception ex) {
                    Log.Exception(ex);
                    guiToolkit.ErrorMessage(ex.Message);
                    CloseOpenedProject(false);
                    return(false);
                }
            }

            EmitProjectChanged();
            return(true);
        }
Example #4
0
        private bool SetProject(Project project, ProjectType projectType, CaptureSettings props)
        {
            if (OpenedProject != null)
            {
                CloseOpenedProject(true);
            }

            if (projectType == ProjectType.FileProject)
            {
                // Check if the file associated to the project exists
                if (!File.Exists(project.Description.File.FilePath))
                {
                    guiToolkit.WarningMessage(Catalog.GetString("The file associated to this project doesn't exist.") + "\n"
                                              + Catalog.GetString("If the location of the file has changed try to edit it with the database manager."));
                    CloseOpenedProject(true);
                    return(false);
                }
                try {
                    Player.Open(project.Description.File.FilePath);
                }
                catch (Exception ex) {
                    guiToolkit.ErrorMessage(Catalog.GetString("An error occurred opening this project:") + "\n" + ex.Message);
                    CloseOpenedProject(true);
                    return(false);
                }
            }
            else
            {
                if (projectType == ProjectType.CaptureProject ||
                    projectType == ProjectType.URICaptureProject)
                {
                    Capturer.CaptureProperties = props;
                    try {
                        Capturer.Type = CapturerType.Live;
                    } catch (Exception ex) {
                        guiToolkit.ErrorMessage(ex.Message);
                        CloseOpenedProject(false);
                        return(false);
                    }
                }
                else
                {
                    Capturer.Type = CapturerType.Fake;
                }
                Capturer.Run();
            }

            OpenedProject     = project;
            OpenedProjectType = projectType;
            PlaysFilter       = new PlaysFilter(project);
            mainWindow.SetProject(project, projectType, props, PlaysFilter);
            EmitProjectChanged();
            return(true);
        }
        private void buttonStart_Click(object sender, System.EventArgs e)
        {
            string fileName = string.Format("screencast{0}.wmv", ++_screencastCount);

            // Start screen recording
            _capturer.OutputFileName = fileName;
            _capturer.Run();

            buttonStart.Enabled      = false;
            buttonStop.Enabled       = true;
            buttonScreenshot.Enabled = true;
        }
        static void Main(string[] args)
        {
            try
            {
                // Create Capturer instance.
                Capturer capturer = new Capturer();

                // Set capturing area type to catScreen to capture entire screen.
                capturer.CapturingType = CaptureAreaType.catScreen;

                // Set output video file name.
                // (!) The file extension defines the output video format (.WVM or .AVI).
                capturer.OutputFileName = "EntireScreenCaptured.wmv";

                // Set output video width and height
                capturer.OutputWidth  = 1024;
                capturer.OutputHeight = 600;

                // Start capturing .
                capturer.Run();

                Console.WriteLine("Capturing entire screen for 10 seconds...");

                // Wait for 10 seconds...
                new ManualResetEvent(false).WaitOne(10000);

                // Stop capturing.
                capturer.Stop();

                // Release objects
                Marshal.ReleaseComObject(capturer);

                Console.WriteLine("Done");

                Process.Start("EntireScreenCaptured.wmv");
            }
            finally
            {
                Console.WriteLine();
                Console.WriteLine("Press any key to exit");
                Console.ReadKey();
            }
        }
Example #7
0
        void Configure()
        {
            VideoMuxerType muxer;

            if (Capturer == null)
            {
                videowindow.Visible = false;
                return;
            }

            /* We need to use Matroska for live replay and remux when the capture is done */
            muxer = settings.EncodingSettings.EncodingProfile.Muxer;
            if (muxer == VideoMuxerType.Avi || muxer == VideoMuxerType.Mp4)
            {
                settings.EncodingSettings.EncodingProfile.Muxer = VideoMuxerType.Matroska;
            }
            Capturer.Configure(settings, videowindow.WindowHandle);
            settings.EncodingSettings.EncodingProfile.Muxer = muxer;
            delayStart = false;
            Capturer.Run();
            videowindow.MessageVisible = true;
        }
        public static void ThreadProc(Object obj)
        {
            CapturingThreadData data = (CapturingThreadData)obj;

            data.Success = true;

            // Prepare Capturer:

            Capturer capturer = new Capturer();         // create new screen capturer object

            capturer.RegistrationName = "demo";
            capturer.RegistrationKey  = "demo";

            capturer.CaptureRectLeft   = data.CaptureRectangle.Left;
            capturer.CaptureRectTop    = data.CaptureRectangle.Top;
            capturer.CaptureRectWidth  = data.CaptureRectangle.Width;
            capturer.CaptureRectHeight = data.CaptureRectangle.Height;

            capturer.OutputWidth  = 640;
            capturer.OutputHeight = 480;

            // WMV and WEBM output use WMVVideoBitrate property to control output video bitrate
            // so try to increase it by x2 or x3 times if you think the output video are you are getting is laggy
            // capturer.WMVVideoBitrate = capturer.WMVVideoBitrate * 2;

            capturer.CaptureRectWidth  = 320;
            capturer.CaptureRectHeight = 240;

            data.TempFile = Path.GetTempFileName();
            data.TempFile = Path.ChangeExtension(data.TempFile, ".wmv");

            capturer.OutputFileName = data.TempFile;
            capturer.CapturingType  = data.CaptureType;

            // set border around captured area if we are not capturing entire screen
            if (capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen)
            {
                capturer.CaptureAreaBorderType  = CaptureAreaBorderType.cabtDashed;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Color.Red);
            }


            // Wait for events:

            WaitHandle[] events = new WaitHandle[] { data.StartOrResumeEvent, data.PauseEvent, data.StopEvent };

            try
            {
                while (true)
                {
                    int i = WaitHandle.WaitAny(events);

                    if (events[i] == data.StartOrResumeEvent)
                    {
                        if (!capturer.IsRunning)
                        {
                            capturer.Run();
                        }
                    }
                    else if (events[i] == data.PauseEvent)
                    {
                        if (capturer.IsRunning)
                        {
                            capturer.Pause();
                        }
                    }
                    else if (events[i] == data.StopEvent)
                    {
                        capturer.Stop();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                data.ErrorText = ex.Message;
                data.Success   = false;
            }
            finally
            {
                // Release resources
                Marshal.ReleaseComObject(capturer);
            }
        }
        public static void ThreadProc(Object obj)
        {
            Capturer capturer = new Capturer(); // create new screen capturer object

            CapturingThreadData data = (CapturingThreadData)obj;

            if (Program.Cfg.WriteLog)
            {
                capturer.SetLogFile(Path.GetTempPath() + Application.ProductName + " log.txt");
            }

            capturer.RegistrationName = "demo";
            capturer.RegistrationKey  = "demo";

            if (Program.Cfg.AudioDevice != "")
            {
                capturer.CurrentAudioDeviceName = Program.Cfg.AudioDevice;
            }

            if (Program.Cfg.AudioLine != "")
            {
                capturer.CurrentAudioDeviceLineName = Program.Cfg.AudioLine;
            }

            if (Program.Cfg.SelectedVideoCodecTab == 0)
            {
                capturer.CurrentWMVAudioCodecName = Program.Cfg.WmvAudioCodec;
                capturer.CurrentWMVAudioFormat    = Program.Cfg.WmvAudioFormat;
                capturer.CurrentWMVVideoCodecName = Program.Cfg.WmvVideoCodec;

                Program.Cfg.WmvAudioCodec  = capturer.CurrentWMVAudioCodecName;
                Program.Cfg.WmvAudioFormat = capturer.CurrentWMVAudioFormat;
                Program.Cfg.WmvVideoCodec  = capturer.CurrentWMVVideoCodecName;
            }
            else
            {
                capturer.CurrentAudioCodecName = Program.Cfg.AviAudioCodec;
                capturer.CurrentVideoCodecName = Program.Cfg.AviVideoCodec;
            }

            capturer.AudioEnabled = Program.Cfg.EnableAudio;
            // this option tells to use captured area dimensions as output video width/height
            // or use user defined video dimensions
            capturer.MatchOutputSizeToTheSourceSize = !Program.Cfg.ResizeOutputVideo;
            capturer.FPS = Program.Cfg.FPS;

            capturer.ShowMouseHotSpot                    = Program.Cfg.ShowMouseHotSpot;
            capturer.CaptureMouseCursor                  = Program.Cfg.CaptureMouseCursor;
            capturer.AnimateMouseClicks                  = Program.Cfg.AnimateMouseClicks;
            capturer.AnimateMouseButtons                 = Program.Cfg.AnimateMouseButtons;
            capturer.MouseAnimationDuration              = Program.Cfg.MouseAnimationDuration;
            capturer.MouseSpotRadius                     = Program.Cfg.MouseSpotRadius;
            capturer.MouseHotSpotColor                   = (uint)ColorTranslator.ToOle(Program.Cfg.MouseHotSpotColor);
            capturer.MouseCursorLeftClickAnimationColor  = (uint)ColorTranslator.ToOle(Program.Cfg.MouseCursorLeftClickAnimationColor);
            capturer.MouseCursorRightClickAnimationColor = (uint)ColorTranslator.ToOle(Program.Cfg.MouseCursorRightClickAnimationColor);

            capturer.CaptureRectLeft   = data.CaptureRectangle.Left;
            capturer.CaptureRectTop    = data.CaptureRectangle.Top;
            capturer.CaptureRectWidth  = data.CaptureRectangle.Width;
            capturer.CaptureRectHeight = data.CaptureRectangle.Height;

            capturer.KeepAspectRatio = Program.Cfg.KeepAspectRatio;

            // show recording time stamp
            capturer.OverlayingRedTextCaption = "Recording: {RUNNINGMIN}:{RUNNINGSEC}:{RUNNINGMSEC} on {CURRENTYEAR}-{CURRENTMONTH}-{CURRENTDAY} at {CURRENTHOUR}:{CURRENTMIN}:{CURRENTSEC}:{CURRENTMSEC}";

            capturer.OutputWidth  = Program.Cfg.OutputWidth;
            capturer.OutputHeight = Program.Cfg.OutputHeight;

            if ((capturer.WebCamCount > 0) && (data.ShowWebCamStream))
            {
                capturer.AddWebCamVideo = true;

                if (!String.IsNullOrEmpty(Program.Cfg.WebCameraDevice))
                {
                    capturer.CurrentWebCamName = Program.Cfg.WebCameraDevice;
                }

                capturer.SetWebCamVideoRectangle(Program.Cfg.WebCameraWindowX, Program.Cfg.WebCameraWindowY, Program.Cfg.WebCameraWindowWidth, Program.Cfg.WebCameraWindowHeight);
            }

            data.TempFile           = Path.GetTempFileName();
            data.TempFile           = Path.ChangeExtension(data.TempFile, (Program.Cfg.SelectedVideoCodecTab == 0) ? ".wmv" : ".avi");
            capturer.OutputFileName = data.TempFile;
            capturer.CapturingType  = data.CaptureType;

            // set border around captured area if we are not capturing entire screen
            if (capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen)
            {
                // set border style
                capturer.CaptureAreaBorderType  = Program.Cfg.CaptureAreaBorderType;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Program.Cfg.CaptureAreaBorderColor);
                capturer.CaptureAreaBorderWidth = Program.Cfg.CaptureAreaBorderWidth;
            }


            try
            {
                capturer.Run();

                // IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are
                // using Thread.Sleep(1) inside the checking loop, so you have the loop like
                // Do
                // Thread.Sleep(1)
                // While StopButtonNotClicked
            }
            catch (COMException ex)
            {
                data.ErrorText = ex.Message;
                data.Result    = 1;
                Marshal.ReleaseComObject(capturer);
                return;
            }

            try
            {
                Thread.Sleep(Timeout.Infinite);
            }
            catch (ThreadInterruptedException)
            {
                capturer.Stop();
                data.Result = 0;
            }
            catch (Exception ex)
            {
                data.ErrorText = ex.Message;
                data.Result    = 1;
            }
            finally
            {
                Marshal.ReleaseComObject(capturer);
            }
        }
        private void btnStartRecording_Click(object sender, System.EventArgs e)
        {
            // Set up the capturer

            if (cbLog.Checked)
            {
                capturer.SetLogFile(Path.GetTempPath() + "Capturing Log.txt");
            }

            bool captureToAvi = (tabControl1.SelectedIndex == 1);

            capturer.AudioEnabled           = cbEnableAudio.Checked;
            capturer.CurrentAudioDeviceName = cmbAudioDevices.SelectedItem.ToString();
            if (cmbAudioLines.Items.Count > 0)
            {
                capturer.CurrentAudioDeviceLineName = cmbAudioLines.SelectedItem.ToString();
            }

            if (captureToAvi)
            {
                capturer.CurrentAudioCodecName = cmbAviAudioCodecs.SelectedItem.ToString();
                capturer.CurrentVideoCodecName = cmbAviVideoCodecs.SelectedItem.ToString();
            }
            else             // capture to WMV
            {
                capturer.CurrentWMVAudioCodecName = cmbWmvAudioCodecs.SelectedItem.ToString();
                capturer.CurrentWMVAudioFormat    = cmbWmvAudioFormats.SelectedIndex;
                capturer.CurrentWMVVideoCodecName = cmbWmvVideoCodecs.SelectedItem.ToString();
            }

            capturer.MouseAnimationDuration = 400;
            capturer.FPS = float.Parse(cmbFPS.Text);
            capturer.CaptureTransparentControls = cbCaptureLayeredWindows.Checked;
            capturer.MouseSpotRadius            = (int)nudMouseHotSpot.Value;

            capturer.OutputWidth  = int.Parse(tbWidth.Text);
            capturer.OutputHeight = int.Parse(tbHeight.Text);

            // Set capturing mode

            if (rbRectRegion.Checked)
            {
                capturer.CapturingType = CaptureAreaType.catRegion;
            }
            else if (rbRegionAroundMouse.Checked)
            {
                capturer.CapturingType = CaptureAreaType.catMouse;
            }
            else
            {
                capturer.CapturingType = CaptureAreaType.catScreen;
            }

            if (cbShowWebCamOverlay.Checked)
            {
                // Set web camera device to add overlaying video to the source
                capturer.AddWebCamVideo = true;

                // Set device name or you can set device by index using .CurrentCaptureDevice property
                capturer.CurrentWebCam = cmbWebCameras.SelectedIndex;

                // Set rectangle to show overlaying video from webcam into the rectangle 160x120 (starting with left point at 10,10)
                capturer.SetWebCamVideoRectangle(
                    int.Parse(tbWebCameraX.Text),
                    int.Parse(tbWebCameraY.Text),
                    int.Parse(tbWebCameraWidth.Text),
                    int.Parse(tbWebCameraHeight.Text));
            }


            // set border around captured area if we are not capturing entire screen
            if (
                capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen
                )
            {
                // set border style
                capturer.CaptureAreaBorderType  = CaptureAreaBorderType.cabtDashed;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Color.Red);
            }

            // Save to temp file

            String filename = Path.GetTempFileName();

            filename = Path.ChangeExtension(filename, captureToAvi ? "avi" : "wmv");
            capturer.OutputFileName = filename;

            try
            {
                // Start capturing
                try
                {
                    Cursor = Cursors.WaitCursor;
                    capturer.Run();
                }
                finally
                {
                    Cursor = Cursors.Default;
                }

                _recording = true;
                btnStartRecording.Enabled = false;
                btnPauseRecording.Enabled = true;
                btnStopRecording.Enabled  = true;

                // Wait for "Stop Recording" button pressed
                while (_recording)
                {
                    Thread.Sleep(10);
                    Application.DoEvents();
                }

                // Stop capturing
                try
                {
                    Cursor = Cursors.WaitCursor;
                    capturer.Stop();
                }
                finally
                {
                    Cursor = Cursors.Default;
                }

                // Ask for output file name
                SaveFileDialog dlg = new SaveFileDialog();

                dlg.Title    = @"Save captured video as";
                dlg.FileName = @"Screencast";

                if (captureToAvi)
                {
                    dlg.DefaultExt = @"*.avi";
                    dlg.Filter     = @"AVI files (*.avi)|*.avi|All files (*.*)|*.*";
                }
                else
                {
                    dlg.DefaultExt = @"*.wmv";
                    dlg.Filter     = @"WMV files (*.wmv)|*.wmv|All files (*.*)|*.*";
                }

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    // Save to specified file name
                    File.Copy(capturer.OutputFileName, dlg.FileName, true);
                }

                // clean up
                try
                {
                    File.Delete(capturer.OutputFileName);
                }
                catch
                {
                }

                btnStartRecording.Enabled = true;
                btnPauseRecording.Enabled = false;
                btnStopRecording.Enabled  = false;

                // open saved video in default video viewer
                try
                {
                    Process.Start(dlg.FileName);
                }
                catch
                {
                }
            }
            catch (COMException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Example #11
0
        static void Main(string[] args)
        {
            Capturer capturer = new Capturer(); // create new screen capturer object


            capturer.CapturingType = CaptureAreaType.catScreen; // set capturing area type to catScreen to capture whole screen

            capturer.OutputFileName = "LowFPS.wmv";             // set output video filename to .WMV or .AVI file

            // set WMV video codec to Windows Media Video 9 Screen that gives best quality/size ratio when recording from screen
            capturer.CurrentWMVVideoCodecName = "Windows Media Video 9 Screen";
            // disable audio so we will have a video only (and the lowest wmv file size as possible: about 20 kb per 1 second, about 70 mb per 1 hour
            capturer.AudioEnabled = false;
            // set FPS to 0.5 fps (1 frame per every 2 seconds)
            // you may also want to set to 1 fps (1 frame per 1 second or higher)
            capturer.FPS = 0.50f;

            // WMV and WEBM output use WMVVideoBitrate property to control output video bitrate
            // so try to increase it by x2 or x3 times if you think the output video are you are getting is laggy
            // capturer.WMVVideoBitrate = capturer.WMVVideoBitrate * 2;



            // set output video width and height
            capturer.OutputWidth  = 640;
            capturer.OutputHeight = 480;

            // set the text overlay with autochanging time stamp macros to indicate playing time and current date time
            capturer.OverlayingRedTextCaption = "Recording: {RUNNINGMIN}:{RUNNINGSEC}:{RUNNINGMSEC} on {CURRENTYEAR}-{CURRENTMONTH}-{CURRENTDAY} at {CURRENTHOUR}:{CURRENTMIN}:{CURRENTSEC}:{CURRENTMSEC}";


            // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering)
            // capturer.CaptureTransparentControls = true;

            // set border around captured area if we are not capturing entire screen
            if (
                capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen
                )
            {
                // set border style
                capturer.CaptureAreaBorderType  = CaptureAreaBorderType.cabtDashed;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Color.Red);
            }


            capturer.Run(); // run screen video capturing

            // IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are
            // using Thread.Sleep(1) inside the checking loop, so you have the loop like
            // Do {
            // Thread.Sleep(1)
            // }
            // While(StopButtonNotClicked);


            Console.WriteLine("Capturing entire screen for 5 seconds...");

            Thread.Sleep(5000); // wait for 5 seconds

            capturer.Stop();    // stop video capturing

            // Release resources
            System.Runtime.InteropServices.Marshal.ReleaseComObject(capturer);
            capturer = null;


            Console.WriteLine("Done");


            Process.Start("LowFPS.wmv");
        }
        static void Main(string[] args)
        {
            Capturer capturer = new Capturer(); // create new screen capturer object


            if (args.Length < 1)
            {
                usage(capturer);
                return;
            }

            capturer.OutputFileName = args[0];
            capturer.CapturingType  = CaptureAreaType.catRegion;
            setParams(args, capturer);

            // set border around captured area if we are not capturing entire screen
            if (
                capturer.CapturingType != CaptureAreaType.catScreen &&
                capturer.CapturingType != CaptureAreaType.catWebcamFullScreen
                )
            {
                // set border style
                capturer.CaptureAreaBorderType  = CaptureAreaBorderType.cabtDashed;
                capturer.CaptureAreaBorderColor = (uint)ColorTranslator.ToOle(Color.Red);
            }

            // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering)
            // capturer.CaptureTransparentControls = true;

            // WMV and WEBM output use WMVVideoBitrate property to control output video bitrate
            // so try to increase it by x2 or x3 times if you think the output video are you are getting is laggy
            // capturer.WMVVideoBitrate = capturer.WMVVideoBitrate * 2;


            try
            {
                capturer.Run();

                // IMPORTANT: if you want to check for some code if need to stop the recording then make sure you are
                // using Thread.Sleep(1) inside the checking loop, so you have the loop like
                // Do {
                // Thread.Sleep(1)
                // }
                // While(StopButtonNotClicked);

                Console.WriteLine("Starting capture - Hit a key to stop ...");

                string s = capturer.CurrentVideoCodecName;
                Console.WriteLine(string.Format("Using video compressor - {0}", s));

                s = capturer.CurrentAudioCodecName;
                Console.WriteLine(string.Format("Using audio compressor - {0}", s));

                s = capturer.CurrentAudioDeviceLineName;
                Console.WriteLine(string.Format("Using audio input line - {0}", s));

                int    i    = 0;
                string spin = "|/-\\";
                while (Win32Interop._kbhit() == 0)
                {
                    Console.Write(string.Format("\rEncoding {0}", spin[i++]));
                    i %= 4;
                    Thread.Sleep(50);
                }

                capturer.Stop();

                // Release resources
                System.Runtime.InteropServices.Marshal.ReleaseComObject(capturer);
                capturer = null;

                Console.Write("\nDone");
                Console.Read();
            }
            catch (Exception)
            {
                Console.WriteLine(capturer.LastError);
            }
        }