-1
\$\begingroup\$

Generic USB cameras can be used plug-and-play without the need for any additional drivers. How is the video stream compressed and sent over a USB connection? What are the standardized drivers that read this video stream? There is also some software that can emulate a video device. How do those work? Is there some sort of standard for video transmission over USB, as the generic webcams work with different operating systems?

\$\endgroup\$
6
  • 1
    \$\begingroup\$ Google first. Come back with a more specific question. \$\endgroup\$
    – brhans
    Dec 4 '20 at 4:48
  • 1
    \$\begingroup\$ None of these questions are on topic here, as they are about the behavior of existing consumer devices, not about issues in original designs. It happens they're all quite well documented, so you'll be able to answer your query with a little searching, but that's irrelevant to the fact that consumer product questions do not fit here, a fact which site guidance on allowable questions makes quite clear. \$\endgroup\$ Dec 4 '20 at 4:56
  • 1
    \$\begingroup\$ I want to make my own USB camera. I tried Googling this question but I couldn't find anything. Sorry if this is off-topic, what is a better place to post this kind of question? I was initially thinking Reddit, but this seemed too complex for that. \$\endgroup\$ Dec 4 '20 at 5:04
  • 1
    \$\begingroup\$ You're simply not going to make your own USB camera from first principles based on a stack exchange answer. Get hardware and software specifically intended to work together for this purpose, try the manufacturer demos exactly as is and unmodified, and then you might be able to make some customizations around the edges. Finding such items, is like all requests for external resources, not on topic here. \$\endgroup\$ Dec 4 '20 at 5:11
  • 1
    \$\begingroup\$ I am planning on using a Pi Zero with a camera module and just wanted to know how USB video works so I could understand what I was working on better. \$\endgroup\$ Dec 4 '20 at 5:28
4
\$\begingroup\$

How is the video stream compressed and sent over a USB connection?

Most often there is no compression. The pixels are simply sent over the USB bus as they are read out of the sensor.

What are the standardized drivers that read this video stream?

USB Video Class drivers. They are provided by your operating system.

There is also some software that can emulate a video device. How do those work?

I don't think anyone can answer this since you didn't link to the software you're thinking of.

Is there some sort of standard for video transmission over USB, as the generic webcams work with different operating systems?

The USB specification includes a standard for doing this called "USB video device class".

I want to make my own USB camera. I tried Googling this question but I couldn't find anything.

Here is a complete tutorial that works through building a USB video class camera from scratch using a hardware USB bridge:

https://www.circuitvalley.com/2019/12/diy-cypress-fx3-usb3-usb-3-uvc-camera-ov7670.html

And here is one using a PIC microcontroller:

https://www.circuitvalley.com/2019/05/USB-video-device-class-uvc-pic-mcu-pic32-diy-usb-cam.html

In either case the the process is conceptually simple. Enumerate as a USB UVC device, read out the sensor's data pins, collect the data in a buffer, then send frames over the USB bus. The host driver will then handle the rest per the USB specification.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ Thanks a lot for the answer! To clarify, the software I was referring to was DroidCam and OBS-VirtualCam \$\endgroup\$ Dec 4 '20 at 5:21
4
\$\begingroup\$

Even for VGA 640x480, 30fps, 3-byte color, raw transmission needs >200 Mbps transfer rate, which is half of USB HS raw data rate. Modern webcams don't use raw format, they use compression.

Since about 2005 all useful (usual disclaimers applied) webcams use H.264 compression, see this nice white paper by Logitech.

\$\endgroup\$
1
  • \$\begingroup\$ Other answer said there was no compression, thanks for clarifying! \$\endgroup\$ Dec 8 '20 at 3:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.