iizukanao / picam-streamer

Out-of-the-box SD card image for live streaming with Raspberry Pi
MIT License
62 stars 6 forks source link

Out-of-the-box SD card image for live streaming with Raspberry Pi. It's easy as pie.

Screenshot

How to use

  1. Connect Raspberry Pi Camera Module (and optionally a USB microphone) to a Raspberry Pi.
  2. Download the SD card image from http://s.kyu-mu.net/picam-streamer-latest/. This image is based on Raspberry Pi OS (32-bit) Lite version 2020-05-27.
  3. Write the downloaded image to an SD card. Optionally, mount the image and create /boot/ssh empty file in order to automatically start SSH server on next boot.
  4. Boot the Raspberry Pi. SSH server will automatically start. If you want to disable SSH server, please do so via sudo raspi-config.
  5. Find out the Raspberry Pi's IP address. If you don't know how to find out the IP address, login to the Raspberry Pi with username pi and password raspberry, then run ip a command. To disable SSH server, run raspi-config and go to "Interfacing Options" > "SSH" menu.
  6. Open http://*RASPI_IP*/view/ with Flash Player-enabled browser. Replace RASPI_IP with the Raspberry Pi's IP address. Alternatively, you can view the stream with VLC media player via rtsp://RASPI_IP:80/live/picam URL.
  7. If you use microphone, adjust microphone capture volume with alsamixer command. Press F6 to select your sound card, then press F4 to select "Capture" volume control. Use arrow keys to turn up or down the volume.

The expected latency of video is about a second. Also, please change your login password with passwd command.

Configuration

Audio/video capture configuration is defined in /home/pi/picam-streamer/lib/server.js as follows.

picam = child_process.spawn('nice', ['-n', '-20', 'ionice', '-c1', '-n0', 'sudo', '-u', "#" + PICAM_UID, PICAM_PATH, '--rtspout', '--alsadev', 'hw:1,0'], {

The arguments are the same as for picam. You can add arguments to the end like this:

picam = child_process.spawn('nice', ['-n', '-20', 'ionice', '-c1', '-n0', 'sudo', '-u', "#" + PICAM_UID, PICAM_PATH, '--rtspout', '--alsadev', 'hw:1,0', '--rotation', '180'], {

After changing the parameters, run sudo service picam-streamer restart and the new configuration will be used.

Disabling camera LED

Add disable_camera_led=1 to /boot/config.txt and reboot the Pi.

Components

The SD card image contains the following components.