Use Jetson Nano as PC webcam

Hello, everyone,

Is it possible to use Jetson nano with csi camera as a usb webcam on a PC running Windows? And if it is, how is it achievable?
Thanks in advance

For this use-case, it would need other users to share experience. Generally we run Jetson device as a RTSP or UDP source. Please refer to the setup in Jetson Nano FAQ

Q: Is there any example of running RTSP streaming?
Q: Is there an example for running UDP streaming?

I can’t answer, but I have some thoughts on the topic you might find useful (or not).

You might look for a tutorial on the Linux kernel’s “gadget” API:

I’ve not heard of gadget being used for anything other than mouse, keyboard, mass storage, or network device emulation. That doesn’t mean other classes, such as USB Video Class (UVC) isn’t available, but I don’t know how complete the “standard USB device” emulation template is for other devices. Or similar for audio if this includes audio (one USB cable can, and very often is, used for more than one device; from the USB perspective they are usually unrelated, e.g., headphones with a microphone would be two separate devices sharing one cable; the digital volume control on the headset cable would be yet another device sharing one cable).

There is also the USB side, which is the data pipe, and although used in conjunction with a standard device (one is a device driver for the end object, the other is a device driver for the USB pipe itself). USB has several “modes”. There is a bulk/batch mode whereby chunks of data are sent, and is what a hard drive would use, and many other devices. There is interrupt mode, which keyboards and mice use whereby activity triggers an interrupt to request servicing. The mode which none of the Jetsons can handle is isochronous. Isochronous is used for realtime data with low latency.

A video camera can operate in a bulk mode, and is much like a network packet behavior. However, many audio and video devices which need a solid, predictable behavior without frame drops, so on, will use isochronous mode. Isochronous pre-reserves bandwidth, and essentially runs continuously. Think of it being like well-timed clock. If you need this, then you cannot use the Jetson’s built in USB functions.

@DaneLLL mentioned RTSP. This is a network version of video. It works well on any network, although the network itself will probably decide if the video becomes “choppy” at times (on a LAN this is probably very high quality, but over the internet RTSP would have problems at times). The USB can in fact be used as an internet device, whereby the Jetson looks like a network router. The default Jetson install makes the micro-OTG connector behave as a device if a micro-B USB cable is plugged in; the specific device depends on the setup of the Linux gadget API I mentioned earlier. This is already there for a few things, one of which is to become a network router. Upon plugin from a micro-B connector at the Jetson side, and a type-A (host mode) connector on the host PC, the host can see a router, and if allowed (security can get in the way), then that router even responds to a DHCP request (the host gains IP address, and the Jetson gains address

RTSP over the existing micro-OTG connector would not require any USB update at all. You’d need to bind the RTSP to the addresses involved. A very big down side is that the micro-OTG is only USB2, with overhead, and so many cameras could not work at higher resolutions or frame rates (actual gigabit would be significantly better, but insufficient for many cameras; a 10Gb/s network card could handle almost anything without loss on a LAN).

I’m not really a video guy, so there is much I cannot answer, but for anyone who does have that expertise you’d need to provide more details regarding a use-case example, plus many more details on the camera (and audio if present), e.g., the resolution, the color bit depth, and the frame rate.

You may try:

1. Stream CSI camera as RTPH264 to host

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 insert-vui=1 ! h264parse ! rtph264pay ! queue ! udpsink host=<PC_Client_IP> port=5000

2. Check receiving on client PC

This assumes that your client Windows PC has gstreamer installed and no firewall block UDP/5000.

gst-launch-1.0.exe udpsrc port=5000 ! application-x-rtp,encoding-name=H264 ! rtpjitterbuffer latency=300 ! rtph264depay ! decodebin ! queue ! autovideosink

Note that if don’t have gstreamer installed, you may use VLC or FFMPEG but you would have to write a SDP file for receiving.

Alternatively, you may use MP2T, using a static payload (33) wouldn’t require a SDP file. See below:

1bis. You may also stream as RTPMP2T from Nano:

gst-launch-1.0 nvarguscamerasrc ! 'video/x-raw(memory:NVMM),width=1280,height=720,framerate=30/1' ! nvv4l2h264enc insert-sps-pps=1 idrinterval=15 insert-vui=1 ! h264parse ! mpegtsmux ! rtpmp2tpay ! queue ! udpsink host=<PC_Client_IP> port=5000

2bis. Receive RTPMP2T:

You may receive with ffmpeg or VLC as rtp://<receiver_IP>:5000 or udp://<receiver_IP>:5000, or with gstreamer:

gst-launch-1.0.exe udpsrc port=5000 ! application/x-rtp,encoding-name=MP2T,clock-rate=90000,payload=33 ! rtpjitterbuffer latency=300 ! rtpmp2tdepay ! tsdemux ! decodebin ! queue ! autovideosink

With a Linux host, it may be possible to emulate a webcam using v4l2loopback, but for a Windows host I can’t tell.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.