Every ByteScout tool contains example C# source codes that you can find here or in the folder with installed ByteScout product. Want to capture screen video with webcamera overlay in your C# app? ByteScout Screen Capturing SDK is designed for it. ByteScout Screen Capturing SDK is the tool for developers who want to add screen capturing in their application. Can record screen into video and into single screenshots. Output formats are WMV, AVI, WebM for video and PNG for screenshots. You can adjust output video size, quality, resolution, framerate, video and audio codecs. Includes special privacy features for blacking out sensitive information on screen. Can also capture video from web camera, can add overlays with text or images.
You will save a lot of time on writing and testing code as you may just take the C# code from ByteScout Screen Capturing SDK for capture screen video with webcamera overlay below and use it in your application. In your C# project or application you may simply copy & paste the code and then run your app! This basic programming language sample code for C# will do the whole work for you to capture screen video with webcamera overlay.
Download free trial version of ByteScout Screen Capturing SDK from our website with this and other source code samples for C#.
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.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 CaptureWithWebcameraOverlay { 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 // 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"); } } }
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
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