raspi-live is a Node.js Express webserver that takes streaming video from the Raspberry Pi Camera module and makes it available on the web via HLS or DASH.
Run it via a simple command line interface:
raspi-live start
The server will start serving the streaming files on /camera
. Point streaming video players to /camera/livestream.m3u8
for HLS or /camera/livestream.mpd
for DASH.
$ raspi-live --help
Usage: raspi-live [options] [command]
self-contained raspberry pi video streaming server
Options:
-v, --version output the version number
-h, --help output usage information
Commands:
start [options] start streaming video from the raspberry pi camera module
Output the version number.
Output information on how to use the command line interface.
Start streaming video from the raspberry pi camera module.
The directory used to host the streaming video files. Those concerned about the long-term health of their pi's SD card may opt to point raspi-live to a RAMDisk so that the files are only stored in memory. However, this also means that you will be unable to recover any of the footage if the power is cut.
Defaults to /home/<USERNAME>/camera
but /srv/camera
is recommended as raspi-live is a server.
Video resolution width.
Defaults to 1280
.
Video resolution height.
Defaults to 720
.
Number of video frames per second.
Defaults to 25
.
Flip the video horizontally.
Disabled by default.
Flip the video vertically.
Disabled by default.
Level the video is compressed for download via the internet. Value must be between 0
and 9
.
Defaults to 9
.
The number of streaming video files included in the playlist.
Defaults to 10
.
The number of streaming video files stored after they cycle out of the playlist. This is useful in cases where you want to look at previously recorded footage. The streaming video files are 2 seconds long so to have a 24-hour cycle of recorded video, specify 43200
(make sure to have enough storage space).
Defaults to 10
.
Port number the server runs on.
Defaults to 8080
.
raspi-live only supports streaming video from the Raspberry Pi camera module. Here's a the official documentation on how to connect and configure it: https://www.raspberrypi.org/documentation/usage/camera/.
raspi-live uses FFmpeg, a video conversion command-line utility, to process the streaming H.264 video that the Raspberry Pi camera module outputs. Here's how to install it on your Raspberry Pi:
- Download and configure FFmpeg via:
sudo apt-get install libomxil-bellagio-dev
wget -O ffmpeg.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot-git.tar.bz2
tar xvjf ffmpeg.tar.bz2
cd ffmpeg
sudo ./configure --arch=armel --target-os=linux --enable-gpl --enable-omx --enable-omx-rpi --enable-nonfree
- If you're working with a Raspbery Pi 2 or 3, then run
sudo make -j4
to build FFmpeg. If you're working with a Raspberry Pi Zero, then runsudo make
. - Install FFmpeg via
sudo make install
regardless of the model of your Raspberry Pi. - Delete the FFmpeg directory and tar file that were created during the download process in Step 1. FFmpeg has been installed so they are no longer needed.
Install it globally:
npm install raspi-live -g
raspi-live --help
Or use npx:
npx raspi-live --help
raspi-live is only concerned with streaming video from the camera module and does not offer a playback solution.
Browser support between the different streaming formats varies so in most cases a JavaScript playback library will be necessary. For more information on this, check out Mozilla's article on the subject.