Skip to content
All work

LocalCam

iPhone as a Mac webcam: sub-50ms, via a real CoreMediaIO system extension.

Role
Systems Engineer
Platforms
iOS, macOS, Web
Year
2025

I wanted to use my iPhone as a camera in OBS while running audio out of Logic Pro.

Continuity Camera could see the phone but gave me none of the control or orientation I needed, and Camo, which solved part of it, put the quality I was after behind a paywall. So I built my own. LocalCam streams the iPhone to the Mac over WebRTC and registers itself as a genuine system camera through a CoreMediaIO extension, so Zoom, Meet, Teams and OBS see hardware rather than an app. Broadcast monitoring on top: false colour, focus peaking, zebras, waveform. It is a tool I made for my own desk, not a product.

<50ms
glass-to-glass latency
4K/60
capture from iPhone sensors
0
kernel extensions, SIP untouched
  • Swift 5.9
  • CoreMediaIO
  • WebRTC
  • AVFoundation
  • Network.framework
  • Electron
  • WebGL

How it started.

  1. The friction

    I wanted to stream through OBS using my iPhone as the camera, with the audio coming out of Logic Pro. The phone has a far better sensor than anything else on my desk.

  2. What existed

    Continuity Camera sees the iPhone, but it decides how the camera behaves. I could not get the control or the orientation I wanted out of it. Camo solved part of the problem and put the rest, the quality I was actually after, behind its paid tier. So I started building my own, as a web app the phone would talk to through Safari.

  3. Where it broke

    That version worked, and then it stopped being the right shape. Safari cannot expose the camera controls I needed; the constraint is the browser and the hardware underneath it, not my code. No amount of work on the web version was going to reach what I wanted, so I threw it away.

  4. What I built

    A native iOS app and a native macOS app, talking over WebRTC on the local network, plus a CoreMediaIO system extension so macOS registers the feed as a real camera device. Zoom, Meet, Teams and OBS see hardware, with no plugin to install. Portrait and vertical shooting, manual camera control, and broadcast monitoring on top, false colour, focus peaking, zebras, waveform.

  5. What it changed

    It does what I wanted it to do, on my own desk. The part I would keep is not the extension; it is having recognised that the first architecture was wrong and started again rather than forcing it.

How it fits together.

iPhone

AVCaptureSession

4K/60 · manual ISO & shutter

iPhone

VideoToolbox

HW H.264 / HEVC

Transport

WebRTC Peer

UDP · local Wi-Fi

Sub-50ms

Transport

Bonjour mDNS

_localcam._tcp

Zero-config pairing

macOS System

CMIOExtension

Sandboxed system extension

Registers as hardware

macOS System

Zoom · Meet · OBS

No plugin required

Studio

WebGL Scopes

False colour · peaking · waveform

The extension is the trick: macOS sees a hardware camera, not an app.

How it was built.

CMIOExtension, not a DAL plugin

Problem
The well-trodden path for macOS virtual cameras is a DAL plugin. Apple deprecated DAL, and on modern macOS these either fail outright or demand that users disable System Integrity Protection, an unacceptable request for a camera app.
Approach
Implemented the modern sandboxed CMIOExtension architecture (CMIOExtensionProvider, Device and Stream) feeding CVPixelBuffers directly into the CoreMediaIO stream with no intermediate copy.
Trade-off
Installs without weakening system security, and survives OS upgrades that break DAL-based competitors. Significantly harder to build: the extension is sandboxed, awkward to debug, and lifecycle is managed by the OS rather than the app.

WebRTC over UDP, not RTMP

Problem
Streaming stacks default to RTMP or HLS. Both buffer aggressively for smoothness over the open internet, adding hundreds of milliseconds, which on a video call means visibly broken lip-sync.
Approach
Direct peer-to-peer WebRTC over UDP on the local network, hardware H.264/HEVC encoding through VideoToolbox, and a deliberately tightened jitter buffer that trades resilience for latency because the transport is a local Wi-Fi hop, not the public internet.
Trade-off
Sub-50ms glass-to-glass, imperceptible. The tuning is only safe because the network is known; the same configuration would fall apart over a WAN.

Scopes on the GPU

Problem
False colour, zebras and waveform each require per-pixel work on every frame. Done naively in JavaScript at 60fps on a 4K stream, the main thread stalls and the preview stutters: a monitoring tool that degrades the thing it monitors.
Approach
Moved pixel computation into WebGL shaders, with the remaining 2D canvas work batched and kept off the critical path.
Trade-off
Broadcast-grade monitoring at full frame rate with the UI still responsive.