johnboiles / obs-mac-virtualcam

ARCHIVED! This plugin is officially a part of OBS as of version 26.1. See note below for info on upgrading. 🎉🎉🎉Creates a virtual webcam device from the output of OBS. Especially useful for streaming smooth, composited video into Zoom, Hangouts, Jitsi etc. Like CatxFish/obs-virtualcam but for macOS.
GNU General Public License v2.0
4.07k stars 161 forks source link

Virtualcam not showing up on Universal browsers on M1 processor #239

Closed MatteAce closed 3 years ago

MatteAce commented 3 years ago

virtualcam is not showing up on Universal apps on Apple M1 processor/Big Sur.

It works fine on Intel packagings running via Rosetta 2 (tested successfully on Chrome-Intel and Firefox) but it won't show up on Universal packagings running natively on the M1 processor.

Tested on a Macbook Pro M1 with MacOS 11.0.1

johnboiles commented 3 years ago

Thanks for the report!

Makes sense to me since plugins are loaded in process and you can't load an x86 plugin in an ARM process.

Anyone happen to know what compiler flags to add to make a universal binary?

On Wed, Nov 25, 2020 at 9:30 AM MatteAce notifications@github.com wrote:

virtualcam is not showing up on Universal apps on Apple M1 processor/Big Sur.

It works fine on Intel packagings running via Rosetta 2 (tested successfully on Chrome-Intel and Firefox) but it won't show up on Universal packagings running natively on the M1 processor.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/johnboiles/obs-mac-virtualcam/issues/239, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABVN7HOETOM4S7GLR6VXB3SRU5JVANCNFSM4UCWEKNA .

MatteAce commented 3 years ago

can this help? https://developer.apple.com/documentation/xcode/building_a_universal_macos_binary

johnboiles commented 3 years ago

Yeah that’s great thanks. So looks like we need to build both architectures and lipo them together. This is what they have in that doc and we’ll have to adapt it to CMake. @PatTheMav do you know if any universal binary work is being done for OBS? I don’t want to blaze a trail here if someone is already working on it.

x86_app: main.c
    $(CC) main.c -o x86_app -target x86_64-apple-macos10.12
arm_app: main.c
    $(CC) main.c -o arm_app -target arm64-apple-macos11
universal_app: x86_app arm_app
    lipo -create -output universal_app x86_app arm_app
johnboiles commented 3 years ago

Actually, we don't need the OBS plugin to be universal, just the DAL plugin. I made the change here but I'm struggling to get the GitHub action to build it: https://github.com/johnboiles/obs-mac-virtualcam/pull/240

PatTheMav commented 3 years ago

Yeah was about to mention the same. We have an Apple Silicon branch that is being worked on, but I haven't really put in the work what would be necessary to update not only the build process but also the packaging process as OBS is made up of so many dynamic libraries/plugins that are each separate build targets.

johnboiles commented 3 years ago

Ok I think I've got it, but I want testers before I cut a release (since I don't have an M1 mac).

To test this, go here, and download the raw-plugins.zip artifact. And then copy raw-plugins/obs-mac-virtualcam.plugin to /Library/CoreMediaIO/Plug-Ins/DAL/. Then see if everything works as expected!

johnboiles commented 3 years ago

Ok we've had two testers in #240 so that's enough for me :) I've now cut a release with Apple Silicon support: https://github.com/johnboiles/obs-mac-virtualcam/releases/tag/v1.3.0

@PatTheMav I'm thinking we can probably override CMAKE_OSX_ARCHITECTURES for the DAL plugin target in the OBS build without modifying anything else in the OBS build. I might give that a try at some point.

johnboiles commented 3 years ago

@PatTheMav I just went ahead and tried it https://github.com/obsproject/obs-studio/pull/3779

wookayin commented 3 years ago

I can confirm the virtual camera DAL plugin works very well on a M1 mac --- even with the current x86 OBS (26.0.2) release running on Rosetta 2! Thanks for the fast update.

johnboiles commented 3 years ago

@wookayin thanks for the report! Just curious what software are you using the virtual camera in and is that software running as a universal app?

wookayin commented 3 years ago

@johnboiles That's a good point to check. I tested with Chrome (87.0) arm64 build, and ffmpeg (ffplay) which is yet a non-universal x86 app, and both worked well without any issues.

johnboiles commented 3 years ago

Awesome! Glad to hear it