There are types of keying supported by output devices: internal keying and external keying, and fill and key.
In internal keying mode, external software or stream will set the output device to superimpose the graphics over incoming signal:
To add graphic overlays in internal keying mode you should:
- Set color space of playlist to ARGB32,
- Set your output resolution equal to your input resolution,
- Make your frames transparent either by setting a source object background to "transparent" (for MPlatform SDK) or by converting them to ARGB32 color space (for MFormats SDK).
- Set internal keying mode for MRenderer or MFRenderer object.
In external keying mode, external software or stream sets the output device to generate video and key SDI signals and the keying is made by an external keyer:
Requirements for external keying are the same: transparent background, equal input, and output resolutions, and ARGB32 color space.
Fill and Key modes
We added a couple of extra modes for output devices - 'fill' and 'key' to emulate keying modes on devices that do not support this feature by design.
When you set "keying" to "fill" a device outputs only RGB component of the original image. With "key" it outputs only the alpha component.
This feature works for Decklink, AJA devices, and NDI streams.
Configuring keying with code
MFormats SDK
// specify FCC for MFFrames m_avProps.vidProps.fccType = eMFCC.eMFCC_ARGB32 // grab a frame from a source MFFrame frame; m_objReader.SourceFrameConvertedGetByNumber(ref m_avProps, -1, -1, out frame, ""); //Create new instance for a renderer MFRendererClass pDevice = new MFRendererClass(); //Configure new renerer and set it to the 1st available pDevice.DeviceSet(eMFDeviceType.eMFDT_Video, 0, ""); // Get amount of keying options for the device string strNameKeying; string value; int nCount; pDevice.PropsOptionGetCount("keying", out nCount); for (int i = 0; i < nCount; i++) { string strXML = string.Empty; try { pDevice.PropsOptionGetByIndex("keying", i, out strNameKeying, out strXML); if (strNameKeying == "internal") { pDevice.PropsOptionSetByIndex("keying", i); break; } } catch (Exception) { } } // output the frame to the device pDevice.ReceiverFramePut(frame, -1, "");
MPlatform SDK
// Specify ARGB32 color space M_VID_PROPS vidProps = new M_VID_PROPS(); string strFormat; myPlaylist.FormatVideoGetByIndex(eMFormatType.eMFT_Convert, 15, out vidProps, out strFormat); //Set output format vidProps.fccType = eMFCC.eMFCC_ARGB32; myPlaylist.FormatVideoSet(eMFormatType.eMFT_Convert, ref vidProps); // Set "transparent" background for a playlist object MItem bgItem; myPlaylist.PlaylistBackgroundSet(null, "transparent", "", out bgItem); //Initialize object MRendererClass pRender = new MRendererClass(); //Set required device name for rendering pRender.DeviceSet("renderer", "DeckLink SDI", ""); //Set internal keying feature pRenderer.DeviceSet("renderer::keying", "internal", ""); //start output pRenderer.ObjectStart(myPlaylist);
Which devices support keying
The SDK supports output devices natively with the internal and external keying features implemented for Blackmagic, Bluefish444, Deltacast, and AJA devices. Check your device technical specification to ensure whether it support keying.