[BUG]Virtual camera can't work with EOS Webcam Utility (Mac OSX Mojave)
amirher opened this issue · comments
Every time I installed this plugin, my OBS can't feed video capture from EOS Webcam utility. In order to get back video feed from EOS Webcam, I need to uninstall this plugin.
Hmm can you paste the Info.plists from both plugins? In terminal you can run
cat /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/Info.plist | pbcopy
Then paste the results here. And then run
cat /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcam.plugin/Contents/Info.plist | pbcopy
Then paste here.
Ok. I had to reinstall your virtual-camera plugin and as expected my EOS Webcam utility stops working. Anyway as requested attached is the output file of the commands.
Hopes this could help you to resolve the issue.
Thanks
Huh this is a strange one. I don't see anything fishy in the plist files.
Does EOS Webcam Utility work in any other apps (e.g. QuickTime, Zoom, etc) while this plugin is installed? Or does it just not work in OBS?
Yup. My Zoom works fine and can directly feed from EOS Webcam while OBS doesn't.
I am also trying to use bother EOS adapter and OBS virtual webcab. Wonder whether they re trying to use the same point to insert themselves in the chain. In the system logs, searching for obs-mac-virtualcam I see a lot of:
Nov 23 17:12:15 cascade10-2 caphost[1522]: objc[1522]: Class Device is implemented in both /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcamUtility.plugin/Contents/MacOS/EOSWebcamUtility (0x106b69660) and /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam (0x10701e690). One of the two will be used. Which one is undefined.
Looks like both use the same hack and it clashes ...
In fact there seem to be problems with 4 classes: Stream, Device, Plugin and ObjectStore.
MacOS/obs-mac-virtualcam (0xb8356b8). One of the two will be used. Which one is undefined.
Nov 23 17:12:15 cascade10-2 caphost[1522]: objc[1522]: Class ObjectStore is implemented in both /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcamUtility.plugin/Contents/MacOS/EOSWebcamUtility (0x106b69688) and /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam (0x10701e5c8). One of the two will be used. Which one is undefined.
Nov 23 17:12:15 cascade10-2 caphost[1522]: objc[1522]: Class PlugIn is implemented in both /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcamUtility.plugin/Contents/MacOS/EOSWebcamUtility (0x106b69610) and /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam (0x10701e618). One of the two will be used. Which one is undefined.
Nov 23 17:12:15 cascade10-2 caphost[1522]: objc[1522]: Class Device is implemented in both /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcamUtility.plugin/Contents/MacOS/EOSWebcamUtility (0x106b69660) and /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam (0x10701e690). One of the two will be used. Which one is undefined.
Nov 23 17:12:15 cascade10-2 caphost[1522]: objc[1522]: Class Stream is implemented in both /Library/CoreMediaIO/Plug-Ins/DAL/EOSWebcamUtility.plugin/Contents/MacOS/EOSWebcamUtility (0x106b696d8) and /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam (0x10701e6b8). One of the two will be used. Which one is undefined.
The symptom for me is that after installing this webcam plugin, it doesn't appear in the Tools menu.
I'd guess both (EOSWebCamUtility and obs-mac-virtualcam) used https://github.com/johnboiles/coremediaio-dal-minimal-example as the basis for their code (I know virtualcam did), so they share that part of the code. With ObjC being late-binding, there are now two classes with the same name available and the class lookup will pick one at random.
@PatTheMav so the information in #215 is correct?
I'd say so. ObjectiveC doesn't bind to code sections at compile time, but instead looks up symbols by name at runtime, as everything is translated to variants of objc_msgSend
in C which takes a string-based selector for the target of your message.
So any plugin based on the minimal example without changing their class names will exist in the namespace of an app that loads DAL plugins and as such the selector will be ambiguous.
That also means that that problem also exists in the version that currently is in OBS on the main branch, right?
I think I'll need to send a PR there :D
Yes and I prepared a PR already, testing the build as we speak.
EDIT: Be aware that Quicktime in Big Sur has activated library hardening, so you can't test virtualcam with Quicktime anymore.
oh i see, cool
EDIT: For me it still works... 🤔 But I have SIP disabled, so that might be a problem
Cameo works great as a test suite, especially as it loads all DAL plugins and gives you debug output.
If you'd like to test a fix, there's a build artifact of OBS with this plugin pre-installed, with the namespace fix applied here: obsproject/obs-studio#3758 (Go to Checks > CI Multiplatform Build > macOS 64-bit > Artifacts in the upper right corner > choose the macOS .dmg file)
@timbl @PatTheMav yep that looks like the problem. Interesting find that Canon is using my code! I wonder how many others are too.
@PatTheMav thanks for the fix! I can't wait for that official OBS build with the mac virtualcam built in! @dodgepong @jp9000 do you expect to release OBS w/ macOS virtual cam soon, or should I apply the same fix to this repo as a fix for folks in the meantime?
We expect a release soon, probably a beta/RC within the next week or two.
I also added a note to my sample code to encourage people to change the class names before shipping https://github.com/johnboiles/coremediaio-dal-minimal-example/blob/master/README.md#before-shipping-code
@timbl @amirher can you wait that long? ;)
This plugin will be deprecated/archived as soon as the official OBS release goes out with this code in it.
Does the plugin work on macOS 10.12 or 10.11 and older OBS versions? Because then it would be the only way for people to use virtual webcam output on older Macs that OBS 26+ does not support anymore. Still your choice to just "freeze" the plugin as-is.
I've never really focused on supporting anything below OBS 25.0.8 and macOS below 10.15. So i'm not totally sure. I seem to remember seeing reports of it working on 10.14, but I'd be surprised if it worked on 10.12 without modifications. It definitely wasn't ever a focus of mine.
Ok I went ahead and fixed the namespaces. @amirher @timbl go try the latest v1.3.1 release!