obs-studio icon indicating copy to clipboard operation
obs-studio copied to clipboard

Blackmagic devices not recognized

Open otacke opened this issue 4 years ago • 15 comments

I am using a Blackmagic Intensity Pro 4K video capture card. It's recognized when I use the PPA version of OBS, but not when using the snap version.

otacke avatar May 09 '20 10:05 otacke

Thanks for the report. Where does it show up on the system? My USB capture card shows up as /dev/video0 (or similar). Does the BM card show up similarly. It's possible we need to extend the camera interface to cover this.

Alternatively it might be there some funky kernel module it talks to?

popey avatar May 09 '20 11:05 popey

@popey The Intensity Pro 4K requires a custom driver, and mounts /dev/blackmagic for their family of devices and /dev/blackmagic/io0 respectively for the card. The PPA version of OBS then perfectly detects it as Blackmagic Device among possible sources.

otacke avatar May 09 '20 11:05 otacke

As I suspected, this looks like a confinement issue. The camera interface might need extending to cover this class of device. I have started a thread on the snapcraft forum. I'll keep this issue open until we have a resolution there.

popey avatar May 09 '20 23:05 popey

Great, thanks a lot! Let me know if there's something that I can help you with.

otacke avatar May 10 '20 04:05 otacke

I followed the discussion on the snapcraft forum, but I refrain a little from creating an account for just one answer. Sorry for misusing you as a relay here.

Creating a symlink from e.g. /dev/video99 to /dev/blackmagic/io0 did not work - or I did something wrong. However, I couldn't find the device as a video capture device (or any other device, also tried media device and even screen capture). Sorry if that's crappy bug reporting, but I am totally new to the world of video on Linux and just guessing it might be about missing V4L2 compliance or something? Hope that's not complete nonsense :-)

If you have to spare a minute, I'd love to learn a little more about the difference between debian archives and snap archives and what would lead to the capture card working flawlessly with the former but not with the latter. Is there a particular resource that you would recommend, or should I just look out for "deb vs snap"?

otacke avatar May 11 '20 13:05 otacke

Ok, relayed your comment. Not a problem.

The reason a deb works and the snap (currently doesn't) is pretty simple. debs are unconfined, that is they have full access to the entire filesystem, and can thus (via the usual group/user permissions) see all the necessary nodes in /dev on Linux. Snaps are confined, using apparmor and cgroups, to prevent applications having access they "shouldn't". So a note taking app can't access the camera, and a browser can't see your ssh keys. The side effect of this is some edge cases such as this require us to do some work on the snapd side to provide access to these features.

popey avatar May 11 '20 15:05 popey

Aah, get it. Thanks a lot!

otacke avatar May 11 '20 17:05 otacke

Creating a symlink from e.g. /dev/video99 to /dev/blackmagic/io0 did not work - or I did something wrong.

You did wrong as the AppArmor confinement doesn't acknowledge symlinks, the feasible solution is to wait for the snapd to support snap access to the Blackmagic hardware.

brlin-tw avatar May 29 '20 12:05 brlin-tw

@Lin-Buo-Ren Thanks! Already read that at https://forum.snapcraft.io/t/support-for-blackmagic-cards-in-camera-interface/17337/5

otacke avatar May 29 '20 13:05 otacke

I’ve submitted this pull request which expands camera/capture device support, including the addition of Blackmagic devices.

https://github.com/snapcore/snapd/pull/9734

flexiondotorg avatar Dec 02 '20 14:12 flexiondotorg

@flexiondotorg :+1:

otacke avatar Dec 02 '20 14:12 otacke

question about the above PR for someone who has this hardware, can you run the following:

udevadm info --query property --name /dev/blackmagic/io*

and paste the output in the linked PR?

anonymouse64 avatar Dec 02 '20 15:12 anonymouse64

@anonymouse64 Done

otacke avatar Dec 02 '20 15:12 otacke

udevadm info --query property --name /dev/blackmagic/io*

I am on a fresh install of Debian 11 release candidate w/ realtime kernel. I have a BlackMagic DeckLink "mini" Recorder. The output of that command is:

e@debian:~$ udevadm info --query property --name /dev/blackmagic/io*
DEVPATH=/devices/pci0000:00/0000:00:01.3/0000:02:00.2/0000:03:04.0/0000:05:00.0/misc/blackmagic!io0
DEVNAME=/dev/blackmagic/io0
DEVMODE=0666
MAJOR=10
MINOR=61
SUBSYSTEM=misc

I've installed the edge version of obs-studio from snap, but unfortunately don't see my blackmagic device in the list of sources.

I should note that I have been able to use blackmagic device on arch linux with obs from arch repos.

ericfont avatar May 27 '21 04:05 ericfont

I've installed the edge version of obs-studio from snap, but unfortunately don't see my blackmagic device in the list of sources.

The patch hasn't merged at upstream yet: https://github.com/snapcore/snapd/pull/9734

brlin-tw avatar May 27 '21 06:05 brlin-tw

For anyone encountering this issue, users have a couple of options for getting a current OBS Studio version that will work with Blackmagic devices:

flexiondotorg avatar Oct 13 '23 12:10 flexiondotorg