ByteScout Screen Capturing SDK - C# - Take Screenshots During Video Recording - ByteScout

ByteScout Screen Capturing SDK – C# – Take Screenshots During Video Recording

  • Home
  • /
  • Articles
  • /
  • ByteScout Screen Capturing SDK – C# – Take Screenshots During Video Recording

take screenshots during video recording in C# with ByteScout Screen Capturing SDK

Tutorial: how to do take screenshots during video recording in C#

The sample source codes on this page will demonstrate you how to make take screenshots during video recording in C#. Take screenshots during video recording in C# can be implemented with ByteScout Screen Capturing SDK. ByteScout Screen Capturing SDK is the SDK for developers for quick implementation of screen video recording. The SDK records screen into video or into a series of screenshots. Can also record audio. Saves video into AVI,WMV and Google’s WebM. Output video quality, size, resolution or framerate can be adjusted easily. Provides additional tools for privacy features like blacking out on scren areas with sensitive information on screen right during recording. Supports web camera as input and can add instant text and images into video output.

The SDK samples like this one below explain how to quickly make your application do take screenshots during video recording in C# with the help of ByteScout Screen Capturing SDK. Follow the instruction from the scratch to work and copy and paste code for C# into your editor. Enhanced documentation and tutorials are available along with installed ByteScout Screen Capturing SDK if you’d like to dive deeper into the topic and the details of the API.

Visit our website provides for free trial version of ByteScout Screen Capturing SDK. Free trial includes lots of source code samples to help you with your C# project.

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

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

Form1.Designer.cs
      
namespace ScreenCapturingExample { partial class Form1 { /// <summary> /// Required designer variable. /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { components.Dispose(); } base.Dispose(disposing); } #region Windows Form Designer generated code /// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.buttonStart = new System.Windows.Forms.Button(); this.buttonStop = new System.Windows.Forms.Button(); this.buttonScreenshot = new System.Windows.Forms.Button(); this.SuspendLayout(); // // buttonStart // this.buttonStart.Location = new System.Drawing.Point(28, 26); this.buttonStart.Name = "buttonStart"; this.buttonStart.Size = new System.Drawing.Size(75, 23); this.buttonStart.TabIndex = 0; this.buttonStart.Text = "Start"; this.buttonStart.UseVisualStyleBackColor = true; this.buttonStart.Click += new System.EventHandler(this.buttonStart_Click); // // buttonStop // this.buttonStop.Enabled = false; this.buttonStop.Location = new System.Drawing.Point(28, 55); this.buttonStop.Name = "buttonStop"; this.buttonStop.Size = new System.Drawing.Size(75, 23); this.buttonStop.TabIndex = 1; this.buttonStop.Text = "Stop"; this.buttonStop.UseVisualStyleBackColor = true; this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click); // // buttonScreenshot // this.buttonScreenshot.Enabled = false; this.buttonScreenshot.Location = new System.Drawing.Point(109, 38); this.buttonScreenshot.Name = "buttonScreenshot"; this.buttonScreenshot.Size = new System.Drawing.Size(100, 23); this.buttonScreenshot.TabIndex = 2; this.buttonScreenshot.Text = "Take Screenshot"; this.buttonScreenshot.UseVisualStyleBackColor = true; this.buttonScreenshot.Click += new System.EventHandler(this.buttonScreenshot_Click); // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(234, 111); this.Controls.Add(this.buttonScreenshot); this.Controls.Add(this.buttonStop); this.Controls.Add(this.buttonStart); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Form1"; this.ResumeLayout(false); } #endregion private System.Windows.Forms.Button buttonStart; private System.Windows.Forms.Button buttonStop; private System.Windows.Forms.Button buttonScreenshot; } }

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Form1.cs
      
using System.Windows.Forms; using BytescoutScreenCapturingLib; // 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 "BytescoutScreenCapturing 1.0 Type Library" // 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 ScreenCapturingExample { public partial class Form1 : Form { private Capturer _capturer = null; private int _screencastCount = 0; private int _screenshotCount = 0; public Form1() { InitializeComponent(); // Create and setup Capturer object: _capturer = new Capturer(); // Capture the full screen _capturer.CapturingType = CaptureAreaType.catScreen; // Set movie width and height to the current monitor dimensions _capturer.OutputWidth = _capturer.MonitorWidth; _capturer.OutputHeight = _capturer.MonitorHeight; // Setup screenshots _capturer.ScreenshotImageFormat = ScreenshotImageType.ssitPng; // Save images in PNG format _capturer.ScreenshotOutputFolder = "\\."; // Save to the current folder _capturer.ScreenshotSavingType = ScreenshotSavingType.ssstManual; // Take screenshots manually } 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; } private void buttonStop_Click(object sender, System.EventArgs e) { // Stop recording _capturer.Stop(); buttonStart.Enabled = true; buttonStop.Enabled = false; buttonScreenshot.Enabled = false; MessageBox.Show("Screencast saved to " + _capturer.OutputFileName, ProductName); } private void buttonScreenshot_Click(object sender, System.EventArgs e) { string fileName = string.Format("screenshot{0}.png", ++_screenshotCount); // Take screenshot during the recording _capturer.TakeScreenshot(fileName); MessageBox.Show("Screenshot saved to " + fileName, ProductName); } } }

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Program.cs
      
using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; namespace ScreenCapturingExample { static class Program { /// <summary> /// The main entry point for the application. /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } } }

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

VIDEO

ON-PREMISE OFFLINE SDK

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

ON-DEMAND REST WEB API

Get Your API Key

Explore Web API Docs

Explore Web API Samples

Tutorials:

prev
next