ByteScout Screen Capturing SDK - C# - Capture Video From Entire Screen - ByteScout

ByteScout Screen Capturing SDK – C# – Capture Video From Entire Screen

  • Home
  • /
  • Articles
  • /
  • ByteScout Screen Capturing SDK – C# – Capture Video From Entire Screen

How to Capture Video from Entire Screen in C# using ByteScout Screen Capturing SDK

This Tutorial Shows How to Capture Video from Entire Screen in C#

With this source code sample, you may quickly learn how to capture video from the entire screen in C#. ByteScout Screen Capturing SDK is the screen video recording SDK that helps in the quick implementation of screen video recording. WMV, AVI, WebM output options are available with adjustable quality, video size, framerate, video, and audio codec. Includes special features like live multiple blacking out of selected areas, recording from the webcam as the main source and as overlay, optional watermarks for output video. It can be used to capture video from the entire screen using C#.

The SDK samples like this one below explain how to quickly make your application do capture video from the entire screen in C# with the help of ByteScout Screen Capturing SDK. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. This basic programming language sample code for C# will do the whole work for you to capture video from the entire screen.

The trial version of ByteScout Screen Capturing SDK can be downloaded for free from our website. It also includes source code samples for C# and other programming languages.

On-demand (REST Web API) version:
 Web API (on-demand version)

On-premise offline SDK for Windows:
 60 Day Free Trial (on-premise)


using System; using System.Collections.Generic; using System.Text; using System.Threading; using System.Diagnostics; using System.Drawing; using BytescoutScreenCapturingLib; // import bytescout screen capturing activex object // NOTE: if you are getting error like "invalid image" related to loading the SDK's dll then // try to do the following: // 1) remove the reference to the SDK by View - Solution Explorer // then click on References, select Bytescout... reference name and right-click it and select Remove // 2) To re-add click on the menu: Project - Add Reference // 3) In "Add Reference" dialog switch to "COM" tab and find Bytescout... // 4) Select it and click "Add" // 5) Recompile the application // Note: if you need to run on both x64 and x86 then please make sure you have set "Embed Interop Types" to True for this reference namespace SimpleCaptureCSharp { class Program { 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.wmv"; // set output video filename to .WMV or .AVI file // set output video width and height capturer.OutputWidth = 640; capturer.OutputHeight = 480; // 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; // 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.wmv"); } } }

Tutorial to Capture Video From Entire Screen using ByteScout Screen Capturing SDK in C#

In this tutorial, I’m going to show you how to capture a video from an entire screen using ByteScout screen capturing SDK. First, you need to add the ByteScout screen capturing DLL. To do that, you need to right-click references, then click add references. After that, click browse and look for the ByteScoutScreenCapturing.dll also add the System.Drawing reference.


Once you’re done adding the references, you may now start with your code. Once you’re done with your code, you may now run the program. As you can see, the screen is already recording. Once the recording stops, it will automatically open a recorded video.

You can find the recorded video in the bin folder. That’s all for this tutorial.


60 Day Free Trial or Visit ByteScout Screen Capturing SDK Home Page

Explore ByteScout Screen Capturing SDK Documentation

Explore Samples

Sign Up for ByteScout Screen Capturing SDK Online Training


Get Your API Key

Explore Web API Docs

Explore Web API Samples

Video Tutorial