Getting Started with Screen Video Capturing SDK - ByteScout

Getting Started with Screen Video Capturing SDK

  • Home
  • /
  • Getting Started with Screen Video Capturing SDK

To view the documentation for the SDK go to Start > All Programs > Bytescout Screen Capturing SDK and click the “Documentation” link.

The SDK comes with lot of ready-to-use source code examples for Visual Basic, C#, VB6, VBScript.

To find source code samples please go to “My Documents” folder, “ByteScout Samples” and “Screen Capturing SDK”. Do not hesitate to copy and paste code snippets from samples right into your application!

The First Application

To help you get the most out of your free evaluation, here is the quick guide on adding screen video recording functionality into your application.

  • run Visual Studio and create New Project.
  • add reference to Screen Capturing SDK using Project | Add Reference. In the Add Reference dialog select “Bytescout Screen Capturing Lib” and click OK.
  • copy-and-paste the following code:

Visual Basic:

Imports <span data-scayt_word="System.Threading" data-scaytid="1053">System.Threading</span>
Imports <span data-scayt_word="System.Diagnostics" data-scaytid="1055">System.Diagnostics</span>

Imports <span data-scayt_word="BytescoutScreenCapturingLib" data-scaytid="1057">BytescoutScreenCapturingLib</span> ' import <span data-scayt_word="bytescout" data-scaytid="1059">bytescout</span> screen <span data-scayt_word="capturer" data-scaytid="1061">capturer</span> <span data-scayt_word="activex" data-scaytid="1066">activex</span> object

Module <span data-scayt_word="Module1" data-scaytid="1068">Module1</span>

Sub Main()
' create <span data-scayt_word="capturer" data-scaytid="1062">capturer</span> class
Dim <span data-scayt_word="capturer" data-scaytid="1063">capturer</span> As New <span data-scayt_word="CapturerClass" data-scaytid="1069">CapturerClass</span>()
' set capturing area to the region type (to capture from given region on the screen)
<span data-scayt_word="capturer.CapturingType" data-scaytid="1072">capturer.CapturingType</span> = <span data-scayt_word="CaptureAreaType.catScreen" data-scaytid="1074">CaptureAreaType.catScreen</span>
' output video filename to <span data-scayt_word=".WMV" data-scaytid="1076">.WMV</span> or <span data-scayt_word=".AVI" data-scaytid="1077">.AVI</span>
<span data-scayt_word="capturer.OutputFileName" data-scaytid="1079">capturer.OutputFileName</span> = "<span data-scayt_word="EntireScreenCaptured.wmv" data-scaytid="1081">EntireScreenCaptured.wmv</span>"

' set width and height of output video
<span data-scayt_word="capturer.OutputWidth" data-scaytid="1085">capturer.OutputWidth</span> = 640
<span data-scayt_word="capturer.OutputHeight" data-scaytid="1087">capturer.OutputHeight</span> = 480

' <span data-scayt_word="uncomment" data-scaytid="1089">uncomment</span> to set <span data-scayt_word="Bytescout" data-scaytid="1045">Bytescout</span> <span data-scayt_word="Lossless" data-scaytid="1091">Lossless</span> Video format output video compression method
' do not forget to set file to <span data-scayt_word=".avi" data-scaytid="1095">.avi</span> format if you use Video Codec Name
' <span data-scayt_word="capturer.CurrentVideoCodecName" data-scaytid="1097">capturer.CurrentVideoCodecName</span> = "<span data-scayt_word="Bytescout" data-scaytid="1046">Bytescout</span> <span data-scayt_word="Lossless" data-scaytid="1092">Lossless</span>"


' start capturing
<span data-scayt_word="capturer.Run" data-scaytid="1099">capturer.Run</span>()

' wait for 25 seconds
<span data-scayt_word="Thread.Sleep" data-scaytid="1101">Thread.Sleep</span>(25000)

' stop capturing and flush <span data-scayt_word="AVI" data-scaytid="1103">AVI</span> video file into the disk
<span data-scayt_word="capturer.Stop" data-scaytid="1104">capturer.Stop</span>()

' open the output video
<span data-scayt_word="Process.Start" data-scaytid="1106">Process.Start</span>("<span data-scayt_word="EntireScreenCaptured.wmv" data-scaytid="1082">EntireScreenCaptured.wmv</span>")

End Sub

End Module

C#:

using System;
using <span data-scayt_word="System.Collections.Generic" data-scaytid="1108">System.Collections.Generic</span>;
using <span data-scayt_word="System.Text" data-scaytid="1109">System.Text</span>;
using <span data-scayt_word="System.Threading" data-scaytid="1054">System.Threading</span>;
using <span data-scayt_word="System.Diagnostics" data-scaytid="1056">System.Diagnostics</span>;

using <span data-scayt_word="BytescoutScreenCapturingLib" data-scaytid="1058">BytescoutScreenCapturingLib</span>; // import <span data-scayt_word="bytescout" data-scaytid="1060">bytescout</span> screen capturing <span data-scayt_word="activex" data-scaytid="1067">activex</span> object

<span data-scayt_word="namespace" data-scaytid="1110">namespace</span> <span data-scayt_word="SimpleCaptureCSharp" data-scaytid="1111">SimpleCaptureCSharp</span>
{
class Program
{
static void Main(string[] <span data-scayt_word="args" data-scaytid="1112">args</span>)
{
<span data-scayt_word="CapturerClass" data-scaytid="1070">CapturerClass</span> <span data-scayt_word="capturer" data-scaytid="1064">capturer</span> = new <span data-scayt_word="CapturerClass" data-scaytid="1071">CapturerClass</span>(); // create new screen <span data-scayt_word="capturer" data-scaytid="1065">capturer</span> object

<span data-scayt_word="capturer.CapturingType" data-scaytid="1073">capturer.CapturingType</span> = <span data-scayt_word="CaptureAreaType.catScreen" data-scaytid="1075">CaptureAreaType.catScreen</span>; // set capturing area type to <span data-scayt_word="catScreen" data-scaytid="1113">catScreen</span> to capture whole screen

<span data-scayt_word="capturer.OutputFileName" data-scaytid="1080">capturer.OutputFileName</span> = "<span data-scayt_word="EntireScreenCaptured.wmv" data-scaytid="1083">EntireScreenCaptured.wmv</span>"; // set output video filename to <span data-scayt_word=".WVM" data-scaytid="1114">.WVM</span> or <span data-scayt_word=".AVI" data-scaytid="1078">.AVI</span> filename

// set output video width and height
<span data-scayt_word="capturer.OutputWidth" data-scaytid="1086">capturer.OutputWidth</span> = 640;
<span data-scayt_word="capturer.OutputHeight" data-scaytid="1088">capturer.OutputHeight</span> = 480;

// <span data-scayt_word="uncomment" data-scaytid="1090">uncomment</span> to set <span data-scayt_word="Bytescout" data-scaytid="1047">Bytescout</span> <span data-scayt_word="Lossless" data-scaytid="1093">Lossless</span> Video format output video compression method
//do not forget to set file to <span data-scayt_word=".avi" data-scaytid="1096">.avi</span> format if you use Video Codec Name
//<span data-scayt_word="capturer.CurrentVideoCodecName" data-scaytid="1098">capturer.CurrentVideoCodecName</span> = "<span data-scayt_word="Bytescout" data-scaytid="1048">Bytescout</span> <span data-scayt_word="Lossless" data-scaytid="1094">Lossless</span>";


<span data-scayt_word="capturer.Run" data-scaytid="1100">capturer.Run</span>(); // run screen video capturing

<span data-scayt_word="Thread.Sleep" data-scaytid="1102">Thread.Sleep</span>(15000); // wait for 15 seconds

<span data-scayt_word="capturer.Stop" data-scaytid="1105">capturer.Stop</span>(); // stop video capturing

<span data-scayt_word="Process.Start" data-scaytid="1107">Process.Start</span>("<span data-scayt_word="EntireScreenCaptured.wmv" data-scaytid="1084">EntireScreenCaptured.wmv</span>");
}
}
}
  • press F5 to compile and run your first application!

The application code above captures entire screen into WMV video file.

More Samples

For more source code samples explore “ByteScout Samples / Screen Capturing SDK” folder in “My Documents”.

Evaluation version adds a reminder text at the bottom of output video file.

You are welcome to purchase a license for the SDK at http://bytescout.com/buy/screencapturingsdk.html

We provide 30-Day Unconditional Money Back Guarantee for the SDK!

Have a Question?

Contact us at support@bytescout.com or use the online contact form at https://bytescout.com/support/index.php?_m=tickets&_a=submit&step=1&departmentid=2

Thanks again for evaluating Screen Capturing SDK!

[socialpug_share]

Tutorials: