ALL INTELLIGENCE
Hacker News AIT2·Tools

Developer Revives 2000 Lego Webcam on Modern Mac

Original title: Legocam: My Lego webcam from 2000, working on a modern Mac
38AI Score

Developer Ben Kelly wrote legocam, a macOS driver for the Logitech QuickCam Web camera bundled in the 2000 LEGO & Steven Spielberg MovieMaker Set. The roughly 400-line C and Objective-C project uses libusb to talk to the USB device without a kernel extension, and the camera now works in Zoom, FaceTime and browsers. It is released under GPL-2.0 and builds on the Linux gspca_stv06xx driver.

Full Report

Contents4 sections

My mum gave me the LEGO & Steven Spielberg MovieMaker Set (1349) for Christmas in 2000. I loved it. The best part was the camera: a little webcam in a LEGO brick body. I clipped it onto my LEGO RC car base to make a spy car, and drove it around as far as the USB cable reached from my little Sony VAIO laptop.

Inside, the camera is a Logitech QuickCam Web, USB ID 046d:0850. No macOS driver has worked for it in a long time. So I wrote one. legocam is about 400 lines of C and Objective-C, and the camera now shows up in Zoom, FaceTime and the browser.

The LEGO Studios camera: a grey and clear blue LEGO brick body with a yellow lens ring, plugged into a USB hub.

The camera, 26 years on, plugged into a USB-C hub.

No kernel extension needed

Modern macOS makes kernel extensions hard to load, for good reasons. I didn't need one. libusb lets a normal program talk to a USB device directly, so legocam is just a command you run.

The hard part is knowing what to say to the camera. Luckily, Linux still supports it. The gspca_stv06xx driver knows this camera well: an STV0610 USB bridge in front of a VV6410 image sensor. I read that driver and copied the protocol: which registers to write, in which order, to wake the sensor up and start streaming.

The camera sends frames over an isochronous USB endpoint. Each packet has small headers that mark the start of a frame, image data and the end of a frame. legocam stitches the data together and writes each complete frame to stdout: raw 356x292 pixels in a Bayer pattern (bayer_grbg8).

Writing raw frames to stdout keeps it simple. ffplay can show them straight away:

BASH
make view

Getting it into Zoom

A command that prints frames isn't a webcam. On macOS, a new camera has to be a signed camera extension, and a free Apple developer account can't sign one.

But OBS already ships a signed one: the OBS Virtual Camera. So I wrote a second small program, obscam. It finds the OBS camera device through CoreMediaIO, opens its input stream, and pushes the frames in, converted to colour with libswscale. The OBS app doesn't even need to be running.

BASH
make webcam

Then pick "OBS Virtual Camera" in any app.

The LEGO camera next to a MacBook Pro. Photo Booth on the screen shows a soft, warm picture of a pug from the LEGO camera.

Photo Booth, live from the LEGO camera. The first test subject was Buttercup, one of my pugs.

What it can't do

  • It runs at about 5 frames per second. That's the limit of USB 1.1 and the sensor clock, not the code.
  • There's no automatic exposure. You set exposure and gain by hand if the picture is too dark or too bright.
  • The microphone and the snapshot button don't work yet.
  • Apps call it "OBS Virtual Camera", not "LEGO".

I've tested it on an Intel MacBook Pro with macOS 15.7.3. If you try it on Apple Silicon, let me know how it goes.

Thanks to the Linux driver

None of this would exist without the people who wrote and kept up the Linux gspca_stv06xx driver, years ago, for a camera most people threw away. legocam is GPL-2.0, like the driver it learned from.

The code is on GitHub: benkelly/legocam.