melnijir / Dicaffeine

Repository for things connected to Dicaffeine player/streamer.
https://dicaffeine.com
MIT License
101 stars 3 forks source link

Compatibility with Blackmagic DeckLink SDI Micro M.2 card on Raspberry Pi 5 #67

Open Macrobiotic opened 5 months ago

Macrobiotic commented 5 months ago

I have discovered that the new Raspberry Pi 5 should be compatible with the Blackmagic DeckLink SDI Micro card through the PCIe interface. I am planning to order a couple of these cards to test with, since Blackmagic also provides Linux drivers for aarch64 architecture.

From my understanding, it looks like Dicaffeine could access that DeckLink interface as inputs and outputs for bridging between NDI and SDI as well as connecting a UVC based webcam to an SDI infrastructure with minimal latency.

Would this be something you might be interested in adding to Dicaffeine? (Or maybe it's already possible and I've not realised.)

melnijir commented 5 months ago

Hi! That sounds interesting, thanks for mentioning that! Have you found any examples where it's actually working? I found some Jetson Nano projects but nothing with Raspberry 5 yet.

Anyway about the Decklink support - it's already there for Intel/AMD x86 based computers, it's just not available in the Dicaffeine GUI. You can use it if you compile the Yuri2 binary from the source code and then run it via command line.

If more people would be interested in such a project, I can try to make a special build with the official Decklink card support.

Macrobiotic commented 5 months ago

I have just received two DeckLink cards. I am just waiting for the Pimoroni NVMe adapter cards so that I can connect everything together.

From a physical perspective, the DeckLink cards should work, as long as PCIe 3 is enabled on the Raspberry Pi 5.

I'll need to look into Yuri2 once all the parts have arrived.

Initially I'm intending to test that the cards can be accessed and will transmit and receive video reliably. As long as the hardware is capable, the rest should also be possible.

Macrobiotic commented 4 months ago

I've received all the parts:

The DeckLink SDI Micro is recognised by the Blackmagic Desktop Video Setup software (version 12.8) I've set the Pi 5 to use PCIe gen3 mode in order to make full use of the DeckLink.

At the moment, the Blackmagic software is the only to detect the DeckLink, so I'm about to start testing Yuri2.

The setup I have made is as follows: SDI source --> DeckLink --> SDI capable display The SDI source is set to output 1080p60, and this has been recognised by the display when I connected it directly, and shows up as an active source at 1080p60 in the Blackmagic Desktop Video Setup software.

This indicates that the hardware is all working correctly. (When the display is connecting to the output from the DeckLink it only shows a black video frame, as configured in the Blackmagic software.)

Macrobiotic commented 4 months ago

I had installed the version of Yuri2 offered on the Raspberry Pi download page for Dicaffeine. I got as far as asking it to enumerate inputs, but it found no devices.

As I'm not familiar with Yuri2 or its syntax, any help you could offer on where I may have gone wrong would be appreciated.

Macrobiotic commented 4 months ago

I've tried it out using Ubuntu 23.10 but that doesn't enable NVMe/PCIe by default it seems. (The DeckLink doesn't appear like it does in Raspberry Pi OS.)

Macrobiotic commented 4 months ago

And another follow-up. It looks like Ubuntu for ARM 23.10 does recognise NVMe cards, just not the Blackmagic DeckLink. I tested with an NVMe SATA interface card, and it was recognised with no problems. It's possible the Blackmagic drivers are being blocked by Ubuntu for some reason.

The reason I was testing Ubuntu, is because OBS is available from the Ubuntu repository. Unfortunately there seems to be a compatibility issue. (OBS complains about the video drivers or GPU not being compatible.)

I was hoping that OBS could detect the DeckLink, since Blackmagic devices can be directly detected by OBS.

melnijir commented 4 months ago

Hi! From the previous posts I assume that the BM Decklink is working - the cmd tools like: BlackmagicFirmwareUpdater status are showing the correct output? Can you see the device: 0: /dev/blackmagic/... ?

If yes, you'll need to download not only the BM Decklink drivers, but also the SDK with all the include files. These files need to be copied to: /usr/local/include After that you'll need to compile the Yuri2, please follow the guide posted here: https://dicaffeine.com/guide_yuri2_compilation

If everything went fine, you'll see the Decklink input/output module, for example:

yuri2 -L decklink_input
Class decklink_input:
  Outputs input video to BlackMagic Design device (Eclipse, Intensity, ...)
    audio:  False
      Enable audio
    audio_channels:  2
...

so now you can use the command:

yuri2 -I decklink_input
Found 1 device
  Device DeckLink Duo (1) with 87 configurations
    device: 0
      connection: SDI
...

and use the _decklinkinput module as an input for example _sdlwindow or _glxwindow.

Let me know how it's going!

Macrobiotic commented 4 months ago

Many thanks for the instructions. I'll try to find time to try them out and report back.

Macrobiotic commented 4 months ago

OK, I've tried building it from scratch as per the instructions, but there appears to be something that keeps it from working.

I've attached the output that appears when I try the commands: yuri2 -L decklink_input Error message 1.txt

yuri2 -I decklink_input Error message 2.txt

It appears that it's expecting some files, but it can't open them. I checked the location it gave the error for and both of the files appear to exist.

I also tested the commands: yuri2 /tmp/yuri_config_player.xml yuri2 /tmp/yuri_config_streamer.xml

These get a similar error, stating it can't open the file.