Live data from Hacker News

Using a Canon EOS camera as a webcam in Debian

schlachter.xyz

31–40 of 78 posts

Re: Using a Canon EOS camera as a webcam in Debian

#31
My experience of this general approach with a Sony α6100: high and inconsistent latency (mostly 150–200ms, but sometimes towards 400ms), low resolution (1024×576), largely not hot-swappable (most apps required that the video device be created before their process began, and trying to read from it without also starting the stream would often poison things in some way, and various actions would make the pieces just stop working together until you restart all relevant processes), and interacts poorly with other similar things (e.g. I failed to get it to combine with OBS’s virtual camera output: no matter what I did, even with creating multiple devices and attempting to control which thing wrote to which, they’d still get tangled so that neither was of any use). Still, the image quality is good, considerably better than most webcams.

(It’s valuable to understand how this approach works: it’s using PTP, which supports roughly the commands “list the files you have” and “give me the file IMG0001.JPG”, and roughly thirty times a second it asks “give me the file ‹what the camera can currently see›.jpg”, and the video stream is that stream of JPEGs. Basically, this whole thing is a dreadful hack.)

By contrast, the cheap USB HDMI capture card I subsequently purchased (branded Simplecom DA315, but if you’ve looked into this stuff you’ll immediately recognise it as ODM hardware sold under a million brands) supports higher resolutions, normal latency (vastly lower), is hot-swappable, and doesn’t interfere with anything else trying to use v4l2loopback. Colour is not quite right, so I adjust it a bit on my camera. (This was something that surprised me when I first looked at HDMI capture cards: it seems that they’re all wrong, in differing amounts and directions. I do not understand why they can’t just be correct.) And there’s an aspect ratio problem where apps that request a lower resolution end up with the 16:9 image squashed to 4:3 with black bars added to the side. Not sure if this is a bug in the HDMI capture card firmware, Linux driver, or something else. As a demonstration of this, Google Meet in Firefox will get squished by default, but if I manually change its send resolution from auto (360p, I think) to 720p, it gets unsquished.

Re: Using a Canon EOS camera as a webcam in Debian

#32
post #21

Earlier quoted context omitted.

It really makes a better picture. Zoom / Meet / Teams / etc does compress a ton, but a big part of the horrendous video quality are webcams. Another, potentially cheaper way to replace a webcam is to use the main (rear) camera of an old cell phone. Digital photography, especially using tiny sensors, is computational photography. Webcams are too cheap to have reasonable processing power internally and webcam companies…

Compression also works better on higher-quality video. The compression algorithm doesn't have to try to properly recover the noise. Also, seconded on the difference a larger sensor and better glass make for a webcam.

Shallow depth of field also means that the video codec only has to concentrate on encoding detail in the [narrow] focal plane. In my experience, the results are stunning (50mm f/1.2L @f/2.0 and diffused LED video lights), and the combination of the well-lit in-focus elements in the image (transmitted by good glass) with the deeply and naturally blurred background would suggest that increasing the number of pixels in the image from ~ 1024x640 to ~ 1920x1080 would probably be far less noticeable than the numbers might suggest.

Re: Using a Canon EOS camera as a webcam in Debian

#33
post #2

Does this actually make a better picture? Won’t your stream still be super compressed by meet/zoom/etc?

I feed it into OBS and can get 1080p easily on a 5D MKII, a camera that's now more than 15 years old. Better quality than any dedicated webcam I've seen. It's a nice second life for it.

I thought you needed a 5DmkIII to get 1080p, because the 5DmkII has USB2.0 and is limited to a 200Mbps transfer speed (using MJPEG). And the HDMI resolution is much lower than that.

Re: Using a Canon EOS camera as a webcam in Debian

#35
post #34

How does using a DSLR affect camera lifetime? The sensor is presumably consistently exposed?

It is fine. I have been using an "old" canon EOS 1000 for a few years now. But I use an HDMI capture card with magic lantern running on the camera to get a clean HDMI feed.

Re: Using a Canon EOS camera as a webcam in Debian

#36
post #35
post #34

How does using a DSLR affect camera lifetime? The sensor is presumably consistently exposed?

It is fine. I have been using an "old" canon EOS 1000 for a few years now. But I use an HDMI capture card with magic lantern running on the camera to get a clean HDMI feed.

Why do you need magic lantern for that? HDMI capture card would presumably work with stock firmware?

I’ve also tried using my old 600d but with the canon provided software and it works pretty okay.

Re: Using a Canon EOS camera as a webcam in Debian

#37
post #34

How does using a DSLR affect camera lifetime? The sensor is presumably consistently exposed?

… exposed to light.

It's still enclosed in a dust-free environment. I'd say unless you shine laser beams directly at the sensor, or point it directly at the sun all day it'll be fine for many years.

Also, some (or most / all?) cameras will close the shutter curtain when disabled. Presumably you would enable the camera only when you need it.

Re: Using a Canon EOS camera as a webcam in Debian

#38
post #20

I've been wondering for a while and can't find an answer to this: SD to USB adapters exist, but is it possible to hook up an SD-to-USB cable and have a driver present a virtual sd disk to the camera but write the video directly to your computer RAM via USB? That would solve the problem for all dSLRs.

Wi-Fi-enabled SD cards that automatically inspect the filesystem and upload your photos to the internet or a computer already exist, it shouldn't be impossible to modify the firmware to upload MP4 files in a streaming fashion, assuming they have the bandwidth.

Re: Using a Canon EOS camera as a webcam in Debian

#39
post #20

I've been wondering for a while and can't find an answer to this: SD to USB adapters exist, but is it possible to hook up an SD-to-USB cable and have a driver present a virtual sd disk to the camera but write the video directly to your computer RAM via USB? That would solve the problem for all dSLRs.

SD card writes are buffered, this will presumably have too high latency for streaming.

Re: Using a Canon EOS camera as a webcam in Debian

#40
post #34

How does using a DSLR affect camera lifetime? The sensor is presumably consistently exposed?

I use a Canon R6 as a webcam. I noticed it gets reasonably hot after long meetings so I avoid it day to day. It is great, though, for client meetings because they always notice the quality of the image and ask how do I get that nice out of focus background :)
Post reply on HN