You can convert video before sending it to an output device in both MPlatform and MFormats. Choose a resolution, frame rate, scan type and pixel format that the selected device supports. A conversion request does not add new hardware output modes.
Select the device first, then configure conversion before starting output. See Initialization of a device for output for device enumeration and selection.
MPlatform: configure the connected renderer
MRenderer exposes IMFormat. Call FormatVideoSet with eMFT_Convert to configure conversion on that renderer. The SDK converts frames arriving from the connected source.
The following C# fragments use MPLATFORMLib. They assume that pRenderer is an existing renderer with its output device selected.
Use a standard video format
For a standard mode, specify eVideoFormat. The preset supplies dimensions, interlacing and frame rate. You can also specify fccType when a particular pixel format is required.
M_VID_PROPS vidProps = new M_VID_PROPS();
vidProps.eVideoFormat = eMVideoFormat.eMVF_NTSC;
pRenderer.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);
Describe a custom conversion format
With eMVF_Custom, describe the required geometry, frame rate and scan type explicitly. This example requests progressive 1280 × 720 video at approximately 29.97 frames per second, with a 16:9 display aspect ratio and HDYC pixels.
M_VID_PROPS vidProps = new M_VID_PROPS();
vidProps.eVideoFormat = eMVideoFormat.eMVF_Custom;
vidProps.nWidth = 1280;
vidProps.nHeight = 720;
vidProps.dblRate = 30000.0 / 1001.0;
vidProps.eInterlace = eMInterlace.eMI_Progressive;
vidProps.nAspectX = 16;
vidProps.nAspectY = 9;
vidProps.fccType = eMFCC.eMFCC_HDYC;
vidProps.eScaleType = eMScaleType.eMST_LetterBox;
pRenderer.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps);
Custom formats may be unsupported by the output device. This fragment describes a conversion request, not a guaranteed hardware mode. Prefer a supported standard preset when one matches the required output.
After configuration, connect the initialized source with pRenderer.ObjectStart(pSource). At shutdown, close the renderer with ObjectClose, close application-owned source objects, and release their COM references after processing has stopped.
MFormats: configure output or convert application-owned frames
MFRenderer exposes IMFFormat as well as IMFReceiver. For a fixed output mode, select its device and set its conversion format before feeding frames. This C# fragment uses MFORMATSLib and an existing mfRenderer:
M_VID_PROPS output = new M_VID_PROPS();
output.eVideoFormat = eMVideoFormat.eMVF_HD1080_50p;
mfRenderer.FormatVideoSet(eMFormatType.eMFT_Convert, output);
The application still owns the frame loop: acquire an MFFrame from the source, send it through ReceiverFramePut, and release the acquired frame in a finally block. Stop and join the feeding worker before calling DeviceClose and releasing the renderer.
If the application needs the converted frame itself, use MFFrame.MFConvert before sending its result to the renderer. Its destination is an M_AV_PROPS structure containing vidProps and audio properties. The method supports frame-rate conversion as well as resizing; account for its returned remaining-frame count when using frame-rate conversion. For the same-size pixel-format conversion below, MFClone provides an explicit CPU destination.
Video properties used for conversion
The following table covers the fields of M_VID_PROPS. Requested properties describe the conversion; properties read from a returned frame describe its actual storage.
| Field | Type / units | Use |
|---|---|---|
eVideoFormat |
eMVideoFormat |
Configurable standard preset or eMVF_Custom. A standard preset supplies width, height, interlacing and frame rate. |
fccType |
eMFCC |
Configurable pixel format. Examples include HDYC for 8-bit HD YUV, r210 for packed 10-bit RGB, and v210 for packed 10-bit YUV 4:2:2. |
nWidth |
Integer, pixels | Requested width for a custom format; actual width when reading frame properties. |
nHeight |
Integer, pixels | Requested height for a custom format. For RGB buffers, positive height denotes bottom-up storage and negative height denotes top-down storage. |
nRowBytes |
Integer, bytes per row | Storage stride, including padding. FormatVideoSet ignores a supplied stride and calculates the layout. Read the returned frame's properties when accessing its buffer. |
eInterlace |
eMInterlace |
Configurable scan type or field order. Specify it explicitly for a custom format. |
nAspectX |
Short integer | Configurable horizontal part of the display aspect ratio, such as 16. |
nAspectY |
Short integer | Configurable vertical part of the display aspect ratio, such as 9. Set both aspect fields for an explicit ratio. |
dblRate |
Double, frames per second | Configurable frame rate for a custom format. Use a fractional expression such as 30000.0 / 1001.0 where appropriate. |
eScaleType |
eMScaleType |
Configurable scaling policy, including letterbox/pillarbox, crop, ignore aspect ratio, or no scaling. |
eGPUFlags |
eGPUTextureFormat |
Frame storage and texture flags. Leave zero in these simple format requests; enable GPU processing through the GPU pipeline configuration. |
10-bit GPU video and DeckLink output
With the GPU pipeline enabled, 10-bit RGB video can be carried as GPU r210 frames. DeckLink output may require v210 instead. This matters for modes such as UHD 50p and higher when the card accepts 10-bit YUV but does not accept 10-bit RGB in that mode.
The conversion covered here packs the 10-bit GPU image into v210 and transfers the result to CPU memory for device output. Perform resizing before the final packing step; the explicit frame example below preserves the input size and frame rate.
In the current DeckLink integration, selected by bmd.new_api=true, the renderer derives its initial pixel format from the arriving frame. For GPU 10-bit RGB, it selects 10-bit YUV when 4:4:4 output is not enabled. It also checks device support and can fall back from unsupported 10-bit RGB to 10-bit YUV. If the requested format is still unsupported, further fallback can include 8-bit YUV, so successful output alone does not establish 10-bit output.
For older SDK installations, confirm that the installed build supports GPU r210-to-v210 conversion before using this workflow. Mode availability also depends on the card, driver and output configuration.
MPlatform usage
Keep the connected-object pipeline. After enabling GPU processing and selecting a compatible DeckLink device, request the required GPU video format on MRenderer, then connect the source. This scoped fragment assumes an initialized source capable of supplying the intended 10-bit video:
M_VID_PROPS output = new M_VID_PROPS();
output.eVideoFormat = eMVideoFormat.eMVF_4K_UHD_50p;
output.fccType = eMFCC.eMFCC_r210;
pRenderer.FormatVideoSet(eMFormatType.eMFT_Convert, ref output);
pRenderer.ObjectStart(pSource);
The renderer handles the required device transfer internally. The preset requests UHD 50p; it does not guarantee that the selected card and connection support that mode.
MFormats usage
You can feed suitable GPU r210 frames directly to MFRenderer and let the current DeckLink integration perform the transfer. If your application needs an explicit CPU v210 frame, clone it with eMFC_Full_ForceCPU and eMFCC_v210.
This C# helper uses MFORMATSLib. Its input is an existing GPU r210 frame already at the desired size and frame rate. The renderer must already have its device selected and must not have a conflicting conversion request. The caller retains ownership of both arguments and must release each acquired input frame in its own finally block.
using MFORMATSLib;
using System.Runtime.InteropServices;
static void SendAsV210(MFFrame input, MFRendererClass renderer)
{
MFFrame converted = null;
try
{
input.MFClone(out converted,
eMFrameClone.eMFC_Full_ForceCPU,
eMFCC.eMFCC_v210);
converted.MFWaitAsync();
M_AV_PROPS actual;
int audioSamples;
converted.MFAVPropsGet(out actual, out audioSamples);
// actual.vidProps.nRowBytes is the resulting CPU stride.
// Maximum receive wait: 1 second in 100-nanosecond units.
renderer.ReceiverFramePut(converted, 10000000, "");
}
finally
{
if (converted != null)
Marshal.ReleaseComObject(converted);
}
}
This clone copies video and audio and preserves frame timing and associated data. Waiting for completion before accessing the result also covers asynchronous GPU-to-CPU transfer.
Property scope and row stride
| Setting | Scope and availability | When to configure |
|---|---|---|
gpu_pipeline |
Factory/global Boolean setting, initially false. Enables the GPU processing workflow. | Configure before creating and opening the media pipeline. |
bmd.new_api |
Renderer initialization Boolean setting, initially true in the current implementation. Selects the DeckLink integration described above. | The backend is selected during renderer initialization and device enumeration; it is not a per-frame switch. |
output.10bit |
Legacy DeckLink renderer Boolean setting, initially false. When enabled, it requests v210 where keying is off and the selected pixel format is not ARGB32. The current integration described above derives its format from frames and device capabilities. | Set on the renderer before output starts. Changing it during legacy output stops that output for reinitialization. |
A reader's similarly named output.10bit property belongs to source processing; it does not configure the renderer.
When constructing a conversion request, do not reuse an r210 stride after changing the pixel format to v210. Leave nRowBytes at zero when the SDK should calculate the layout. A calculated request stride is not proof of the returned buffer's stride: retrieve actual properties with MFAVPropsGet, and keep the owning frame alive while using its memory.
Still have questions?
Tell us what didn’t work or what you’d like clarified.