Skip to main content

Screen source

Screen source supports recording video from the screen. You can select the display (if more than one), the part of the screen to be recorded, and optional mouse cursor recording.

Settings

[Windows] ScreenCaptureDX9SourceSettings

Use DirectX 9 for screen recording.

[Windows] ScreenCaptureD3D11SourceSettings

Use Direct3D 11 for screen recording.

[Windows] ScreenCaptureGDISourceSettings

Use GDI for screen recording.

[macOS] ScreenCaptureMacOSSourceSettings

Use AVFoundation for screen recording.

[Linux] ScreenCaptureXDisplaySourceSettings

Use X11 for screen recording.

Block info

Name: ScreenSourceBlock.

Pin directionMedia typePins count
Output videouncompressed video1

The sample pipeline

[Windows] Window capture

You can capture a specific window by using the ScreenCaptureD3D11SourceSettings class.

Sample code

var pipeline = new MediaBlocksPipeline(true);

var screenSourceBlock = new ScreenSourceBlock(new ScreenCaptureDX9SourceSettings() { FrameRate = 15 });

var h264EncoderBlock = new H264EncoderBlock(new MFH264EncoderSettings());
pipeline.Connect(screenSourceBlock.Output, h264EncoderBlock.Input);

var mp4SinkBlock = new MP4SinkBlock(new MP4SinkSettings(@"output.mp4"));
pipeline.Connect(h264EncoderBlock.Output, mp4SinkBlock.CreateNewInput(MediaBlockPadMediaType.Video));

await pipeline.StartAsync();

Platforms

Windows.