Screen video recording sample shows how to grab screen video in C# using Screen Capturing SDK. Use the source code below to record screen video.
C#
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading;
using System.Diagnostics;
using BytescoutScreenCapturingLib; // import bytescout screen capturing activex object
namespace SimpleCaptureCSharp
{
class Program
{
static void Main(string[] args)
{
CapturerClass capturer = new CapturerClass(); // 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 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
Thread.Sleep(15000); // wait for 15 seconds
capturer.Stop(); // stop video capturing
Process.Start("EntireScreenCaptured.wmv");
}
}
}