1

I just started experimenting with a new Raspberry Pi 3 Model B with the latest Raspbian installed. I was looking for the best way to stream from the camera module and I have found different answers, some of which might be outdated. In particular, some answers seem to suggest that the best way is to load the V4L2 module and then stream directly from /dev/video0. I have come to believe that this method is now considered deprecated, since loading the bcm2835-v4l2 module does not create /dev/video0 on my installation of Raspbian. My conclusion is that the best way to stream video from the Pi camera is to use the raspivid approach.

Are my conclusions correct? Or is there perhaps something wrong with my Raspbian?

EDIT This is what I get out of dmesg after modprobe

[  385.249635] media: Linux media interface: v0.10
[  385.275426] Linux video capture interface: v2.00
[  385.311687] bcm2835-v4l2: scene mode selected 0, was 0
[  385.313824] bcm2835-v4l2: V4L2 device registered as video0 - stills mode > 1280x720
[  385.318747] bcm2835-v4l2: Broadcom 2835 MMAL video capture ver 0.0.2 loaded.
pi@raspberrypi:~ $ /dev/
block/  bus/    char/   disk/   fd/     input/  mapper/ mqueue/ net/    pts/    raw/    shm/    snd/  
Phoenix87
  • 113
  • 1
  • 2
  • 7

1 Answers1

4

By stream I assume you mean over the network. I recently researched the same question (specifically, streaming over RTSP) and these are the best options out there:

I tried v4l2rtspserver first since it seemed the simplest. I'm happy with the result so I didn't try the other 2, but they seem viable options.

Re V4L2: it's not deprecated in any way. In fact it's what v4l2rtspserver uses, as you might guess from the name. Once the module is loaded it should create a /dev/video0 immediately. If you're not seeing it there may be a problem with your setup. Can you record video with raspivid?

If you don't need a standard format stream, there's also the option of using gstreamer on both ends of the connection:

  • On the Raspberry Pi:

    raspivid -n -t 0 -w 640 -h 480 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host=0.0.0.0 port=5000

  • Display the stream on another computer (substitute IP as appropriate):

    gst-launch-1.0 -v tcpclientsrc host=10.10.5.208 port=5000 ! gdpdepay ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=false

This has one advantage: the stream has almost no delay, which I could never manage to get with any of the methods that stream over RTSP

Pedro Lopes
  • 76
  • 1
  • 8