Introduction: Datarhei/Restreamer - Setup Ip Raspicam for Livestreaming

About: Datarhei/Restreamer offers smart free video streaming in real time. Stream H264 video of IP cameras live to your website with our open source software for free

In this Instructables we show how to setup your Raspicam with a Raspberry Pi 1 and Pi 2. As a result you will get your Raspicam streaming HLS in a HTML5 video player ready to embed on your website!

The main steps are

  1. Setup your Raspicam
  2. Stop running Datarhei/Restreamer
  3. Start Restreamer with new variables to start streaming

To prepare for the next steps be sure you are ready to rock...

Software

  1. Running Datarhei/Restreamer (if you need to install take a look at our other Instructables)
  2. (Optional) If you want to dive deeper and play with your Raspicam eg. change resolution or framerate of the Raspicam - has nothing to do with Datarhei/Restreamer but is nice to get control over your videostream!
    1. RaspiVid
    2. RaspiStill

Hardware

  1. Raspberry Pi 1 (ARMv6l) or Raspberry Pi 2 (ARMv7l)
  2. Raspberry Pi camera board (Raspicam)

And log in to your Device with SSH!

How to connect the Raspicam with your Raspberry Pi is shown in the following YouTube Video by TheRaspberryPiGuy. If you like what TheRaspberryPiGuy is doing follow him on Twitter or YouTube as a minimum of thanks for his great work https://twitter.com/RaspberryPiGuy1

For the latest up to date documentation on Datarhei/Restreamer take a look in our Docs on GitHub.

We have some more step by step Instructables ready:

  1. Datarhei/Restreamer - Installation OSX and Windows with Docker Toolbox (Kitematic)
  2. Prepare memory card with HypriotOS for Datarhei/Restreamer on Raspberry Pi1 & Pi2 with Microsoft Windows
  3. Datarhei/Restreamer - Setup your IP camera for livestreaming
  4. Datarhei/Restreamer - Changing Port, Username, Password and Snapshot Interval
  5. How to update Datarhei/Restreamer on Raspberry Pi 1/2 (video tutorial)

Ok, lets rock!

(Sven)

-------

Want to talk to us? Email to open@datarhei.org. You could choose a nickname speak to us in IRC: irc.freenode.net/#datarhei or (Webchat). You could ask a question in our Forum, too. If you're having a problem while developing, see Known Issues. If you want just keep in touch follow us on Twitter: https://twitter.com/datarhei

Step 1: First Step Just for HypriotOS Users

The Hypriot-Image has no # raspi-config to activate the Rasbperry Pi camera board.

You have to install this first:

# cd /tmp<br># apt-get update && apt-get install -y alsa-utils <br># wget <a href="http://archive.raspberrypi.org/debian/pool/main/r/raspi-config/raspi-config_20160108_all.deb" rel="nofollow">http://archive.raspberrypi.org/debian/pool/main/r/...</a><br># dpkg -i raspi-config_20160108_all.deb

Source here!

Thats it now you have raspi-config on HypriotOS!

Go to next step to activate your Raspicam with # raspi-config

For those getting in trouble installing raspi-config take a look at our How2 video on YouTube:

Step 2: Acitvate Raspicam With Raspi-config

Setup and activate your Raspicam with the command:

# raspi-config

As result you get a minimal user interface: navigate with the cursor arrows down and up - execute with Enter

"Enable Camera" 
"Finished" 
# reboot


If you have activated your Raspicam with raspi-config go to the next step >>

Step 3: Login With SSH and Stop the Running Docker Images

In the Example the port for the Restreamer UI is changed to 1337.

1. Login your Raspberry Pi with SSH connection

For HypriotOS users Username: # root Password: # hypriot

2. Show the running Docker images with the command:

# docker ps

3. Stop the running Datarhei/Restreamer with the name of the running image (it should be "restreamer").

# docker stop restreamer && docker rm restreamer

4. Check if the Restreamer image is not running again with:

#docker ps

5. If the docker container is still running kill it the hard way with (Always try to stop before killing!)

# docker kill restreamer && docker rm restreamer

Now the Restreamer image is not running anymore and you could switch to the next step >>

Step 4: Start With Raspicam

Now start the Datarhei/Restreamer with the Raspicam. It is one variable you have to add to the normal start command:

- e "MODE=RASPICAM"

Don´t forget if you have more modfications in your start command for Snapshot interval, own User:Pass or changed UI Port to put these commands ontop. This example ist with default variables!

So the complete command looks like this for:

Raspberry Pi 1 (ARMv6l)

# docker run -d --name restreamer --restart always -e "RESTREAMER_USERNAME=YOUR-USERNAME" -e "RESTREAMER_PASSWORD=YOUR-PASSWORD" -e "MODE=RASPICAM" -p 8080:8080 -v /mnt/restreamer/db:/restreamer/db -v /opt/vc:/opt/vc --privileged datarhei/restreamer-armv6l:latest

Raspberry Pi 2 ARMv7l

# docker run -d --name restreamer --restart always -e "RESTREAMER_USERNAME=YOUR-USERNAME" -e "RESTREAMER_PASSWORD=YOUR-PASSWORD" -e "MODE=RASPICAM" -p 8080:8080 -v /mnt/restreamer/db:/restreamer/db -v /opt/vc:/opt/vc --privileged datarhei/restreamer-armv7l:latest

How easy was that! Go to next step to check if your camera is working >>

Step 5: Add Raspicam As Video Source to Restreamer

This is the last step.

Put the rtmp address into the "RTMP/RTSP Video Source" field in the Restreamer UI.

rtmp://127.0.0.1/live/raspicam.stream

click onto:

start

The stream starts and the field becomes green!

Click on "Open Player" to take a look at your Videostream.

Congratulations - Thats it - Keep on streaming!

Next step try playing around with raspivid or raspistill to configurate your videostream. Tons of documents could be found in the www... Have fun!

Step 6:

Step 7: