|How to install or upgrade UV4L on Raspbian (for the Raspberry Pi)|
As the following installation instructions are updated and improved very frequently, it is suggested to read them from scratch in case of problems and especially whenever a new UV4L module is announced.
UV4L consists of a series of drivers, a Streaming Server and various extensions for the server. Below we will see how to install all the components to get the best from UV4L, with focus on the Raspberry Pi (Dual) Camera Board driver in particular, although all other drivers can be installed similarly.
To install UV4L open a terminal and type the following commands:
$ curl http://www.linux-projects.org/listing/uv4l_repo/lrkey.asc | sudo apt-key add -Add the following line to the file /etc/apt/sources.list :
deb http://www.linux-projects.org/listing/uv4l_repo/raspbian/ wheezy mainThe last two commands will upgrade UV4L to the most recent version, if it's already installed.
If you want the driver to be loaded at boot, also install this optional package:
$ sudo apt-get install uv4l-raspicam-extrasAs a convenience, the above package will also provide a service script for starting or stopping the driver at any time:
$ sudo service uv4l_raspicam restartWhen (re)starting the service, uv4l will be instructed to parse the configuration file /etc/uv4l/uv4l-raspicam.conf to get the default values for the (main) driver options. You can edit that file as you prefer to add, remove or change the default options. The same service is used at boot.
Now the UV4L core component and the Video4Linux2 driver for the CSI Camera Board are installed. If you occasionally get unexpected errors from the driver, make sure the Camera is enabled and enough memory is reserved for the GPU (not less than 128MB is suggested) from the below menu:
$ sudo raspi-configAlso consider updating the firmware with the following command:
$ sudo rpi-updateFor detailed informations, options, etc... about the modules installed type accordingly:
$ uv4l --help --driver raspicam --driver-helpIf you did not install the optional uv4l-raspicam-extras package (which already contains a script for starting uv4l with the settings taken from a configuration file) but want to quicly test uv4l, load it manually:
$ uv4l --driver raspicam --auto-video_nr --width 640 --height 480 --encoding jpegand take a JPEG snapshot from the Camera:
$ dd if=/dev/video0 of=snapshot.jpeg bs=11M count=1For a list of other use cases click here.
To terminate a running driver, close the applications and kill the corresponding uv4l process:
$ pkill uv4lApart from the driver for the Raspberry Pi Camera Board, the following Streaming Server front-end and drivers can be optionally installed:
$ sudo apt-get install uv4l-serverfor which the manual pages are available:
$ sudo apt-get install uv4l-webrtcOnce you have installed the HTTP Streaming Server module, make sure to reload uv4l for it to notice and start the server. Afterwards you can access the server with the browser at the default address and port http://raspberry:8080/ (where raspberry has to be replaced with the actual hostname or IP address of your RaspberryPi).
Thanks to the WebRTC extension mentioned above, it's also possible to broadcast both live audio and video contents from the Raspberry Pi 2 to all the participants or viewers joining a room of a Jitsi Meet Conference on the Web. Furthermore, no browser and no GUI will have to be used on the Raspberry Pi. For this to be possible, it's necessary to install the additional xmpp-bridge service, which will be automatically started once the installation has finished or when the system boots:
$ sudo apt-get install uv4l-xmpp-bridgeNote: by default WebRTC gets the audio stream from the default installed soundcard, which generally is the first indexed card shown by arecord -l. If you want to make use of an USB soundcard by default, edit /etc/modprobe.d/alsa-base.conf and modify or add the following lines and reboot the system:
options snd-usb-audio index=0After you have rebooted, make sure capture volumes are unmuted and increased to the desired level. alsamixer is an handful tool for this purpose.
|[ Back to UV4L, Userspace Video4Linux framework | Return to Sections Index | ]|