You can capture a whole screen, part of a screen or a window with Medialooks DXGI/DX11 ScreenCapture engine. You can use the engine as a video device in an MLive object in MPlatform SDK or in an MFLive object in MFormats SDK.
Usage with MPlatform SDK
You can use a full name of ScreenCapture engine to set up it:
myLive.DeviceSet("video", "Medialooks DXGI/DX11 ScreenCapture", "")
Usage with MFormats SDK
Devices in MFormats SDK are based on its index, so to find a correct index of the ScreenCapture engine you should get the amount of all possible video sources and check video sources names:
int deviceCount = 0; liveObj.DeviceGetCount(eMFDeviceType.eMFDT_Video, out deviceCount); for (int i = 0; i < deviceCount; i++) { string currentDeviceName = ""; int currentDeviceBusy = 0; liveObj.DeviceGetByIndex(eMFDeviceType.eMFDT_Video, i, out currentDeviceName, out currentDeviceBusy); if (currentDeviceName == "Medialooks DXGI/DX11 ScreenCapture") { liveObj.DeviceSet(eMFDeviceType.eMFDT_Video, i, ""); break; } }
Properties
You can manage the engine behavior with different properties by using a PropsSet method or by setting them through the system registry:
HKEY_CURRENT_USER\SOFTWARE\Medialooks\MFormats\MFLive\MFDeviceSCR
And once specified in the registry, all the instances of ScreenCapture engine use these values. PropsSet method manages only a single instance of the object.
Name | Default value | Description |
---|---|---|
capture.show_mouse | show | Sets behavior of the mouse pointer capturing. Possible values:
|
capture.show_clicks | true | Indicates whether mouse clicks are highlighted on video. Possible values: true, false |
capture.focus_change_speed | 0.2 | Speed of focus changing in fraction per frame units. Possible values: from 0.1 to 1.0 |
capture.mode | auto | Screen capture mode. Possible values:
|
capture.current_mode | Pending | Current screen capture mode. Read-only. |
capture.dxgi.audio_samples_max_mul |
3 | Changes the maximum allowed audio buffer size and thereby avoids audio drops. Audio drops can occur due to local timing of exceeding the specified maximum audio buffer size due to jitter in video and audio frame capture. The value can be set in the range from 1 to 100 inclusive. The value is equal to the duration of the video frames. |
capture.memory_format | HDYC | Pixel memory format for hardware mode. Possible values:
|
capture.fps_limit | 30.0 | FPS value (for high values frames can be duplicated on low-performance machines). Possible values: range between 1 and 60. Otherwise, the default value is used. |
capture.frame_size | 1920x1080 | Size of the captured frame. Possible values:
|
capture.screen_enumeration_mode | DXGI |
Choose the enumeration mode.
|
capture.screenshot_timeout | 15 | Integer value in milliseconds which indicates the amount of time that API waits for changes on the screen to take a screenshot. Affects only DXGI hardware mode. Possible values: from 5 to 50 ms. |
capture.highlight_mouse | show | Show mouse highlight on screen capture frame. Possible values:
|
capture.highlight_mouse_color | Yellow(136) | Color of mouse highlight. Possible values:
|
capture.show_keypresses | false | Show key presses. Possible values: true, false |
capture.screen_index | 0 | Index of the captured screen (apply when many screens are used). Screens are enumerated according to the system order. |
capture.keypress_text_size | 1.0 | Size of keypress info text. Possible values: range from 0.5 to 2.0 |
capture.following_mode | none | Following mode. Indicates behavior of the engine on mouse movement. Possible values:
|
capture.follow_window_by_handle | none | Capture window by a handle. Once set, "capture.following_mode" is ignored. Possible values:
|
capture.area | Capture rectangular area relative to the current screen. Once set, "capture.following_mode" is ignored. Format: <Left>,<Top>,<Right>,<Bottom>, for example "100, 150, 800, 600" |
|
capture.background_color | Black(170) | Background color. Possible values:
|
capture.screen_edges | all | Capturing screen edges in following mode. Possible values:
|
capture.aspect_ratio | keep | Aspect ratio mode. Possible values:
|
capture.sampler_type | linear | Type of a sampler for hardware rendering. Possible values:
|
capture.wait_frame_msec | 0 | Frame wait timeout in milliseconds. |
capture.software_scaling | letter-box | Scaling type for software screen capture. Possible values:
|
capture.async_resize | false | Async output frame resize (experimental property). Possible values: true, false. |
capture.audio_device | default | Audio device for capturing sound. Possible values:
|
timecode.print | false | Enable timecode overlay. Possible values: true, false. |
capture.min_delay | false | Reduces frame delay but increases jitter. Possible values: true, false. |
capture.no_frame_max_count | 100 | Sets an interval of "No Video" frames after which the engine is reset. Use "0" to disable. |
capture.external_process | false | Once enabled, the ScreenCapture is processed in a separated MServer.exe process. |
You can specify any of these properties with a PropsSet method.
MPlatform SDK:
(myLive as IMProps).PropsSet("device::capture.fps_limit", "29.97"); // note the "device::" prefix please
MFormats SDK:
(myLive as IMFProps).PropsSet("capture.fps_limit", "29.97");