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

DAL plugins don't work in apps with hardened runtime (e.g. in Zoom, Teams, Skype, Safari, Quicktime, Photo Booth etc) #4

Open ChrisWeiss opened 4 years ago

ChrisWeiss commented 4 years ago

I ran through the compile and everything seems to be fine, am able to run OBS from the terminal, but I'm not seeing any new video sources in Photo Both or Google Hangouts. The console output when launching indicates that it is loading the module (though there is some warning) Is there some other step I need to complete?


info: CPU Name: Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
info: CPU Speed: 3100MHz
info: Physical Cores: 4, Logical Cores: 8
info: Physical Memory: 16384MB Total
info: OS Name: Mac OS X (NSMACHOperatingSystem)
info: OS Version: Version 10.14.6 (Build 18G3020)
info: Kernel Version: 18.7.0
info: hotkeys-cocoa: Using layout 'com.apple.keylayout.US'
info: Portable mode: false
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_clicked()
QMetaObject::connectSlotsByName: No matching signal for on_advAudioProps_destroyed()
QMetaObject::connectSlotsByName: No matching signal for on_actionGridMode_triggered()
QMetaObject::connectSlotsByName: No matching signal for on_program_customContextMenuRequested(QPoint)
info: OBS 25.0.3-10-g094edda8 (mac)
info: ---------------------------------
info: ---------------------------------
info: audio settings reset:
    samples per sec: 44100
    speakers:        2
info: ---------------------------------
info: Initializing OpenGL...
info: Loading up OpenGL on adapter ATI Technologies Inc. AMD Radeon Pro 560 OpenGL Engine
info: OpenGL loaded successfully, version 4.1 ATI-2.11.21, shading language 4.10
info: ---------------------------------
info: video settings reset:
    base resolution:   1680x1050
    output resolution: 1120x700
    downscale filter:  Bicubic
    fps:               30/1
    format:            NV12
    YUV mode:          601/Partial
info: NV12 texture support not available
info: Audio monitoring device:
    name: Default
    id: default
info: ---------------------------------
warning: Failed to load 'en-US' text for module: 'decklink-ouput-ui.so'
error: os_dlopen(libpython3.7m.dylib->libpython3.7m.dylib): dlopen(libpython3.7m.dylib, 257): image not found

warning: [Python] Could not load library: libpython3.7m.dylib
2020-04-02 16:38:30.976 obs[31358:10316186] alloc
2020-04-02 16:38:30.976 obs[31358:10316186] query 2
2020-04-02 16:38:30.976 obs[31358:10316186] release 2
2020-04-02 16:38:30.976 obs[31358:10316186] ** MyPlugInitializeWithObjectID
2020-04-02 16:38:30.976 obs[31358:10316186] init
2020-04-02 16:38:30.976 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:30.976 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:30.976 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.050 obs[31358:10316186] Trying to get Surface
2020-04-02 16:38:31.051 obs[31358:10316186] Found Surface
2020-04-02 16:38:31.051 obs[31358:10316186] Surface is the wrong size: 320 240 vs 640.000000 480.000000
2020-04-02 16:38:31.051 obs[31358:10316186] Surface is 0x0
2020-04-02 16:38:31.052 obs[31358:10316186] Driver name is 8 CamTwist
2020-04-02 16:38:31.052 obs[31358:10316186] <CMVideoFormatDescription 0x7fdda2786280 [0x7fff9a70b8e0]> {
    mediaType:'vide'
    mediaSubType:'BGRA'
    mediaSpecific: {
        codecType: 'BGRA'       dimensions: 640 x 480
    }
    extensions: {<CFBasicHash 0x7fdda2783f70 [0x7fff9a70b8e0]>{type = immutable dict, count = 4,
entries =>
    1 : <CFString 0x7fff9aade618 [0x7fff9a70b8e0]>{contents = "CVFieldCount"} = <CFNumber 0x311cba1434bdec05 [0x7fff9a70b8e0]>{value = +1, type = kCFNumberSInt64Type}
    2 : <CFString 0xa62e8a0 [0x7fff9a70b8e0]>{contents = "CVBytesPerRow"} = <CFNumber 0x311cba1434b7ed05 [0x7fff9a70b8e0]>{value = +2560, type = kCFNumberSInt64Type}
    4 : <CFString 0x7fff9a984f90 [0x7fff9a70b8e0]>{contents = "com.apple.cmio.format_extension.video.only_has_i_frames"} = <CFBoolean 0x7fff9a70bc30 [0x7fff9a70b8e0]>{value = true}
    5 : <CFString 0x7fff9a970d18 [0x7fff9a70b8e0]>{contents = "FormatName"} = <CFString 0xa62e8c0 [0x7fff9a70b8e0]>{contents = "Component Video - CCIR-601 RGB"}
}
}
}
2020-04-02 16:38:31.052 obs[31358:10316186] Name CamTwist
2020-04-02 16:38:31.078 obs[31358:10316186] alloc
2020-04-02 16:38:31.078 obs[31358:10316186] query 2
2020-04-02 16:38:31.078 obs[31358:10316186] release 2
2020-04-02 16:38:31.078 obs[31358:10316186] ** MyPlugInitializeWithObjectID
2020-04-02 16:38:31.078 obs[31358:10316186] init
2020-04-02 16:38:31.078 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.078 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.078 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.078 obs[31358:10316186] <CMVideoFormatDescription 0x7fdda789aa30 [0x7fff9a70b8e0]> {
    mediaType:'vide'
    mediaSubType:'2vuy'
    mediaSpecific: {
        codecType: '2vuy'       dimensions: 640 x 480
    }
    extensions: {<CFBasicHash 0x7fdda789c840 [0x7fff9a70b8e0]>{type = immutable dict, count = 6,
entries =>
    0 : <CFString 0x7fff9aade798 [0x7fff9a70b8e0]>{contents = "CVImageBufferYCbCrMatrix"} = <CFString 0x7fff9aade7d8 [0x7fff9a70b8e0]>{contents = "ITU_R_601_4"}
    1 : <CFString 0x7fff9aade618 [0x7fff9a70b8e0]>{contents = "CVFieldCount"} = <CFNumber 0x311cba1434bdec05 [0x7fff9a70b8e0]>{value = +1, type = kCFNumberSInt64Type}
    2 : <CFString 0x7fff9aade8f8 [0x7fff9a70b8e0]>{contents = "CVImageBufferTransferFunction"} = <CFString 0x7fff9aade7b8 [0x7fff9a70b8e0]>{contents = "ITU_R_709_2"}
    4 : <CFString 0x7fff9a984f90 [0x7fff9a70b8e0]>{contents = "com.apple.cmio.format_extension.video.only_has_i_frames"} = <CFBoolean 0x7fff9a70bc30 [0x7fff9a70b8e0]>{value = true}
    5 : <CFString 0x7fff9aade878 [0x7fff9a70b8e0]>{contents = "CVImageBufferColorPrimaries"} = <CFString 0x7fff9aade8b8 [0x7fff9a70b8e0]>{contents = "SMPTE_C"}
    6 : <CFString 0x7fff9a970d18 [0x7fff9a70b8e0]>{contents = "FormatName"} = <CFString 0xa62e920 [0x7fff9a70b8e0]>{contents = "Component Video - CCIR-601 uyvy"}
}
}
}
2020-04-02 16:38:31.142 obs[31358:10316186] Name CamTwist (2VUY)
warning: A DeckLink iterator could not be created.  The DeckLink drivers may not be installed
info: No blackmagic support
info: [VideoToolbox encoder]: Adding VideoToolbox H264 encoders
warning: Failed to load 'en-US' text for module: 'obs-mac-virtualcam.so'
warning: Ignoring old obs-browser.so version
info: ---------------------------------
info:   Loaded Modules:
info:     text-freetype2.so
info:     rtmp-services.so
info:     obs-x264.so
info:     obs-vst.so
info:     obs-transitions.so
info:     obs-outputs.so
info:     obs-mac-virtualcam.so
info:     obs-filters.so
info:     obs-ffmpeg.so
info:     mac-vth264.so
info:     mac-syphon.so
info:     mac-decklink.so
info:     mac-capture.so
info:     mac-avcapture.so
info:     image-source.so
info:     frontend-tools.so
info:     decklink-ouput-ui.so
info:     coreaudio-encoder.so
info: ---------------------------------
info: ==== Startup complete ===============================================
error: Service '' not found
info: All scene data cleared
info: ------------------------------------------------
info: coreaudio: device 'Built-in Microphone' initialized
info: [Media Source 'Media Source']: settings:
    input:                   /Users/cweiss/Downloads/Binary_numbers_alpha_overlay_01_Videvo.mov
    input_format:            (null)
    speed:                   100
    is_looping:              yes
    is_hw_decoding:          no
    is_clear_on_media_end:   yes
    restart_on_activate:     yes
    close_when_inactive:     no
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.471 obs[31358:10316186] enog
2020-04-02 16:38:31.471 obs[31358:10316186] bolg
2020-04-02 16:38:31.471 obs[31358:10316186] 0
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.471 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.471 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.471 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] grrf
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] grrf
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] trfn
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] trfm
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] trfn
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] DN: CamTwist
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] dulp
2020-04-02 16:38:31.472 obs[31358:10316186] tpni
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.472 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.472 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.472 obs[31358:10316186] elt 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.472 obs[31358:10316186] enog
2020-04-02 16:38:31.472 obs[31358:10316186] bolg
2020-04-02 16:38:31.472 obs[31358:10316186] 0
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.472 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectSetPropertyData
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] grrf
2020-04-02 16:38:31.473 obs[31358:10316186] bolg
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] grrf
2020-04-02 16:38:31.473 obs[31358:10316186] bolg
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] trfn
2020-04-02 16:38:31.473 obs[31358:10316186] bolg
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] trfm
2020-04-02 16:38:31.473 obs[31358:10316186] bolg
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] trfn
2020-04-02 16:38:31.473 obs[31358:10316186] bolg
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] DN: CamTwist (2VUY)
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectHasProperty
2020-04-02 16:38:31.473 obs[31358:10316186] dulp
2020-04-02 16:38:31.473 obs[31358:10316186] tpni
2020-04-02 16:38:31.473 obs[31358:10316186] 0
2020-04-02 16:38:31.473 obs[31358:10316186] MyPlugObjectGetPropertyDataSize
2020-04-02 16:38:31.473 obs[31358:10316186] sel dnwo
2020-04-02 16:38:31.473 obs[31358:10316186] scope bolg
2020-04-02 16:38:31.473 obs[31358:10316186] elt 0
info: EyeSight: Selected device 'FaceTime HD Camera'
info: EyeSight: Using preset 1280x720
info: Switched to scene 'Scene'
info: ------------------------------------------------
info: Loaded scenes:
info: - scene 'Scene':
info:     - source: 'Syphon Client' (syphon-input)
info:     - source: 'Media Source' (ffmpeg_source)
info:     - source: 'EyeSight' (av_capture_input)
info:         - filter: 'Crop/Pad' (crop_filter)
info:         - filter: 'Chroma Key' (chroma_key_filter)
info: ------------------------------------------------
info: adding 23 milliseconds of audio buffering, total audio buffering is now 23 milliseconds (source: Mic/Aux)

info: User Removed source 'Syphon Client' (syphon-input) from scene 'Scene'
info: EyeSight: Selected preset AVCaptureSessionPreset1280x720
johnboiles commented 4 years ago

Yeah I've been running into sporadic code signing issues. Every now and then macOS will block the plugin from loading. I haven't been able to pin down why it only happens sometimes. Do you see anything in Console.app if you search for virtualcam?

rberenguel commented 4 years ago

It shouldn’t be needed, but after a restart I got it (Google Meet on Chrome, but only shows sometimes on Photo Booth: this also happens with other virtual camera devices)

johnboiles commented 4 years ago

Did you try a Google Meet meeting and the person on the other end was able to see you? I've been having trouble with this (see #2) -- I can see my own preview fine but the person on the other end reports my video as frozen.

rberenguel commented 4 years ago

Yes I’ve seen your other issue. No, it was late and I just was confirming it seemed to work, this was only in the preview. The frame syncing you added didn’t fix the issue?

ChrisWeiss commented 4 years ago

Sure enough, I get the following in Console (even after a reboot): default 10:00:02.619975 -0700 Photo Booth Error loading /Library/

CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam:  dlopen(/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam, 0x0106): code signature in (/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam) not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
default 10:00:02.620077 -0700   Photo Booth Cannot find function pointer AppleCMIODPSampleVCamPlugIn for factory <CFUUID 0x6000017270c0> 35FDFF29-BFCF-4644-AB77-B759DE932ABE in CFBundle/CFPlugIn 0x7f82913134f0 </Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin> (bundle, not loaded)

FWIW - This is a corporate laptop and it's pretty locked down. (I dont think I could get away with disabling SIP to get some of the other solutions to work).

johnboiles commented 4 years ago

I've gotten this sometimes as well and it's baffling to me. One thing I'm trying is changing my codesigning identity to my personal developer account

diff --git a/src/dal-plugin/CMakeLists.txt b/src/dal-plugin/CMakeLists.txt
index c354f13c..a358bfc1 100644
--- a/src/dal-plugin/CMakeLists.txt
+++ b/src/dal-plugin/CMakeLists.txt
@@ -155,6 +155,6 @@ add_custom_command(TARGET dal-plugin

 add_custom_command(TARGET dal-plugin
        POST_BUILD
-       COMMAND /usr/bin/codesign --force --deep --sign - --timestamp=none ${TARGET_DIR}/obs-mac-virtualcam.plugin
+       COMMAND /usr/bin/codesign --force --deep --sign [my 40 char codesign identity] --timestamp=none ${TARGET_DIR}/obs-mac-virtualcam.plugin
        COMMENT "Codesign plugin"
 )

Then that assigns a Team ID during codesigning. But it doesn't explain why it sometimes works without a team id.

@ChrisWeiss does your locked down corporate laptop have Carbon Black on it? Mine does and I always give that thing a suspicious look when spooky system things like this happen.

gxalpha commented 4 years ago

On this issue: I was only able to get video in quicktime. While in other apps like photo booth and discord i can select the virtualcam, it won't give output. For discord the preview shows a black screen, and the actual video shows that it is loading all the time; and for photo booth when i select the virtualcam, the picture of the facetime camera i had before just freezes. I know we're probably not at this point yet, but I just wanted to inform you about the issue. Also rebooting didn't help.

johnboiles commented 4 years ago

Thanks for the additional info @gxalpha! Every bit is helpful to try to understand what is happening!

spenserpothier commented 4 years ago

I am experiencing this issue as well. I was able to get this plugin working on my employer laptop (which I believe is Mojave) but not on my personal computer which is on Catalina. I am able to see the virtual camera in Hangouts and Quicktime, but not Zoom or Photobooth. I tried to get a list of available input devices and got the following which makes me think that this is onto something:

$ system_profiler SPCameraDataType

2020-04-04 17:21:25.454 system_profiler[884:23513] Error loading /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam:  dlopen(/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam, 0x0106): code signature in (/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam) not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
Camera:

    FaceTime HD Camera (Built-in):

      Model ID: UVC Camera VendorID_1452 ProductID_34304
      Unique ID: 0x[redacted]8600

    HD Pro Webcam C920:

      Model ID: UVC Camera VendorID_1133 ProductID_2093
      Unique ID: 0x[redacted]082d

Hope this helps narrow it down, when this is working it's great!

cgudea commented 4 years ago

I have intermittent functionality after reboots, recompiles, etc

right now Im getting

$ system_profiler SPCameraDataType
2020-04-04 19:55:21.258 system_profiler[8078:40898] Error loading /Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam:  dlopen(/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam, 0x0106): code signature in (/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam) not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
2020-04-04 19:55:21.258 system_profiler[8078:40898] Cannot find function pointer AppleCMIODPSampleVCamPlugIn for factory 35FDFF29-BFCF-4644-AB77-B759DE932ABE in CFBundle/CFPlugIn 0x7fa31722cbc0 </Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin> (bundle, not loaded)
Camera:

    FaceTime HD Camera:

      Model ID: Apple Camera VendorID_0x106B ProductID_0x1570
      Unique ID: …
ChrisWeiss commented 4 years ago

No Carbon Black, we do have other security tools installed that I can't disclose :) I'll try doing the build on my personal Mac.

Any other information I can provide to help?

johnboiles commented 4 years ago

The inconsistency is super frustrating to me -- sometimes macOS allows it to run and sometimes it doesn't. I haven't been able to find a pattern.

I think this will be solved once we make a distribution package of this with a real production code signature. If anyone wants to help get a release infrastructure up and running here that'd be great!

For now, my hack above seems to be working ok when I get into this state where it won't run. To make/retrieve your codesigning identity 1) Make sure you're logged into Xcode with your Apple ID (Xcode->Preferences->Accounts) 1) security find-identity -v -p codesigning to see the available codesigning identities and the associated 40 character hex identifier. 1) Change the CMakeLists.txt file for dal-plugin to use codesign --sign [your 40 char id] instead of codesign --sign -

diff --git a/src/dal-plugin/CMakeLists.txt b/src/dal-plugin/CMakeLists.txt
index c354f13c..a358bfc1 100644
--- a/src/dal-plugin/CMakeLists.txt
+++ b/src/dal-plugin/CMakeLists.txt
@@ -155,6 +155,6 @@ add_custom_command(TARGET dal-plugin

 add_custom_command(TARGET dal-plugin
        POST_BUILD
-       COMMAND /usr/bin/codesign --force --deep --sign - --timestamp=none ${TARGET_DIR}/obs-mac-virtualcam.plugin
+       COMMAND /usr/bin/codesign --force --deep --sign [my 40 char codesign identity] --timestamp=none ${TARGET_DIR}/obs-mac-virtualcam.plugin
        COMMENT "Codesign plugin"
 )
anoldguy commented 4 years ago

Another data point here.

code signature in (/Library/CoreMediaIO/Plug-Ins/DAL/obs-mac-virtualcam.plugin/Contents/MacOS/obs-mac-virtualcam) not valid for use in process: mapping process is a platform binary, but mapped file is not

Rebooting and/or re-signing does not change this. No action/response needed, I'll keep following this issue on my own. Thanks for digging into this feature so quickly!

johnboiles commented 4 years ago

@anoldguy Thanks for the data point! What software are you using to try to view the webcam stream? I think one part of this is that some software seems more sensitive than others

anoldguy commented 4 years ago

Anything. PhotoBooth, Hangouts, Meet, Zoom, Whereby, Quicktime.

spenserpothier commented 4 years ago

Just one more piece of info, as of the latest update to zoom it is not working in either Mojave or Catalina.

Still showing up in quicktime and hangouts for me though.

hkatzdev commented 4 years ago

Could it be unable to run even if signed due to Library Validation? https://developer.apple.com/documentation/security/hardened_runtime https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_security_cs_disable-library-validation

Judging from https://nvd.nist.gov/vuln/detail/CVE-2020-11470, it appears that Zoom removed the entitlement in version 4.6.8, which could explain why it works for some people but not others.

I might try installing https://github.com/mologie/macos-disable-library-validation tomorrow in order to see if this is truly the issue.

Since installing the above requires disabling SIP, I just downgraded Zoom.us to 4.6.8. If any of you also want to do so for testing purposes, you can run brew cask install hkatzdev/cask-zoomus-vc/zoomus if you use Homebrew or just download it from https://zoom.us/client/4.6.19178.0323/Zoom.pkg. After downgrading, I was able to use the OBS Virtual Camera. Additionally, another app called CamTwist, which similarly stopped working in later versions of Zoom.us, started working again in the older version.

Therefore, I'm pretty sure it was to do with Library Validation. Unfortunately, I can't think of a good solution that doesn't involve disabling SIP unless Zoom signs the plugin, which would only fix it for Zoom.

hkatzdev commented 4 years ago

For Zoom at least, it is possible to get this to work by resigning it with the Disable Library Validation Entitlement. I signed the latest zoom with sudo codesign --entitlements entitlements.xml -f -s - /Applications/zoom.us.app and have not noticed any issues yet. Perhaps there could be a script that automates this for apps of your choosing?

Edit: Adding the Disable Library Validation Entitlement doesn't appear to be necessary, although if I had to guess that has to do with it not being signed with a certificate (although if zoom.us and the plugin were signed with the same certificate I believe it still wouldn't be necessary). This is definitely not optimal for security reasons but it works.

johnboiles commented 4 years ago

@hkatzdev Thank you for all the info about library validation and the workarounds! The Snap Camera docs also talk about how Zoom 4.6.9+ are not supported.

So here are the codesigning issues we know about:

johnboiles commented 4 years ago

@anoldguy can you double check that when using your own signing identity, and trying to open the source in QuickTime and Chrome you get the same not valid for use in process: mapping process is a platform binary, but mapped file is not message?

I want to make sure you didn't copy/paste that log from a system application (like Facetime) and got a different error from other applications (QuickTime, Chrome) that are working for some of us on Catalina.

anoldguy commented 4 years ago

Clean built the project. Current state:

Quicktime: Works Browser based: Safari, no camera. Firefox, camera, but no video. OS (Facetime/Photobooth): No camera.

johnboiles commented 4 years ago

@anoldguy and do you get that same platform binary error message when using QuickTime/Firefox? Or only for Safari/Facetime/Photobooth?

yasushisakai commented 4 years ago

Thank you all for the effort!! This helps a lot.

I confirm @hkatzdev's comment works for the latest zoom! For documentation sake, I wasn't familiar with PropertyLists, but I made it work having the below content for entitlements.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
</dict>
</plist>
jmb commented 4 years ago

Thanks @yasushisakai and @hkatzdev this works fine for me and Zoom 4.6.10 (20041.0408)

Jacob-Dyer commented 4 years ago

Yeah thanks @hkatzdev and @yasushisakai, your solution fixed it for me too, Zoom 4.6.10 on Catalina 10.15.3. I can access my Blackmagic capture device again from within Zoom. Cheers!

jimmydigital commented 4 years ago

This also allowed AWS Chime to see the virtual camera... I have an open ticket with that team about that problem. Thanks!

On Sat, Apr 11, 2020, at 8:50 AM, Jacob Dyer wrote:

Yeah thanks @hkatzdev https://github.com/hkatzdev and @yasushisakai https://github.com/yasushisakai, your solution fixed it for me too, Zoom 4.6.10 on Catalina 10.15.3. I can access my Blackmagic capture device again from within Zoom. Cheers!

— 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/4#issuecomment-612414059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AATMTBANGQTMJELEVUCYPKLRMBRPVANCNFSM4L3C5TLA.

hkatzdev commented 4 years ago

Unfortunately, I made a mistake with the code I posted earlier. While resigning the code as I mentioned above works, it also completely removes the hardened runtime, which is not great for security. Instead, here is some very poorly written code that should do the following.

1) Get the entitlements as xml 2) Parse it using xml2 3) Add the Disable Library Validation Entitlement to the list 4) Turn it back into an xml file with 2xml and save it as an xml file 5) Using the preserve-metadata option, attempt to change the least amount of things when resigning (including keeping hardened mode on if it was enabled before) while adding the new entitlement.

I tested the below command on Zoom.us, and now I have obs-mac-virtualcam working with Zoom.us's hardened mode enabled.

APPLICATION=/Applications/zoom.us.app && codesign -d --entitlements :- $APPLICATION | { xml2; echo "/plist/dict/key=com.apple.security.cs.disable-library-validation"; echo "/plist/dict/true"; } | 2xml > entitlements.xml && sudo codesign --sign - $APPLICATION --force --preserve-metadata=identifier,resource-rules,flags --entitlements=entitlements.xml && rm entitlements.xml

jmb commented 4 years ago

Thanks again, I have reinstalled zoom and this works perfectly (I just had to use homebrew to install xml2).

brinsche commented 4 years ago

Am I correct in assuming manually resigning third party apps will likely cause issues with their update mechanism?

hkatzdev commented 4 years ago

Am I correct in assuming manually resigning third party apps will likely cause issues with their update mechanism?

It appears that for zoom.us (4.6.8-->4.6.10 at least) the app is replaced on an update, which just means that we would have to resign it again. Everything else seems to work. However, it would be a good idea to test with other apps to see if this does lead to a problem.

Also this is definitely not the optimal solution, since it reintroduces CVE-2020-11470. Unfortunately, I don't know of a better, more secure way.

brinsche commented 4 years ago

It may be possible to create a virtual webcam by using the new DriverKit, but that would be macOS 10.15+ and it seems like you need to apply to get a special entitlement to use it. According to this you should be able to turn off System Integrity Protection to test it locally but I haven't tried that and Xcode won't even compile a project with a DriverKit component otherwise.

Also I'm a little surprised the zoom update works, I guess it only checks the signature of the update and not whether old and new version match?

johnboiles commented 4 years ago

DriverKit seems super promising. If anyone can find any DriverKit sample code that implements a camera that would be hugely helpful. I wonder if Apple is going to remove DAL plugins all together at some point

brinsche commented 4 years ago

There seems to be very little DriverKit code yet, I could only find the code from the USB sample from the WWDC session video https://github.com/knightsc/USBApp

Here are the general debugging docs https://developer.apple.com/documentation/driverkit/debugging_and_testing_system_extensions and this https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_hid_virtual_device?language=objc could be an indicator that it's at least not impossible to create a virtual camera

I think it's not unlikely for apple to remove DAL plugins at some point in the future

brinsche commented 4 years ago

I think this https://en.wikipedia.org/wiki/USB_video_device_class would be the correct USB device class to virtualise, the spec is here: https://www.usb.org/document-library/video-class-v15-document-set a correct UVC implementation could then be picked up by the native macos uvc driver which would probably be the ideal and future proof implementation

the main hurdle, beside the probably sizeable effort, might be communicating between the driverkit driver implementation and another app/obs I don't know if the drivers might be sandboxed in a way that might make this difficult, so testing this first is probably a good idea, but I'm way out of my depth here, I hope this helps someone!

julianrendell commented 4 years ago

Seems that CoreMedia DAL is the common means for making virtual cameras work right now; I tried looking at the webcamoid source and it looks to be using the same process. (I know nothing about this- literally acting as a human text filter ;-) )

And looking at /Library/CoreMediaIO/Plug-Ins/DAL/ on my system (Catalina), I see plugins for CamTwistStudio and Webcamoid (AkVirtualCamera.plugin).

I agree, long term, given that we should expect more apps to be hardened, an alternative is needed, but my 2c is abstract the interfaces, and make it work with DAL for now, especially as there are so few DriverKit examples right now, and none re non-HID virtual devices.

I did find this article that was useful as an introduction to DriverKit for the complete noob like me: https://www.apriorit.com/dev-blog/669-mac-system-extensions.

johnboiles commented 4 years ago

Agreed. Let's make what we have work first then later we can get DriverKit working.

blackmad commented 4 years ago

Unfortunately, I made a mistake with the code I posted earlier. While resigning the code as I mentioned above works, it also completely removes the hardened runtime, which is not great for security. Instead, here is some very poorly written code that should do the following.

  1. Get the entitlements as xml
  2. Parse it using xml2
  3. Add the Disable Library Validation Entitlement to the list
  4. Turn it back into an xml file with 2xml and save it as an xml file
  5. Using the preserve-metadata option, attempt to change the least amount of things when resigning (including keeping hardened mode on if it was enabled before) while adding the new entitlement.

I tested the below command on Zoom.us, and now I have obs-mac-virtualcam working with Zoom.us's hardened mode enabled.

APPLICATION=/Applications/zoom.us.app && codesign -d --entitlements :- $APPLICATION | { xml2; echo "/plist/dict/key=com.apple.security.cs.disable-library-validation"; echo "/plist/dict/true"; } | 2xml > entitlements.xml && sudo codesign --sign - $APPLICATION --force --preserve-metadata=identifier,resource-rules,flags --entitlements=entitlements.xml && rm entitlements.xml

This just made my zoom crash on startup. Removing codesigning entirely worked well

from https://www.reddit.com/r/VIDEOENGINEERING/comments/fy7xi3/fyi_zoom_v4610_breaks_blackmagic_capture_devices/?utm_source=share&utm_medium=web2x

codesign --remove-signature /Applications/zoom.us.app/

hkatzdev commented 4 years ago

The problem with removing the signature is that it also completely removes the hardened runtime instead of only partly disabling it, which is probably worse for security. Could you please send me a log of Zoom crashing @blackmad? Would like to figure out why - not the first time I've heard that it crashes zoom but an uninstall and reinstall usually works. Also I forgot to mention that you have to install xml2 in homebrew first and only run this command once on an unmodified zoom.

seanchas116 commented 4 years ago

Seems like Chromium does a workaround (running a child process with com.apple.security.cs.disable-library-validation=true for video capture) to enable virtual cameras while hardend runtime is on. I hope Zoom does the same too.

ruudboon commented 4 years ago

Just starting to learn Objective C so I can't help with this issue directly but I got an e-mail from Apple that it's offering some individual consultations to developers. Maybe we could pitch this issue there?

Btw. The xml2 works great for me on Catalina

jburbs commented 4 years ago

I'm at the same stage as @anoldguy, with "system_profiler SPCameraDataType" giving me the "mapping process is a platform binary, but mapped file is not" and zero functionality from the plug-in across any app. I'm using macOS 10.15.4, so I've been lurking here waiting for someone to come up with a workaround that doesn't disable security.

From a little sleuthing about @johnboiles request for DriverKit examples of camera drivers, I came across the youtube: https://youtu.be/rD4Ng4okVis which describes some of the major changes that recent OS updates have made to (hardware) device drivers. It looks like, as of Feb 2, any device driver needs to be "notarized" by Apple before it will work--this makes sense since it is a very solid way to make sure no "unauthorized" code is run on an unsuspecting machine. But it also prevents code generated locally from being run on the "platform".

Thus, it seems that this project is stuck in a bit of limbo, it sounds like compiling the driver code locally and even signing it locally will fail in the latest OS Version, so it needs to be distributed in compiled form with a valid and notarized signature??? Maybe going through the process of notarization would work for all?

At this point, I'm well beyond my (extremely dated) programming skills, and don't feel that I can contribute more than this. If it's helpful, use it. If it's not, ignore it. Meanwhile, back to lurking....

kenlowrie commented 4 years ago

From a little sleuthing about @johnboiles request for DriverKit examples of camera drivers, I came across the youtube: https://youtu.be/rD4Ng4okVis which describes some of the major changes that recent OS updates have made to (hardware) device drivers. It looks like, as of Feb 2, any device driver needs to be "notarized" by Apple before it will work--this makes sense since it is a very solid way to make sure no "unauthorized" code is run on an unsuspecting machine. But it also prevents code generated locally from being run on the "platform".

Thus, it seems that this project is stuck in a bit of limbo, it sounds like compiling the driver code locally and even signing it locally will fail in the latest OS Version, so it needs to be distributed in compiled form with a valid and notarized signature??? Maybe going through the process of notarization would work for all?

So far, I have been unable to get the plug-in to work with anything other than Skype & Quicktime. Zoom (I'm on 5.0.1, so it obviously won't work with that), but Photobooth, Hangouts, Discord do not see it, no matter what.

I went ahead and signed it with my Developer ID and notarized it via Apple, and spctl verifies the signing and notarization:

obs-mac-virtualcam.plugin: accepted source=Notarized Developer ID origin=Developer ID Application: Kenneth Lowrie (XXXXXXXXXX)

But unfortunately, it still only works with Quicktime and Skype.

So I'm not so sure that the notarization step is going to make any difference... Hopefully someone will figure out a solution soon. :)

gxalpha commented 4 years ago

This will be fixed once the new DAL-plugin is implemented.

Which browser are you using to access Hangouts? Chrome should work.

kenlowrie commented 4 years ago

This will be fixed once the new DAL-plugin is implemented.

Which browser are you using to access Hangouts? Chrome should work.

I'm using Chrome. Version 81.0.4044.129 (Official Build) (64-bit)

Any ETA on the new DAL-plugin release? Do you need any alpha/beta testers? Let me know, I'd be happy to take a look at it as soon as it's ready.

jburbs commented 4 years ago

@kenlowrie I found the approach described earlier (contributed by @hkatzdev) to work for me:

If you are running an app and do NOT see the virtual camera appear, first check the known bugs. If you believe that it is not a bug, then the app probably has a hardened runtime without the library entitlement. By running remove-library-validation ${APPLICATION}, you can manually add the library entitlement. For example, with Zoom.us you would run remove-library-validation /Applications/Zoom.us.app. Don't worry - it will first back up your app in case something goes wrong. Keep in mind that this can introduce certain (minor in my opinion) security vulnerabilities in apps (see CVE-2020-11470)

For me, the remove-library-validation works with Zoom and GoToMeeting, and the OBS-Mac-VirtualCam appears as an option along with appropriate video.

joshspicer commented 4 years ago

FWIW I found hacky workaround for getting this plugin to work with Slack Version 4.5.0 030422a-s@1588375643 (Production).

I wrote up a step by step on my page here, but essentially you can utilize Electron's codesigning tool electron-osx-sign.

electron-osx-sign /Applications/Slack.app \
    --type=development \
    --entitlements="/path/to/entitlements.xml" \
    --gatekeeper-assess=false \

with the same entitlements as above. Not ideal, but works.

barnesjr commented 4 years ago

Confirming that Skype for Business 16.28.185 works when you use codesign --remove-signature /Applications/Skype\ for\ Business.app/

the virtual camera doesn't show as a source without running that.

billimek commented 4 years ago

Has anyone discovered a workaround with Cisco Webex Meetings? As of release 40.2.16.14 or so, use of virtual cameras seems to have been removed.

Removing codesignature from the ~/Library/Application Support/WebEx Folder/<versioned folder>/Meeting Center.app seems to just break the application from launching meetings.

I had a similar experience with the com.apple.security.cs.disable-library-validation approach as well.

For now, launching the meeting directly from a Chrome browser still works with the virtual cameras, but it's not a great experience.

We have a support case open with Cisco but I'm not expecting much.

ChaseOnTheWeb commented 4 years ago

Has anyone discovered a workaround with Cisco Webex Meetings? As of release 40.2.16.14 or so, use of virtual cameras seems to have been removed.

Removing codesignature from the ~/Library/Application Support/WebEx Folder//Meeting Center.app seems to just break the application from launching meetings.

I've discovered that, after I unsign ~/Library/Application Support/WebEx Folder/<versioned folder>/Cisco Webex Meetings.app (which is apparently called Meeting Center.app in your build), and then try to join a meeting using the standard /Applications/Cisco Webex Meetings.app, nothing happens at all as you observed.

However, if I launch ~/Library/Application Support/WebEx Folder/<versioned folder>/Cisco Webex Meetings.app directly, the meeting launches and I can choose the virtual cameras.

EDIT: It seems that launching the Application Support .app directly loads whatever meeting you last tried to start, so e.g., if I just clicked a web link to start a meeting, it will load that, or if I just clicked a recent room in /Applications/Cisco Webex Meetings.app it will load that.

budisangithub commented 4 years ago

@ChaseOnTheWeb - confirmed, I just unsigned ~/Library/Application Support/WebEx Folder//Meeting Place.app/. Launching from /Application/Cisco Webex Meetings.app will change nothing, but launching from ~/Library/Application Support/WebEx Folder//Meeting Place.app/ will allow me to choose the virtual cameras. The problem is, it will only launch my last meeting only.