How to use CasparCG with Decklink 4k extreme for key/fill?

Hello guys,

I’m a complete beginner in this despite my experience and knowledge on videos and computers in general and your help is very much needed and appreciated.

my problem is 1 year ago when I tried to use casparCG with the decklink 4k extreme card for playing graphics and so on. No matter what I try I couldn’t get this thing to work properly. the furthest I got to getting it to work is getting only key or only fill and also their colors look off.

I think that I’m doing something wrong along the road from modifying the config file in casparcg, until connecting the sdi cables in the card itself.

this is a little brief about my setup:

  • windows 10 64 bit
  • casparcg Client 2.0.8
  • casparcg Server 2.0.7
  • the outputting card used: Decklink 4k Extreme
  • 2 sdi cables connected to port 3 and 4 in the decklink card
  • Outputting to Blackmagic atem 2 me 4k production switcher
  • the output is going as normal input feed same as if it’s a camera.
  • I then chose the downstream or upstream fill and keys as these inputs (let’s say input 6 and 7)
  • the config file is attached.
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <paths>
    <media-path>media\</media-path>
    <log-path>log\</log-path>
    <data-path>data\</data-path>
    <template-path>templates\</template-path>
    <thumbnails-path>thumbnails\</thumbnails-path>
  </paths>
  <channels>
    <channel>
        <video-mode>PAL</video-mode>
        <consumers>
          <screen>
            <device>1</device>
          </screen>
          <system-audio />
        </consumers>
    </channel>

<channel>

<video-mode>2160p2398</video-mode>

<consumers>

<decklink>

<device>1</device>

<key-device>device + 1</key-device>

<embedded-audio>true</embedded-audio>

<latency>default</latency>

<keyer>external</keyer>

<key-only>false</key-only>

<buffer-depth>4</buffer-depth>

</decklink>

</consumers>

</channel>
  </channels>
  <controllers>
    <tcp>
        <port>5250</port>
        <protocol>AMCP</protocol>
    </tcp>
  </controllers>
</configuration>

<!--
<log-level>       trace [trace|debug|info|warning|error]</log-level>
<channel-grid>    false [true|false]</channel-grid>
<mixer>
    <blend-modes>          false [true|false]</blend-modes>
    <straight-alpha>       false [true|false]</straight-alpha>
    <chroma-key>           false [true|false]</chroma-key>
    <mipmapping_default_on>false [true|false]</mipmapping_default_on>
</mixer>
<auto-deinterlace>true  [true|false]</auto-deinterlace>
<auto-transcode>  true  [true|false]</auto-transcode>
<pipeline-tokens> 2     [1..]       </pipeline-tokens>
<template-hosts>
    <template-host>
        <video-mode/>
        <filename/>
        <width/>
        <height/>
    </template-host>
</template-hosts>
<flash>
    <buffer-depth>auto [auto|1..]</buffer-depth>
</flash>
<thumbnails>
    <generate-thumbnails>true [true|false]</generate-thumbnails>
    <width>256</width>
    <height>144</height>
    <video-grid>2</video-grid>
    <scan-interval-millis>5000</scan-interval-millis>
    <generate-delay-millis>2000</generate-delay-millis>
    <video-mode>720p2500</video-mode>
    <mipmap>false</mipmap>
</thumbnails>
<channels>
    <channel>
        <video-mode> PAL [PAL|NTSC|576p2500|720p2398|720p2400|720p2500|720p5000|720p2997|720p5994|720p3000|720p6000|1080p2398|1080p2400|1080i5000|1080i5994|1080i6000|1080p2500|1080p2997|1080p3000|1080p5000|1080p5994|1080p6000|1556p2398|1556p2400|1556p2500|dci1080p2398|dci1080p2400|dci1080p2500|2160p2398|2160p2400|2160p2500|2160p2997|2160p3000|dci2160p2398|dci2160p2400|dci2160p2500] </video-mode>
        <channel-layout>stereo [mono|stereo|dts|dolbye|dolbydigital|smpte|passthru]</channel-layout>
        <straight-alpha-output>false [true|false]</straight-alpha-output>
        <consumers>
            <decklink>
                <device>[1..]</device>
                <key-device>device + 1 [1..]</key-device>
                <embedded-audio>false [true|false]</embedded-audio>
                <channel-layout>stereo [mono|stereo|dts|dolbye|dolbydigital|smpte|passthru]</channel-layout>
                <latency>normal [normal|low|default]</latency>
                <keyer>external [external|external_separate_device|internal|default]</keyer>
                <key-only>false [true|false]</key-only>
                <buffer-depth>3 [1..]</buffer-depth>
                <custom-allocator>true [true|false]</custom-allocator>
            </decklink>
            <bluefish>
                <device>[1..]</device>
                <embedded-audio>false [true|false]</embedded-audio>
                <channel-layout>stereo [mono|stereo|dts|dolbye|dolbydigital|smpte|passthru]</channel-layout>
                <key-only>false [true|false]</key-only>
            </bluefish>
            <system-audio></system-audio>
            <screen>
                <device>[0..]</device>
                <aspect-ratio>default [default|4:3|16:9]</aspect-ratio>
                <stretch>fill [none|fill|uniform|uniform_to_fill]</stretch>
                <windowed>false [true|false]</windowed>
                <key-only>false [true|false]</key-only>
                <auto-deinterlace>true [true|false]</auto-deinterlace>
                <vsync>false [true|false]</vsync>
                <name>[Screen Consumer]</name>
                <borderless>false [true|false]</borderless>
            </screen>
            <newtek-ivga>
              <channel-layout>stereo [mono|stereo|dts|dolbye|dolbydigital|smpte|passthru]</channel-layout>
              <provide-sync>true [true|false]</provide-sync>
            </newtek-ivga>
            <file>
                <path></path>
                <vcodec>libx264 [libx264|qtrle]</vcodec>
                <separate-key>false [true|false]</separate-key>
            </file>
            <stream>
                <path></path>
                <args></args>
            </stream>
        </consumers>
    </channel>
</channels>
<osc>
  <default-port>6250</default-port>
  <predefined-clients>
    <predefined-client>
      <address>127.0.0.1</address>
      <port>5253</port>
    </predefined-client>
  </predefined-clients>
</osc>
<audio>
  <channel-layouts>
    <channel-layout>
      <name>mono</name>
      <type>1.0</type>
      <num-channels>1</num-channels>
      <channels>C</channels>
    </channel-layout>
    <channel-layout>
      <name>stereo</name>
      <type>2.0</type>
      <num-channels>2</num-channels>
      <channels>L R</channels>
    </channel-layout>
    <channel-layout>
      <name>dts</name>
      <type>5.1</type>
      <num-channels>6</num-channels>
      <channels>C L R Ls Rs LFE</channels>
    </channel-layout>
    <channel-layout>
      <name>dolbye</name>
      <type>5.1+stereomix</type>
      <num-channels>8</num-channels>
      <channels>L R C LFE Ls Rs Lmix Rmix</channels>
    </channel-layout>
    <channel-layout>
      <name>dolbydigital</name>
      <type>5.1</type>
      <num-channels>6</num-channels>
      <channels>L C R Ls Rs LFE</channels>
    </channel-layout>
    <channel-layout>
      <name>smpte</name>
      <type>5.1</type>
      <num-channels>6</num-channels>
      <channels>L R C LFE Ls Rs</channels>
    </channel-layout>
    <channel-layout>
      <name>passthru</name>
      <type>16ch</type>
      <num-channels>16</num-channels>
      <channels />
    </channel-layout>
  </channel-layouts>
  <mix-configs>
    <mix-config>
      <from>1.0</from>
      <to>2.0</to>
      <mix>add</mix>
      <mappings>
        <mapping>C L 1.0</mapping>
        <mapping>C R 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>1.0</from>
      <to>5.1</to>
      <mix>add</mix>
      <mappings>
        <mapping>C L 1.0</mapping>
        <mapping>C R 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>1.0</from>
      <to>5.1+stereomix</to>
      <mix>add</mix>
      <mappings>
        <mapping>C L    1.0</mapping>
        <mapping>C R    1.0</mapping>
        <mapping>C Lmix 1.0</mapping>
        <mapping>C Rmix 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>2.0</from>
      <to>1.0</to>
      <mix>add</mix>
      <mappings>
        <mapping>L C 1.0</mapping>
        <mapping>R C 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>2.0</from>
      <to>5.1</to>
      <mix>add</mix>
      <mappings>
        <mapping>L L 1.0</mapping>
        <mapping>R R 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>2.0</from>
      <to>5.1+stereomix</to>
      <mix>add</mix>
      <mappings>
        <mapping>L L    1.0</mapping>
        <mapping>R R    1.0</mapping>
        <mapping>L Lmix 1.0</mapping>
        <mapping>R Rmix 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1</from>
      <to>1.0</to>
      <mix>average</mix>
      <mappings>
        <mapping>L  C 1.0</mapping>
        <mapping>R  C 1.0</mapping>
        <mapping>C  C 0.707</mapping>
        <mapping>Ls C 0.707</mapping>
        <mapping>Rs C 0.707</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1</from>
      <to>2.0</to>
      <mix>average</mix>
      <mappings>
        <mapping>L  L 1.0</mapping>
        <mapping>R  R 1.0</mapping>
        <mapping>C  L 0.707</mapping>
        <mapping>C  R 0.707</mapping>
        <mapping>Ls L 0.707</mapping>
        <mapping>Rs R 0.707</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1</from>
      <to>5.1+stereomix</to>
      <mix>average</mix>
      <mappings>
        <mapping>L   L   1.0</mapping>
        <mapping>R   R   1.0</mapping>
        <mapping>C   C   1.0</mapping>
        <mapping>Ls  Ls  1.0</mapping>
        <mapping>Rs  Rs  1.0</mapping>
        <mapping>LFE LFE 1.0</mapping>

        <mapping>L  Lmix 1.0</mapping>
        <mapping>R  Rmix 1.0</mapping>
        <mapping>C  Lmix 0.707</mapping>
        <mapping>C  Rmix 0.707</mapping>
        <mapping>Ls Lmix 0.707</mapping>
        <mapping>Rs Rmix 0.707</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1+stereomix</from>
      <to>1.0</to>
      <mix>add</mix>
      <mappings>
        <mapping>Lmix C 1.0</mapping>
        <mapping>Rmix C 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1+stereomix</from>
      <to>2.0</to>
      <mix>add</mix>
      <mappings>
        <mapping>Lmix L 1.0</mapping>
        <mapping>Rmix R 1.0</mapping>
      </mappings>
    </mix-config>
    <mix-config>
      <from>5.1+stereomix</from>
      <to>5.1</to>
      <mix>add</mix>
      <mappings>
        <mapping>L   L   1.0</mapping>
        <mapping>R   R   1.0</mapping>
        <mapping>C   C   1.0</mapping>
        <mapping>Ls  Ls  1.0</mapping>
        <mapping>Rs  Rs  1.0</mapping>
        <mapping>LFE LFE 1.0</mapping>
      </mappings>
    </mix-config>
  </mix-configs>
</audio>
-->

I think the key-device setting is not usually needed so try and remove that from the consumer.
The “device + 1” that appears at the bottom of the config file is only an indication. You should hardcode the device in that setting (if fill is ‘1’, then usually the key is 2, so you should write ‘2’ there)

AFAIK the Decklink Extreme only supports fill & key up to HD. For 4K resolutions it only supports one output. So try setting the channel to 1080i and you should get a fill & key output. Use another or a second card for 4K.

thank you so much @rrebuffo for your help. from what I understood from your reply the key-device is not necessary but is not the cause of the issue right? and I need to enter the actual device number not device + 1 or did I misunderstand?

that’s a very bad news, the main reason for me getting this card almost 2 years ago when it’s out because I wanted to output 4k signal key/fill. otherwise the duo will serve as good if not better. are you sure the 4k extreme doesn’t output 2 streams of 4k?

Not 100% sure. You can easy test by setting it to 1080i and check if you get fill & key and then try higher resolutions. By the way, the Duo and Duo 2 are only HD too. You would need the 8K Pro.

I remember I tried this in my last test but it wasn’t successful. to be honest, I couldn’t really identify where exactly I’m doing something wrong. I suspect that the config file is not how it should be, for instance I took a copy of the changes that people do for decklink Duo and tried to amend it to match the configs of the extreme 4k. but since my experience is very limited with these things, I can’t really make sure if what I did is correct or not. I’ll give @rrebuffo 's idea a try and see how it goes. By the way, is there an easy way to know the port number in the 4k extreme to enter this number in the config file?

I found a copy of the 4k Extreme that I have on this link: http://7bd.com/content/products/category7BD_31755/productCMS_155101/7BD_EN_155101.pdf

and as it says

SDI Video Output
2 x 10-bit SD/HD/2K/4K and 2D/3D
switchable. Supports 3Gb/s and 6Gb/s
single link and dual link.

also it says

I’m really confused becase @didikunz’s point is really valid, because I’ve never seen 2 outputs coming from the casparCG, no matter how hard I tried, but it might as well be me not knowing how to correctly setup the config file.

I just want to confirm for adding these 2 ports that are shown in the diagram, I just need to add one block in the config file right?

As I said: To check, if your config is the problem try with 1080i. That is sure working. Then you can try other tedolutions.

I tried using 1080p2398 but unfortunately it didn’t work. I must be doing something wrong with the config file because in the log file when I intialise the server it shows only [1-1] decklink
while I assume there should be 2

4K Extreme is a one output card. Though you have 2 SDI outputs, the second one is only for the key signal which is automatically generated in the card.

thank you @hreinnbeck. I think I understand now why it only shows one output, but in this case and by referring to the card diagram that I’ve posted earlier, shouldn’t the card work fine for 4k key and fill output? even considering it’s only 1 output card, this is exactly what I need. 1 output with key but in 2160p2398.

am I using the wrong video files? I export AVI files from after effects with RGB+alpha setting, premultiplied. but in my tests yesterday no matter whether it’s 2160p or 1080p setting, the casparcg only outputs the key video(black and white) but not the fill.

I tried using the card with other software just to make sure that it works fine, and with Titler pro 4 broadcast the colors of the graphics appear off, like blue designs look pale purple or so. I don’t know if this indicates something at all, because I sent the card to Blackmagic design for checking, and they said it’s working fine and showed me some evidence.

I’m lost in all this, it’s like a puzzle to me, installing and setting up the whole live video setup wasn’t as difficult and confusing as presenting the graphics on it.

I hope someone can help me and put me on the right track for this, and I just want to say that I’m truly thankful for everyone who was kind enough to have a look at my post and give me some tip of advice, which although didn’t completely fix the issue, but gave me really good knowledge and put me on step closer to fixing the issue. so thank you all for your help and I’m still in need for further help.

@didikunz looks to be correct about the HD only keyer based on this: https://github.com/CasparCG/server/issues/305 . And all other documentation only mentions SD/HD keyer as well. Did you get a UHD key/fill with Titler Pro?

All of our alpha video is ProRes 4444, which I know is far from efficient space-wise but it plays reliably and we don’t deal with very long videos that need alpha. Plus my colleague likes to use Motion which has about as many options as an Uzbek prison lunch menu. Might be something to try if you’re desperate.

In your config, the keyer is set to external but I believe default should just initalise the internal keyer (up to 1080 resolutions I guess). You also don’t need the ‘key device’ field as it’s the same output device and might just confuse Caspar if you’ve got more than 1 device appearing in Desktop Video as it might be trying to output the key on a different card, or conversely on a card that doesn’t exist. It’s only necessary (as far as I know) when the card doesn’t have an internal keyer like a Duo 1 or a Quad 1 or you need to put the key on a different card.

AFAIK the key-device setting is ignored until you set the key mode to external-separate-device. But it safer to remove the line anyway.

Thank you guys for all your support, although your points seem very valid depending on the post @flawton has referred to. However I find this to be very misleading information because from the specs pdf for this card they clearly mentioned it is 2 outputs each is capable of producing 6G (UHD) single link. You would assume from this that it should be able to output 2 streams, one is 4k fill and another one is 4k key as this makes sense, and there’s no line in the document talks about limited keying resolution.

This is why dealing with blackmagic products is very irritating, because common sense doesn’t apply when working with them. Take this for example, it says (4k extreme) it shows a diagram of 2 output ports 6g. It mentions keying feature, but when you use it, it’s just full HD keying.

How stupid is that?

Anyways, if I want to achieve 4k keying what should I do? Get another 4k extreme on the same device? Get 8k pro? Or 4k studio?

Yes, it’s quite annoying. I use an HD Extreme 3D+ which is advertised as a 1080p59.97 card and can do so over single link but the keyer is capped at 1080p25/29.97 which isn’t readily advertised by BMD. I assume it’s a processing limitation and the dual 6G outputs are only advertised for doing dual link video (SMPTE ST 2081-11) which doesn’t really increase the amount of work the card has to do, it just has to divide or reassemble the stream.

According to this : https://softron.zendesk.com/hc/en-us/articles/207695497-Which-video-cards-can-support-internal-and-external-keying the 4K Extreme 12G, 4K Pro and 8K Pro support 4K internal key. I believe the ‘Studio’ models are single output so that won’t help you. You can try to output the key or fill on another card but there aren’t any guarantees that they’ll sync reliably.

I would suggest the 8K pro. You get a 2x fill & key for less money than the Extreme 4K costs.

1 Like

I’d like to thank everyone of you guys, you helped me really with this case. I’m very grateful. thanks a lot.

2 Likes

I didn’t realise how cheap the 8K Pro was, makes the Duo 2 look very bad value now

yeah, actually I like the new approach that blackmagic is following these days in their new products, they provide products with high level of flexibility, such as the atem 4k production mixer which is 12g but can set frame rate and so on each port individually, and here is the 8k pro which allows a good flexibility as well. the only issue is with blackmagic you can never expect what’s missing from the device, because there’s always something to disappoint you with blackmagic.