ByteScout Screen Capturing SDK - C++ (managed) - Record Screen Video With Webcamera Overlay - ByteScout

ByteScout Screen Capturing SDK – C++ (managed) – Record Screen Video With Webcamera Overlay

  • Home
  • /
  • Articles
  • /
  • ByteScout Screen Capturing SDK – C++ (managed) – Record Screen Video With Webcamera Overlay

How to record screen video with webcamera overlay in C++ (managed) with ByteScout Screen Capturing SDK

The tutorial shows how to record screen video with webcamera overlay in C++ (managed)

Sample source code below will show you how to cope with a difficult task like record screen video with webcamera overlay in C++ (managed). ByteScout Screen Capturing SDK is the screen video recording SDK helps in quick implementation of screen video recording. WMV, AVI, WebM output options are available with adjustable quality, video size, framerate and video and audio codec. Includes special features like live multiple blacking out of selected areas, recording from web cam as main source and as overlay, optional watermarks for output video. It can be used to record screen video with webcamera overlay using C++ (managed).

This code snippet below for ByteScout Screen Capturing SDK works best when you need to quickly record screen video with webcamera overlay in your C++ (managed) application. Just copy and paste the code into your C++ (managed) application’s code and follow the instruction. Enjoy writing a code with ready-to-use sample codes in C++ (managed).

ByteScout Screen Capturing SDK free trial version is available on our website. C++ (managed) and other programming languages are supported.

Try it today: Get 60 Day Free Trial or sign up for Web API

AssemblyInfo.cpp
      
#include "stdafx.h" using namespace System; using namespace System::Reflection; using namespace System::Runtime::CompilerServices; using namespace System::Runtime::InteropServices; using namespace System::Security::Permissions; // // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. // [assembly:AssemblyTitleAttribute("CaptureWithWebcameraOverlay")]; [assembly:AssemblyDescriptionAttribute("")]; [assembly:AssemblyConfigurationAttribute("")]; [assembly:AssemblyCompanyAttribute("")]; [assembly:AssemblyProductAttribute("CaptureWithWebcameraOverlay")]; [assembly:AssemblyCopyrightAttribute("Copyright (c) 2011")]; [assembly:AssemblyTrademarkAttribute("")]; [assembly:AssemblyCultureAttribute("")]; // // Version information for an assembly consists of the following four values: // // Major Version // Minor Version // Build Number // Revision // // You can specify all the value or you can default the Revision and Build Numbers // by using the '*' as shown below: [assembly:AssemblyVersionAttribute("1.0.*")]; [assembly:ComVisible(false)]; [assembly:CLSCompliantAttribute(true)]; [assembly:SecurityPermission(SecurityAction::RequestMinimum, UnmanagedCode = true)];

Try it today: Get 60 Day Free Trial or sign up for Web API

CaptureWithWebcameraOverlay.cpp
      
// CaptureWithWebcameraOverlay.cpp : main project file. #include "stdafx.h" using namespace System; using namespace System::Threading; using namespace System::Diagnostics; using namespace BytescoutScreenCapturingLib; int main(array<System::String ^> ^args) { // Create Capturer instance Capturer ^capturer = gcnew Capturer(); capturer->RegistrationName = "demo"; capturer->RegistrationKey = "demo"; // Set capturing type capturer->CapturingType = CaptureAreaType::catScreen; // 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; // 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->put_WMVVideoBitrate(capturer->WMVVideoBitrate * 2); // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering) // capturer->CaptureTransparentControls = true; // Set output file name capturer->OutputFileName = "Output.wmv"; // Start capturing capturer->Run(); // 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("Capture the desktop for 5s..."); // Wait for 5 seconds Thread::Sleep(5000); // Stop capturing capturer->Stop(); // Release resources System::Runtime::InteropServices::Marshal::ReleaseComObject(capturer); //capturer = NULL; Console::WriteLine("Done."); // Open the capture video in default associated application Process::Start("Output.wmv"); return 0; }

Try it today: Get 60 Day Free Trial or sign up for Web API

resource.h
      
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by app.rc

Try it today: Get 60 Day Free Trial or sign up for Web API

stdafx.cpp
      
// stdafx.cpp : source file that includes just the standard includes // CaptureWithWebcameraOverlay.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h"

Try it today: Get 60 Day Free Trial or sign up for Web API

stdafx.h
      
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once // TODO: reference additional headers your program requires here

Try it today: Get 60 Day Free Trial or sign up for Web API

MORE INFORMATION

Get 60 Day Free Trial or Visit ByteScout Screen Capturing SDK page

Explore ByteScout Screen Capturing SDK documentation

WEB API VERSION

Sign Up for free Web API key

Explore Web API Documentation

Tutorials:

prev
next