Stream video from PiCam to VLC and Browser

i got a camera modul for my raspberry pi some days ago. Here are some notes about the first experiment.

Methods one: stream a video over RTSP (piped or direct throught VLC)

expect a big time delay with this method! Scroll down for a faster one.

At first:

Installing VLC Player

sudo apt-get install vlc

From a forum post:

As far as I can tell, these instructions are obsolete. I'm having much more success with the (new?) v4l2 kernel driver for the camera. Run sudo modprobe bcm2835-v4l2, then any vlc command such as cvlc v4l2:///dev/video0 --v4l2-width 1280 --v4l2-height 720 --v4l2-fps 24 --v4l2-chroma h264 --sout '#rtp{sdp=rtsp://:8554/}'.

...and finally the obsolete solution. Works but i have a lot of encoding timeouts/videolags with it:

Streaming The Camera Video Using RTSP

Enter the following command to start the streaming:

raspivid -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

raspivid is used to capture the video

-o - causes the output to be written to stdout
-t 0 sets the timeout to disabled
-n stops the video being previewed (remove if you want to see the video on the HDMI output)
cvlc is the console vlc player
-vvv and its argument specifies where to get the stream from
-sout and its argument specifies where to output it to

Options

Specifying the camera resolution

raspivid -o - -t 0 -n -w 600 -h 400 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

-w Width available range: 64 to 1920
-h Height available range: 64 to 1080
-fps Frames per second: 2 to 30 (may change in the future)

Viewing The RTSP Stream Over The Network

You need a player which supports RTSP, for instance VLC, Quicktime, etc. Open a network stream using

rtsp://###.###.###.###:8554/
where ###.###.###.### is the IP address of the RPi.


Another method: Stream JPGs

from: [https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=45178]

Install mjpg-streamer. [https://github.com/jacksonliam/mjpg-streamer]

#!/bin/bash
export LD_LIBRARY_PATH=/home/pi/mjpg-streamer-master/mjpg-streamer-experimental/
/home/pi/mjpg-streamer-master/mjpg-streamer-experimental/mjpg_streamer -o "/home/pi/mjpg-streamer-master/mjpg-streamer-experimental/output_http.so -w ./www" -i "input_raspicam.so -fps 20 -x 320 -y 240 -vf -sh 50"

Want real CCTV feeling? Try:

$ /home/pi/mjpg-streamer/mjpg-streamer-experimental/mjpg_streamer -o "/home/pi/mjpg-streamer/mjpg-streamer-experimental/output_http.so -w ./www" -i "input_raspicam.so -fps 25 -x 320 -y 240 -sh 50 -ISO 800 -awb tungsten -ifx film -cfx 128:128"

For all options see mjpg-streamer and camera documentations.

View in browser, vlc, mpv,... by visiting the URL: http://:8080/?action=stream

screen-shot-2017-11-28-at-04.52.25