1

I've got a v4l2loopback running on the Raspberry Pi and I can access the stream using MPlayer directly on the Raspberry Pi. However, I'd like to connect the Raspberry Pi to my Windows PC to access the videostream (not necessarily the complete X server) e.g. using VLC.

I don't know if this can be done. Here are my ideas:

  • I'd to use the ethernet port to connect my RPI and my Windows PC and stream either the video stream directly (/dev/video0) or the complete video output (everything that's visible using the HDMI port). Is that possible?
  • If not, is it possible to use a USB connection from the Raspberry Pi to my PC and have the RPI identify itself as webcam, so that I can use the basic webcam drivers from Windows to access the video output?

Or are there any other smart ways to do it?

2

As you are using v4l2 loopback, you can search for general streaming of camera video. ffmpeg and cvlc are keywords you might want to search here. But unless you use HLS (HTTP Live Stream) which is not that easy to set up (at least I did it once and was not convinced from the results regarding quality and delay), you will be stuck with VLC as one of the few players that can open the stream.

A more practical approach would be to use something like "motion" that provides your v4l2loopback as a webcam in the browser. (Currently I am aiming for the same goal with an own implementation but it is still not ready for general usage)

The latter idea won't work as you'd have to implement a "webcam gadget" for the Pi Zero first. Only more primitive things like ethernet and mass storage are available out of the box.

  • I had the same experience with HLS, delay and quality were not good. – tobyd Nov 7 '17 at 11:13
1

Awesome. Realizing the Pi supports v4l2loopback, I think various tutorials should be updated to use that rather than vivid (disabled in Raspbian by default).

I'd to use the ethernet port to connect my RPI and my Windows PC and stream either the video stream directly (/dev/video0)

For streaming V4L2 over ethernet, I recommend webrtc-streamer. VLC doesn't support WebRTC, but could you use a browser instead?

If not, is it possible to use a USB connection from the Raspberry Pi to my PC and have the RPI identify itself as webcam, so that I can use the basic webcam drivers from Windows to access the video output?

Yes, assuming you are using a Pi Zero. Although a UVC gadget is fraught with difficulty, the required kernel module, g_webcam, is available out of the box. This question covers the basic howto on getting started.

If you run v4l2loopback before loading g_webcam, you'll have to pass -u /dev/video1 -v /dev/video0 to uvc-gadget. It'll be the other way around if you swap the loading order.

As mentioned in the above link, be forewarned that you'll have to deal with resolution/format issues and various bugs when it comes to making a working UVC gadget.

Or are there any other smart ways to do it?

The question that comes to mind is: why not use VNC? Perhaps you have OpenGL ES rendering, or maybe there is a reason the player on Windows must be VLC. It would be good to clarify.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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