
OBS (macOS) Virtual Camera - mistersquid
https://github.com/johnboiles/obs-mac-virtualcam
======
ceocoder
If you are a linux user and own a nice camera you can use gphoto2 and ffmpeg
to create a virtual camera. I posted howto on HN couple of days ago[0][1],
here it is for anyone who might need it. I tried it with both Sony RX100VA and
Sony A7III, in both cases it works really well.

edit: forgot to mention that this works over USB, you don't have to pay crazy
markup for capture card

edit2: (because I'm so excited about getting this to work) here is a list of
supported cameras[2] - sadly I was _not_ able to get GoPro Hero 6 to work.

[0] [https://www.crackedthecode.co/how-to-use-your-dslr-as-a-
webc...](https://www.crackedthecode.co/how-to-use-your-dslr-as-a-webcam-in-
linux/)

[1]
[https://news.ycombinator.com/item?id=23325143](https://news.ycombinator.com/item?id=23325143)

[2]
[http://www.gphoto.org/proj/libgphoto2/support.php](http://www.gphoto.org/proj/libgphoto2/support.php)

~~~
AdamMeghji
Is this possible in MacOS at all? I have an RX100 V and an Elgato Camlink HD,
but would love to use that capture card w another cam, and use the RX100 over
USB simultaneously.

~~~
enjoylife
It works for Mac

    
    
      brew install gphoto2
      brew install ffmpeg --with-ffplay
      gphoto2 --abilities
      # Abilities for camera             : Sony Alpha-A6300 (Control)
      # ...
      gphoto2 --stdout --capture-movie | ffmpeg -i - -vcodec rawvideo -pix_fmt yuv420p -threads 0  -f matroska - | ffplay -
    

I'm piping it to ffplay,so this will at least let you test your camera or you
could also use it in OBS as a window source. Also, make sure your cameras usb
mode is not set to "mass storage" but to a “Remote Camera Control”.

~~~
code_biologist
Thanks for the tip, really appreciate the actual commands. I'm wondering if
anyone else is running into this:

    
    
        $ brew install ffmpeg --with-ffplay
        Usage: brew install [options] formula
    
        # Install flags here, nothing about --with.
        Error: invalid option: --with-ffplay

~~~
enjoylife
Your right, they removed that option,
[https://formulae.brew.sh/formula/ffmpeg](https://formulae.brew.sh/formula/ffmpeg).
I guess ffplay is built with it by default now.

------
rcarmo
You can also use MediaTek's NDI Virtual Input with some desktop apps (like
Skype), but I personally use this with OBS to do two things:

\- Send out a composite overlay (screen capture + webcam + lower thirds) on
Teams/Skype/etc.

\- Send out screen capture from another machine (usually OBS to OBS via NDI
and then out via this plugin)

OBS is a lot of fun, but, alas, extremely demanding on system resources in
some configurations, enough that I've started considering getting a new
machine solely for video conferencing.

~~~
mistersquid
Searching for "MediaTek NDI Virtual Input" does not turn up results with
"MediaTek" for me. Did you mean "NewTek" or another NDI tool?

I couldn't find an NDI product for macOS from NewTek.

~~~
fsflyer
NewTek does NDI for Mac. The tools and SDK are available for Mac.

[https://ndi.tv/tools/](https://ndi.tv/tools/)

The OBS NDI plugin is not part of OBS proper, but available separately:

[https://github.com/Palakis/obs-ndi/releases](https://github.com/Palakis/obs-
ndi/releases)

~~~
developer2
Holy smokeballs, thank you so freaking much!!! This thread caught my eye as
I've been wanting to customize my Zoom and MS Teams "stream" (ie. webcam +
extra background/overlay goodies). I hate to say it, but I skipped past the
OP's project and tried this suggestion of NDI first.

Amazing. It took a good 30 minutes to figure it all out, but I now have the
output of OBS (in my case, just the preview itself without needing to
stream/record) as a video/webcam input source for Zoom, Microsoft Teams, and
within Firefox. Note: doesn't work with Discord or QuickTime's File > New
Movie Recording.

And all this with me being on macOS. Not Windows, but macOS. Incredible.

Steps (should work for macOS and Windows, not sure about Linux):

1\. Install OBS. Run it, and set up a basic scene for testing (eg. webcam and
a text label).

2\. Download/install NDI Tools for your OS from
[https://ndi.tv/tools/#download-tools](https://ndi.tv/tools/#download-tools)
(note: system restart required). You only need the "NDI Virtual Input" app; on
macOS each app had its own .pkg file bundled in the single .dmg archive; on
Windows I assume it's an install wizard with checkboxes for each component.
Again, only need "NDI Virtual Input" app/component.

3\. Run the NDI Virtual Input application installed in step 2. It should live
in your systray (without doing anything useful yet).

4\. Download/install the obs-ndi plugin for your OS from
[https://github.com/Palakis/obs-ndi/releases](https://github.com/Palakis/obs-
ndi/releases) \- right now for Windows or macOS it's version 4.9.0 (expand the
"Assets" link). There's a 4.9.1 update specifically for Ubuntu/Debian, but I'm
not sure how those OS's are supported when there is no NDI Tools for Linux in
step 2.

5\. Run OBS. If you're lazy and didn't read the GitHub release notes in step
4, starting OBS should popup with a direct link to the NDI runtime you also
need to download/install; then restart OBS.

6\. In OBS, go to Tools > NDI Output Settings. If you want to "clone" the OBS
output to the NDI virtual device _only when you start streaming /recording in
OBS (ie. to disk or to a streaming platform like Twitch)_, check "Main
Output". Otherwise check "Preview Output", in which case your OBS preview will
be output to the virtual video device at all times without having to start OBS
streaming/recording.

7\. In your operating system's systray (ie. top-right on macOS, bottom-right
on Windows), you should have an NDI icon living there as started in step 3.
With OBS running and configured according to step 6, you should be able to
click the systray icon and select that output source as the input source for
the NDI virtual device.

8\. Open Zoom, Teams, or hopefully other apps which will work. Wherever you
configure which input source to use for video/camera within that app's
settings, there should be an "NDI Video" source. Select that… and BAM – your
OBS canvas is now your input source!!

That took so long to type out, I hope someone manages to make use of it. :)

~~~
starmftronajoll
Thank you for sharing this. Your step-by-step worked perfectly for me (on
Mac), and now I've got the OBS -> Hangouts setup I was looking for.

~~~
developer2
Yay!!! There were a couple of steps that took me time to debug how to make it
work, so I'm ecstatic that at least one person found my steps useful!!! I
don't have recent experience with Google Hangouts, so I'm curious to know
whether that was a native app (does Hangouts have a macOS app?), or which
browser you used (Firefox, Chrome, or…)?

------
wilsmex
Did @johnboiles get the 10k bounty that was put up (I think by Shopify CEO)
for this plugin?

~~~
johnboiles
No but iirc the terms from @tobi were that the feature needs to be cross-
platform and merged into the main OBS codebase. There is work happening on
both of these fronts, and absolutely my goal is to get this plugin merged into
OBS eventually. We'll figure out some sort of splitting scheme when that time
comes.

~~~
Vinnl
More info can be found in the recently merged RFC for those interested:
[https://github.com/obsproject/rfcs/pull/15](https://github.com/obsproject/rfcs/pull/15)

------
whywhywhywhy
Been hoping to use this but it just brings my MBP 2019 to it's knees, like
actually feels dangerously hot about 30 seconds after activating it.

Windows version doing the same thing feels light as a feather when running (3%
CPU, <10% GPU usage)

~~~
codazoda
Make sure the power adapter is connected at the right (not left) side of the
MBP.

~~~
woodrowbarlow
i'm marveling at how well this comment exemplifies everything that's wrong
with USB-C.

~~~
Dunedan
That's not related to problems with USB-C, but to Apple messing up their
hardware design. This was discussed recently here:
[https://news.ycombinator.com/item?id=22957573](https://news.ycombinator.com/item?id=22957573)

~~~
woodrowbarlow
i didn't realize; thank you for the context.

i'd still point back to USB-C's complexities, though. apple isn't the only
major company to have gotten USB-C wrong; look at the nintendo switch.

------
supernintendo
For anyone looking to set up a virtual OBS webcam in Arch Linux, here's how I
did it:

1\. Install headers for your Linux kernel:

    
    
      - sudo pacman -S linux56-headers
    

2\. Install v4l2loopback-dkms from AUR:

    
    
      - git clone https://aur.archlinux.org/v4l2loopback-dkms.git
    
      - cd v4l2loopback-dkms
    
      - makepkg -scCi
    

3\. Create a virtual video capture device:

    
    
      - sudo modprobe v4l2loopback devices=1 video_nr=10 card_label="OBS Cam" exclusive_caps=1
    

4\. Set up a virtual audio device to avoid latency:

    
    
      - sudo modprobe snd-aloop index=10 id="OBS Mic"
    
      - pacmd 'update-source-proplist alsa_input.platform-snd_aloop.0.analog-stereo device.description="OBS Mic"'
    

5\. Run ffmpeg:

    
    
      ffmpeg -an -probesize 32 -analyzeduration 0 -listen 1 -i rtmp://127.0.0.1:1935/live/test -f v4l2 -vcodec rawvideo /dev/video10
    

6\. Setup OBS to stream to ffmpeg:

    
    
      - File > Settings > Stream, set Service to "Custom..." and "Server" to `rtmp://127.0.0.1:1935/live/test`
    

7\. Setup low latency streaming:

    
    
      - File > Settings > Output, set Buffer Size to 0, CPU Usage Preset to "ultrafast" and Tune to "zerolatency".
    

8\. Start Streaming in OBS.

9\. Select your virtual camera and audio devices in Google Meet / Zoom / etc.

I get virtually no latency with this setup but I'm running an AMD Ryzen 7
2700X with 32GB of RAM. As always, YMMV.

~~~
tobias2014
Or you can use the obs v4l2loopback plugin to replace steps 5 and 6:
[https://github.com/CatxFish/obs-v4l2sink](https://github.com/CatxFish/obs-v4l2sink)

~~~
supernintendo
Thanks! I’ll try this out.

------
diroussel
This should work in Zoom, as in the latest release of Zoom 5 they have re-
enabled virtual webcam support.

~~~
tpetry
Why can zoom block a virtual camera? Couldn’t the virtual camera just pretend
to be like any other real camera?

~~~
whywhywhywhy
It's seemingly a MacOS Code Signing limitation.

[https://github.com/johnboiles/obs-mac-
virtualcam/issues/4](https://github.com/johnboiles/obs-mac-
virtualcam/issues/4)

~~~
jiveturkey
optional restriction, not limitation.

~~~
comex
The limitation is that CoreMediaIO plugins still run in-process (and not just
in some daemon but in arbitrary application processes!), when Apple's
direction for over a decade has been to move all plugin mechanisms towards an
out-of-process model. There's nothing about video plugins in particular that
would prevent them from being out-of-process; in fact, most of Apple's
CoreMediaIO plugins _already_ have the bulk of the logic in a separate
"assistant" process, but the IPC layer is reimplemented by each individual
plugin rather than being done generically by CoreMediaIO itself. It's clear
what has to happen, but Apple hasn't done it yet.

------
skrowl
DroidCam (works on iOS too despite the name)
[https://www.dev47apps.com/](https://www.dev47apps.com/) works great on
Windows if you're looking for an alternative on a business / gaming OS and you
have a smartphone (or tablet).

I've used it with Zoom / Google Meet / Discord and it's never failed me.

~~~
ojosilva
I use Iriun Webcam to use my (leftover) Android phone as a webcam into my
MacBook Air and iMac, with Zoom, OBS and Quicktime. It works pretty decently,
the only gripe is that I can't control exposure from the phone camera so it
needs the right lighting to look nice.

There are also other apps out there, besides DroidCam and Iriun, that support
different phone-computer connections.

------
oger
Finally. I‘ve been waiting / looking for a decent solution for quite a while
now...

~~~
wegs
What was wrong with CamTwist? I've been using OBS+CamTwist to do this for
years now. I mean, this will save a couple minutes setup time, but it's not
like that wasn't decent.

~~~
BrandonSmith
CamTwist requires disabling macOS SIP. For many this is too high bar.

~~~
jonpurdy
I find that CamTwist destroys the i7 on my 2015 13" MBP as well, slowing it
down so much that I can barely use Google Sheets at the same time.

------
PatrolX
Canon recently released a driver that lets you use an EOS camera as a USB
webcam.

It's available for Mac and Windows.

So you can use it directly as a normal webcam or pull it into OBS and
manipulate it with filters and text etc. then use OP's tool to output the OBS
processed version of your EOS.

[https://www.usa.canon.com/internet/portal/us/home/support/se...](https://www.usa.canon.com/internet/portal/us/home/support/self-
help-center/eos-webcam-utility/)

~~~
ojosilva
I'm excited about this... But I wonder how much resources it requires to
stream 720p 30fps into my older Macs without jitter and dropped frames. I had
higher hopes on Elgato Cam Link, if it was in stock anywhere, since it does
the processing on chip, but it's just speculation since not a lot of people
measure performance on these setups either because it all works so well on
Windows and/or they have high end machines for gaming (also Windows). Very few
streamers/reviwers use Mac as it is underperformant and undersupported in the
video streaming arena. It's really frustrating to realize this right in the
middle of this "new normal" where webcams and video capture devices are all
sold-out globally and one finds himself with a couple of video-worthless Macs.

Ironically Apple came up with FireWire a long time ago to bring (mostly
prerecorded) video faster into Macs and now they lag far behind in every
aspect related to video. This includes their webcams, which are terrible. Now
that's a different story on iOS devices...

------
alpb
I've been using this repo for a while now and it's a champ. It has been making
my webcam rock, as OBS does a great job chroma key'ing green screen behind me.
Plus I can add effects as I wish.

Thanks for reminding this and I'll make a donation to this person. Hope this
becomes the actual implementation and he gets the $10k bounty by @tobi.

------
wbobeirne
I recently tried to do some work on making a virtual camera, and was shocked
to see just how difficult it is, let alone making something cross-platform.
Anyone know of any projects that are trying to make this easier to hack on?

~~~
johnboiles
Not sure about cross-platform, but for macOS I started this plugin by creating
a minimal virtual camera: [https://github.com/johnboiles/coremediaio-dal-
minimal-exampl...](https://github.com/johnboiles/coremediaio-dal-minimal-
example)

@seanchas116 made a Swift port of my minimal example
[https://github.com/seanchas116/SimpleDALPlugin](https://github.com/seanchas116/SimpleDALPlugin)

Overall it _was_ very difficult! Apple's documentation and sample code for
CoreMediaIO DAL (virtual camera) plugins are terrible. I just brute forced it
for hours trying all sorts of different combinations of things before I got
something to work.

~~~
andrekandre
this is fantastic, i wish i had your example when i worked on mine (closed
source)... it was the same for me, total brute force

... and apples examples are in c++ but i ended up doing it using straight c
out of frustration since thier (c++) examples were so convoluted

~~~
johnboiles
Very very convoluted. I found it near impossible to read.

------
j45
Zoom appears to have released an update fixing the Virtual Cam Support.

"Changes to existing features

    
    
        Re-enable virtual camera support
        Support for virtual cameras will be re-enabled for users on client version 5.0.4. "
    
    
    

[https://support.zoom.us/hc/en-
us/articles/201361963](https://support.zoom.us/hc/en-us/articles/201361963)

~~~
johnboiles
Those release notes are a bit misleading. See my comment above

~~~
j45
Thanks for taking the time to bring my attention to it.

------
jabberwik
Most meeting software already allows you to broadcast your webcam and a
screen-share session at the same time. So this is only necessary if you want
your webcam feed to be embedded inside your screen-share, and you want your
screen-share to be your webcam feed. For example, this sounds like it would be
a horrible experience in something like a Zoom gallery view. Am I
understanding correctly?

~~~
rahimnathwani
OBS can do a lot more than embed your webcam over your screen share.

You can:

\- combine and arrange multiple portions of the screen as you like

\- filter things

\- switch between different layouts whilst you're in a call

~~~
jabberwik
I'm asking specifically about the virtual camera. Why not just screen-share
OBS' preview window?

------
some-guy
Slight tangent, does anyone know of any virtual "audio" device (in Mac OS or
Windows) that you can attach VSTs / AUs to? I know that technically Zoom
allows you to share computer audio but a controlled audio device would allow
more granular control of the input.

~~~
savoyard
BlackHole [1] is a modern alternative to Soundflower.

[1]
[https://github.com/ExistentialAudio/BlackHole](https://github.com/ExistentialAudio/BlackHole)

~~~
baliex
Seconding this, I recently switched to Blackhole. I think because Soundflower
is no longer being developed.

------
fouc
Any idea if we could just simplify this by using a virtualbox VM setup with
the right software?

Then it'd be cross platform and just a matter of running an optimized VM that
can run on a limited amount of resources.

------
raben_
Camtwist can be another option if you want a virtual cam on Mac
[http://camtwiststudio.com/](http://camtwiststudio.com/)

------
unkulunkulu
Thank you! This is very relevant! Now I get a zoom meeting with my friends
aaaand, chatroulette, here we go!

------
weakwire
Finally!

------
dfabulich
I don't understand what problem OBS solves. It records video, but Windows and
macOS already come with video recorders built in.

So OBS is better somehow. How? Why is OBS better than built-in OS recorders?

~~~
greggyb
It's not about recording so much as managing a broadcast. You can configure
many inputs which include external video (e.g. a webcam), media on the machine
(recorded video or images), and screens on the device, and outputting this as
a unified stream. This stream may be passed on as a virtual video device,
which other programs can use, or to a stream host (e.g. Twitch), or be
recorded.

These various inputs can be arranged into "scenes" for easy management and
switching among them.

If all you need to do is record the raw video from a video device, you don't
need OBS.

~~~
duskwuff
Game streaming (like Twitch) is an extremely common use case for OBS, and it's
a great demonstration of what's possible. A lot of streamers will broadcast a
composite of their screen, their webcam (often with green-screen masking), a
feed of their chat, and various other graphics. All of this is pretty
straightforward to do with OBS, and would be a significant effort to build
otherwise.

------
saikiran91
This is a good news.

------
an_opabinia
Use Wirecast instead. It works better.

OBS just isn’t for macOS users. If you record video with it it’ll be
corrupted. The performance is bad. It’s for people who stream to Twitch on a
Windows computer.

The real problem is that the macOS security model broke virtual cameras in the
latest version of Zoom.

~~~
zapzupnz
Can you substantiate any of your claims? I've used OBS on macOS for a long
time and your experience doesn't correspond to mine.

It's true that there are some performance concerns and hardware encoding isn't
available for streaming purposes on macOS due Apple's Video Toolbox API not
exposing the appropriate encoder options.

However, I doubt that OBS would be responsible for corrupted video. It uses
the industry-standard x264 encoder — if there's a problem with the video, it
derives from (A) your settings, and (B) x264. I'm more inclined to believe A
than B.

I'm more than happy to use Wirecast if you'll pay for a licence. I and most
other people, mostly amateurs, don't have a spare US$599 lying around.

