Page 1 of 1

Blackmagic 3G-SDI Shield input

PostPosted: Tue Dec 01, 2020 10:58 am
by Trilec
Hi All,
Ive been struggling to find this information:
Can you get to the input stream to extract metadata packet information.
I would like to get the focus/lens and timecode metadata. (HANC and VANC space of the HD-SDI signal.)

Is it available but no library to access it? (ie. i would need to code something)

It seem a shame to have such a awesome device, but unable to get this data.
If not , where can I put a request for Black-magic to consider this feature?


Re: Blackmagic 3G-SDI Shield input

PostPosted: Tue Dec 08, 2020 8:42 am
by daver2
I have a similar question...

We have connected a number of PTZ cameras to the VISCA port of our ATEM TV Studio Pro HD. Whilst Zoom is fine, Pan and Tilt is terrible using the trackball (lumpy control).

I have posted a message to see if anyone has had a similar problem with the ATEM or not - and doing further investigation with wireshark to see if there is a VISCA protocol incompatibility between the ATEM and the Cisco cameras we are using.

As a Plan ‘B’ I was looking to extract the Camera and Tally information from the SDI signal using the Arduino shield - but having minimal luck at finding any documentation or examples. I did find an old post indicating that this is difficult and buggy! Not what I am expecting from the quality of the BMD equipment I am seeing!

Can anyone help to kickstart me?



Re: Blackmagic 3G-SDI Shield input

PostPosted: Wed Dec 09, 2020 7:45 pm
by daver2
I think I am starting to answer my own question here...

I downloaded the BMD code and had a look through the files last night.

It looks like I need something like:

Code: Select all
// includes the Blackmagic Design SDI Control library.
#include <BMDSDIControl.h>

const int shieldAddress = 0x6E; // Match to shield configuration.
BMD_SDICameraControl_I2C ccu( shieldAddress );

int ccuLength = 0; // Number of bytes returned to process.

byte ccuData[256]; // Maximum allowed.

// Once initialisation...
void setup() {

  ccu.setOverride( false );
} // End of function setup.

// Sit here for eternity...
void loop() {

  if( ccu.available() ) {

    ccuLength = ccuData, 256 );

    // TODO: Process the data.

 } // End if.

} // End of function loop.

This should just sit and wait for an incoming SDI frame containing some data.

When the data frame occurs, .available() should return true.

At this point .read is invoked to extract the data packet itself. The data packet can be no longer than 256 bytes, so the read shouldn't fail because the incoming data packet was larger than the buffer.

The number of bytes in the packet is returned in ccuLength.

The .flushRead() call should prepare the shield for the next incoming frame.

Assuming a 1080p50 configuration, that should give me 20 milliseconds to process the current frame data before the next potential frame comes in.

I assume there is no help in parsing the packet of data that has been received and I have to do that myself.

How close am I to what is needed? Or is what I am stating pure rubbish!?

Assuming I want to pickup camera control packets (pan, tilt, zoom, focus, etc.) and which camera is currently selected to preview and live is this all I need - or would I have to intercept the tally messages as well?

I assume that when I get (say) a ZOOM message, the camera that has been selected by the ATEM will be within the header for the message?

Which SDI output on the ATEM would I be required to connect the 3G-SDI shield to? Or could I just connect it to the main output?



Re: Blackmagic 3G-SDI Shield input

PostPosted: Wed Dec 09, 2020 11:43 pm
by Ian Morrish
There is a lot of data and for all cameras so I check the bytes looking for a match.
In my case I was looking for IRIS value for a camera to send a proportional voltage out a PMW port.
Probably not the best way of doing it and I was wanting the shield to keep passing the remainder of the CCU data onto the camera but it would also stop doing that after some time (probably some buffer overrun)

if ((ccuLength == 11) && (ccuData[0] == cameraID) && (ccuData[5] == 2)) {
int angleValue = map(ccuData[9], 12, 70, 220, 60);
String camMessage = "Camera Iris:";

String camUdateMsg = camMessage + cameraData[0] + ":" + cameraData[9]+ ":" + cameraData[8] + "PMW value:" + angleValue;



Re: Blackmagic 3G-SDI Shield input

PostPosted: Fri Dec 11, 2020 12:29 am
by Trilec
@daver2 Sounds very promising , please keep us posted on how you get on..

In the SDK the is a file Blackmagic DeckLink SDK 11.7\Examples\VancCapture.cpp

Can the SDK be used on the shield?

The basic setup with the SDK is:

get the card in the system
use first card found
get the interface
get the input
start the input
sample the stream
. get the frame (VideoInputFrameArrived)
. go through the (videoFrameAncillaryPackets)
. get your data

Re: Blackmagic 3G-SDI Shield input

PostPosted: Sat Dec 12, 2020 12:09 am
by Ian Morrish
No :-(

Re: Blackmagic 3G-SDI Shield input

PostPosted: Sat Dec 12, 2020 4:40 pm
by daver2
Unfortunately the SDK is not for the Arduino...

Ian, thanks for the update.

I have been looking a bit more into the Arduino shield code and what you posted and would like to post a few observations.

The .flushRead() doesn't appear to do what I expect it should do... It appears to arm the Output Command register and not the Input Command register?

The .read( data[], dataLength ) method appears to do everything necessary:

1. It returns 0 as a result if no data packet has been received.
2. It returns -1 as a result if the data buffer is not large enough to hold the received data packet. This error should be avoided if the data buffer is 256 bytes long - as this is the maximum size of data packet that can be accommodated by the hardware.
3. It returns a positive number (indicating the number of valid data bytes in the buffer) if a valid message was received by the hardware.
4. It automatically arms the Input Command flag ready to receive any further data.

I see in your code you used the construct "if( (ccuLength == 11) && ...". This should work if the only command present in the received packet is a valid IRIS command. If the ATEM packs more than one command into the frame, this conditional test would fail.

The other thing I would be dubious about would be to put the Serial code within the loop(). According to the Arduino documentation, the serial code should store the characters to be sent into a buffer that are then transmitted under control of interrupts. However, if the transmit buffer fills up, the Serial.printxx() stalls until the blockage has cleared. Assuming a serial bit rate of 9600 bits/second, this would equate to approximately 1 millisecond/character to transmit. I count approximately 23 fixed printable characters in your string (excluding the variable characters and the terminating <CR><LF>) and this would take approximately 25 milliseconds to clear - longer than 1 frame at 50Hz (20 milliseconds).

This depends majorly upon the rate that the ATEM sends the particular commands at when you twiddle a knob or series of knobs of course.

I was going to buy an Arduino and a BMD 3G-SDI shield to have a 'play with' and see what can be accomplished. Unfortunately, the availability of the shields is virtually zero at the moment. Everywhere I have looked in the UK does not have stock. When my favourite distributors opens up tomorrow I will ask them. They are normally pretty good at ringing around to find stock...

I will let you know what I find out...


Re: Blackmagic 3G-SDI Shield input

PostPosted: Sat Dec 12, 2020 8:13 pm
by daver2
First off I am using the online arduino IDE and the instructions within the BMD manual for the shield does not work...

Firstly, the library files need to be zipped up.

Secondly, there is a file required. I have created one of these as follows:

Code: Select all
sentence=Blackmagic Design 3G SDI Control Shield Library.

I installed this file into the same directory containing the keywords.txt file and zipped everything up at that level and lower (including the examples and include directories).

I was then able to use the Arduino library manager to import this library and my test sketch at least now compiles.

My view so far is that the BMD equipment is extremely good, but the documentation and software appears extremely unhelpful and lacking. I am happy to contribute to both...


Re: Blackmagic 3G-SDI Shield input

PostPosted: Sun Dec 13, 2020 7:12 pm
by Ian Morrish
Thanks Dave, the serial code within the loop() was just for debugging and not normally in there.
I was having problems when looking at larger packets of camera data and probably how inefficient my code was which is why I limited it to just dealing with single command which seemed to work fine for when iris was being changed.

The ATEM API lets you specify which camera parameters are refreshed and at what interval. Unfortunately the software control overrides this as soon as it starts.
I have written my own MiDi based CCU controller and using the shield to drive the iris of a b4 lens.

Re: Blackmagic 3G-SDI Shield input

PostPosted: Mon Dec 14, 2020 2:12 pm
by Xtreemtec
The Shield does have limited support for reading commands. BUT!! It's only on low level commands, not Arduino friendly brought to use, and there is a reason for that because it's buggy!!
That is probably why BMD left this option away from the product, it often misses data packets, there is a terrible bug in the Checksum calculation which is pointed out by a colleague but never got fixed in the firmware...

We designed and build our own solution to capture the data of the SDI as the Shield was incapable of doing this the correct way for us.. ;)

Re: Blackmagic 3G-SDI Shield input

PostPosted: Mon Dec 14, 2020 5:28 pm
by Trilec
"We designed and build our own solution to capture the data of the SDI "
@Xtreemtec any thing you care to share?

Ive been considering using the "M.2 DeckLink SDI Micro" in an SBC, or at least the smallest device that can take a 2 lane PCI M .2, just need to figure which SBC would be appropriate, so far the nvidia nano seems interesting.