Real-time HTTP/HTTPS Streaming Server with the native uv4l-server module
The uv4l-server module is a plug-in specific for UV4L which enables a per-camera Streaming Server that can be simultaneously accessed by any browser over HTTP or HTTPS protocols.
Among the other things, it offers a Web interface from which it’s possible to see the video stream in various ways and a Control Page allowing to fully control the camera settings while streaming with any Video4Linux application. Other than secure HTTPS protocol, basic authentication for both the normal and admin users is also supported.
To install the module simply follows the instructions provided here. That’s all. Next time you run uv4l, it will automatically load the plug-in and run the server.
All the URLs appearing in the below examples are based on the insecure HTTP protocol for simplicity, but the remember that the Streaming Server also supports secure HTTPS protocol if SSL is enabled (see the manual for more informations). In this case, to make the examples work it will be enough to replace http:// with https:// in the URLs.
By default the homepage of the server can be accessed at the following address: http://raspberrypi:8080 (where raspberrypi has to be replaced with the actual hostname or IP of the RaspberryPi in your network).
You do not necessarily need a browser to see the video streams. In the examples below we will be using VLC as an alternative application to display the video. From within VLC it’s possible to see, transcode and record into a file – at the same time – almost any kind of stream formats over HTTP/HTTPS.
If you want to directly get the MJPEG (Video) stream over HTTP from the server, type from the client:
client ~ $ cvlc http://raspberrypi:8080/stream/video.mjpeg
If you want to get the raw H264 stream over HTTP from the server, type:
client ~ $ cvlc http://raspberrypi:8080/stream/video.h264 --demux h264
If you want to get the same stream from more than one client simultaneously, remember to turn on the –inline-headers raspicam driver option before doing this.
If you want to get the JPEG stream (as continuous Stills) over HTTP from the server, type:
client ~ $ cvlc http://raspberrypi:8080/stream/video.jpeg
If you want to get a single snapshot in JPEG after a given delay specified in the URL (5 seconds in this example) and record it to a file, type:
client ~ $ wget http://raspberrypi:8080/stream/snapshot.jpeg?delay_s=5 -O snapshot.jpeg
If you want to password protect any stream from unauthenticated users, you can use the –user-password server option, as in the following example:
raspberrypi ~ $ uv4l --auto-video_nr --driver raspicam --encoding h264 --server-option '--user-password=myp4ssw0rd'
A proper HTTP client should now be able to authenticate the user from a standard URL in the form:
client ~ $ cvlc http://user:myp4ssw0rd@raspberrypi:8080/stream/video.h264 --demux h264
In case you do not want, for some reasons, enable the server when uv4l is run, you will have to explicitly pass the –enable-server off command line option, for example:
raspberrypi ~ $ uv4l --auto-video_nr --driver raspicam --enable-server off
As another example, the following will make the server listen to port 9000 (instead of the default one) and prompt the user for the specified ‘admin’ password when accessing the Control Page:
raspberrypi ~ $ uv4l --auto-video_nr --driver raspicam --encoding mjpeg --server-option '--port=9000' --server-option '--admin-password=myp4ssw0rd'