The sample source codes on this page shows how to capture video from screen with webcamera overlay in C++ (unmanaged). 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. It can be used to capture video from screen with webcamera overlay using C++ (unmanaged).
You will save a lot of time on writing and testing code as you may just take the C++ (unmanaged) code from ByteScout Screen Capturing SDK for capture video from screen with webcamera overlay below and use it in your application. In order to implement the functionality, you should copy and paste this code for C++ (unmanaged) below into your code editor with your app, compile and run your application. Implementing C++ (unmanaged) application typically includes multiple stages of the software development so even if the functionality works please test it with your data and the production environment.
Free trial version of ByteScout Screen Capturing SDK is available for download from our website. Get it to try other source code samples for C++ (unmanaged).
On-demand (REST Web API) version:
Web API (on-demand version)
On-premise offline SDK for Windows:
60 Day Free Trial (on-premise)
// CaptureFromEntireScreen.cpp : Defines the entry point for the console application. // #include "stdafx.h" #import "BytescoutScreenCapturing.dll" using namespace BytescoutScreenCapturingLib; using namespace std; void usage(ICapturer* capturer); void setParams(int argc, _TCHAR* argv[], ICapturer* capturer); int _tmain(int argc, _TCHAR* argv[]) { ::CoInitialize(0); // Create Capturer instance CLSID clsid_ScreenCapturer; CLSIDFromProgID(OLESTR("BytescoutScreenCapturing.Capturer"), &clsid_ScreenCapturer); ICapturer* capturer = NULL; ::CoCreateInstance(clsid_ScreenCapturer, NULL, CLSCTX_ALL, __uuidof(ICapturer), (LPVOID*) &capturer); if (!capturer) { _ftprintf(stdout, _T("Screen Capturer is not installed properly.")); ::CoUninitialize(); return 1; } capturer->put_RegistrationName(_T("demo")); capturer->put_RegistrationKey(_T("demo")); // Set capturing type capturer->put_CapturingType(catScreen); // uncomment to enable recording of semitransparent or layered windows (Warning: may cause mouse cursor flickering) // capturer->CaptureTransparentControls = true; // Set webcamera device by name (put_CurrentWebCamName() method) // or set it by index using put_CurrentWebCam() capturer->put_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->put_AddWebCamVideo(VARIANT_TRUE); // Set output video width and height capturer->put_OutputWidth(640); capturer->put_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); // Set output file name capturer->OutputFileName = _T("Output.wmv"); // Start capturing HRESULT hr = 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 if (FAILED(hr)) { // Error handling CComBSTR s; capturer->get_LastError(&s); _ftprintf(stdout, _T("Capture failed: %s\n"), CString(s)); } else { _tprintf(_T("Starting capture - Hit a key to stop ...\n")); int i = 0; TCHAR *spin = _T("|/-\\"); // Show some progress while (!_kbhit()) { _tprintf(_T("\rEncoding %c"), spin[i++]); i %= 4; Sleep(50); } // Stop after key press capturer->Stop(); _tprintf(_T("\nDone.")); getchar(); } // Release Capturer capturer->Release(); capturer = NULL; ::CoUninitialize(); return 0; }
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
// stdafx.cpp : source file that includes just the standard includes // CaptureFromEntireScreen.pch will be the pre-compiled header // stdafx.obj will contain the pre-compiled type information #include "stdafx.h" // TODO: reference any additional headers you need in STDAFX.H // and not in this file
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
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. #define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. #endif #include <stdio.h> #include <tchar.h> #include <atlbase.h> #include <atlstr.h> #include <conio.h>
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