BlackMagic DeckLink Duo2's Duplex-Mode


At C3VOC we use BlackMagic DeckLink Cards to input HDMI and SDI into our Linux-Based Video-Mixing systems. They have excellent Linux-Support and the SDK is implemented in both major Open-Source Multimedia-Frameworks (ffmpeg & gstreamer).

The newer systems use Duo2 Cards which have 4 SDI Connectors and 1 Reference-Clock Input. Up until recently the GStreamer framework only supported 2 of the 4 Connectors, because using the others requires configuring the – so called – Duplex Mode.

According to the SDK Documentation the Duo2 is essentially two independant devices, each with 2 SDI Connectors. For each of those two Master-Devices the Duplex-Mode can independently be set to Half Duplex or Full Duplex. This changes how and if the two Connectors on the Master-Devices interacts and also ties in with the Alpha-Keying Logic available in each of the Master Devices.

The Docs are quite sparse on what the different Duplex Modes actually mean in Input and Output, so while I implemented Duplex-Mode for GStreamer I took a deep look at all possible combinations of Input/Output and Half/Duplex-Mode with Internal/External keyer.

Device Numbering

The device-number to connector-mapping is as follows for the Duo2

  • device-number=0 Connector 1 (Primary)
  • device-number=1 Connector 3 (Primary)
  • device-number=2 Connector 2 (Secondary of #0)
  • device-number=3 Connector 4 (Secondary of #1)

And for the Quad2

  • device-number=0 Connector 1 (Primary)
  • device-number=1 Connector 3 (Primary)
  • device-number=2 Connector 5 (Primary)
  • device-number=3 Connector 7 (Primary)
  • device-number=4 Connector 2 (Secondary of #0)
  • device-number=5 Connector 4 (Secondary of #1)
  • device-number=6 Connector 6 (Secondary of #2)
  • device-number=7 Connector 8 (Secondary of #3)

Half-Duplex

By default GStreamer will configure the DeckLink Cards into half-duplex mode, so that each connector acts as if it were an independant DeckLink Card which can either be used as an Input or as an Output. In this mode the Duo2 can be used as as 4 SDI In-/Outputs and the Quad2 as 8 SDI In-/Outputs.

Half-Duplex - Capture

gst-launch-1.0 \
    decklinkvideosrc device-number=0 mode=1080p25 ! c. \
    decklinkvideosrc device-number=1 mode=1080p25 ! c. \
    decklinkvideosrc device-number=2 mode=1080p25 ! c. \
    decklinkvideosrc device-number=3 mode=1080p25 ! c. \
    compositor name=c \
        sink_0::xpos=0   sink_0::ypos=0   sink_0::width=960 sink_0::height=540 \
        sink_1::xpos=960 sink_1::ypos=0   sink_1::width=960 sink_1::height=540 \
        sink_2::xpos=0   sink_2::ypos=540 sink_2::width=960 sink_2::height=540 \
        sink_3::xpos=960 sink_3::ypos=540 sink_3::width=960 sink_3::height=540 !\
        autovideosink

Half-Duplex - Playback

gst-launch-1.0 \
    videotestsrc is-live=true foreground-color=0x00ffff00 ! \
        decklinkvideosink device-number=0 mode=1080p25 \
    videotestsrc is-live=true foreground-color=0x00ff00ff ! \
        decklinkvideosink device-number=1 mode=1080p25 \
    videotestsrc is-live=true foreground-color=0x0000ffff ! \
        decklinkvideosink device-number=2 mode=1080p25 \
    videotestsrc is-live=true foreground-color=0x00ff0000 ! \
        decklinkvideosink device-number=0 mode=1080p25

Full-Duplex

When operating in full-duplex mode, the two connectors of the Master-Device are combined, performing extra processing with the second connection.

This mode is most useful for Playout.

Full-Duplex - Capture only

When capturing in Full-Duplex-Mode from a Master-Device' primary Connector, the secondary Connector outputs the captured image unchanged.

gst-launch-1.0 \
    decklinkvideosrc device-number=0 mode=1080p25 duplex-mode=full ! \
        autovideosink

Full-Duplex - Simulatanous Capture and Playback

When simultaneously capturing and playing out onto the same Master-Device, the secondary Connecor outputs the played out video. Note, that this can also be achieved using Half-Duplex-Mode.

gst-launch-1.0 \
    decklinkvideosrc device-number=0 mode=1080p25 duplex-mode=full ! \
    videoflip video-direction=vert ! \
    decklinkvideosink device-number=0 mode=1080p25 duplex-mode=full

Full-Duplex - Playback without Keyer

When playing back in Full-Duplex mode, only the primary Connector is used:

gst-launch-1.0 \
    videotestsrc is-live=true foreground-color=0x00ffff00 ! \
    decklinkvideosink device-number=0 mode=1080p25

Full-Duplex - Playback with internal Keyer

Keying is the process of overlaing Video with an Alpha-Channel on top of an existing Video-Stream. The Duo2 and Quad2-Cards can perform two different Keying-Modes when operated in full-duplex mode. Both modes expect Video with an Alpha-Channel.

In internal Keying-Mode the primary Connector becomes an Input and the secondary Connector an Output. The Keyer overlays Video played back from the Computer onto the Input and outputs the combined Video-Stream to the Output.

gst-launch-1.0 \
    videotestsrc foreground-color=0x00000000 background-color=0x00000000 ! \
    video/x-raw,format=BGRA,width=1920,height=1080 ! \
    decklinkvideosink device-number=0 duplex-mode=full keyer-mode=internal video-format=8bit-bgra mode=1080p25

Full-Duplex - Playback with external Keyer

In external Keying-Mode the primary Connector outputs the alpha-chanel as the luma-value (key-channel). Transparent pixels are black, opaque pixels are white. The RGB-Component of the Video are output on the secondary Connector.

gst-launch-1.0 \
    videotestsrc foreground-color=0x00000000 background-color=0x00000000 ! \
    video/x-raw,format=BGRA,width=1920,height=1080 ! \
    decklinkvideosink device-number=0 duplex-mode=full keyer-mode=external video-format=8bit-bgra mode=1080p25