hankbao / obs-mac-virtualcam

Creates a virtual webcam device from the output of OBS. Especially useful for streaming smooth, composited video into Zoom, Hangouts, Jitsi etc. Like obs-virtualcam but for macOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OBS (macOS) Virtual Camera

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-virtual-cam but for macOS.

Mar-28-2020 01-55-07

This code was spun out of this OBS Project RFC which was itself spun out of this issue from @tobi. This was intended as a proof of concept to inform technical decisions in that RFC, but who knows, maybe it will be useful to you in its current state. The goal is for this (or something with equivalent functionality) to eventually be merged into the core OBS codebase 🤞.

This is heavily based on Apple's CoreMediaIO sample code which has been modernized by @lvsti

Building

To use this plugin, you'll need to clone and build OBS locally, build this plugin, copy it to the right places, then run your local build of OBS:

# Clone and build OBS
git clone --recursive https://github.com/johnboiles/obs-studio.git
cd obs-studio

# Follow normal OBS build steps
brew install FFmpeg x264 Qt5 cmake mbedtls swig
mkdir build
cd build
export QTDIR=/usr/local/opt/qt
cmake .. && make -j

# Clone this repo
cd ../..
git clone https://github.com/johnboiles/obs-mac-virtualcam.git
cd obs-mac-virtualcam

# Set an environment variable that points to the directory for your OBS clone
export OBS_DIR=$PWD/../obs-studio

# Build the plugin
mkdir build
cd build
cmake -DLIBOBS_INCLUDE_DIR:STRING=$OBS_DIR/libobs cmake -DLIBOBS_LIB:STRING=$OBS_DIR/build/libobs/libobs.dylib ..
make -j

# Copy the OBS plugin to your local OBS build
cp src/obs-plugin/obs-mac-virtualcam.so $OBS_DIR/build/rundir/RelWithDebInfo/obs-plugins/

# Copy the DAL plugin to the right place
sudo cp -r src/dal-plugin/obs-mac-virtualcam.plugin /Library/CoreMediaIO/Plug-Ins/DAL

# Run your build of OBS
cd $OBS_DIR/build/rundir/RelWithDebInfo/bin
./obs

Known Issues

  • OBS crashes when an app using the virtual camera is closed (#1)
  • Resolution is hardcoded to 720x480
  • If OBS is closed when an app is opened, the virtual camera may not show up

License

As the goal of this repo is to eventually get merged into obsproject/obs-studio (or die because someone made a better implementation), the license for this code mirrors the GPLv2 license for that project.

About

Creates a virtual webcam device from the output of OBS. Especially useful for streaming smooth, composited video into Zoom, Hangouts, Jitsi etc. Like obs-virtualcam but for macOS.


Languages

Language:C++ 93.1%Language:C 5.3%Language:CMake 1.2%Language:Perl 0.4%