Streaming live with the #RaspberryPi camera module to Bambuser

With the release of the camera module to a wider audience, I thought I’d share some of things I’ve learnt. To start off, here’s some information about using the camera with Bambuser.com.

This is in part taken from Marcus Olsson’s blog post about streaming with a webcam.

First of all, register on bambuser.com. Then, go to https://bambuser.com/api/keys and get your RTMP url and stream ID.

On the Pi, do:

apt-get update
apt-get install avconv

If this doesn’t work (it didn’t for me, like it’s disappeared from the repository), do:

apt-get install ffmpeg

On the Pi, create the following in a script called camera_mkfifo.sh:

rm fifo.264
mkfifo fifo.264

(When you run this script first of all you’ll get an error message because the file doesn’t exist, but just ignore it).

Now create another script called camera_output.sh:

/opt/vc/bin/raspivid -o fifo.264 -w 400 -h 300 -t 10000000 -b 500000 &

Now create another script called camera_bambuser.sh

avconv -f h264 -r 25 -i fifo.264 -metadata title="Raspberry Pi Camera Module (LIVE)" -f flv rtmp://<RTMP URL>/<RTMP KEY>

If you’re using ffmpeg, change the “avconv” to “ffmpeg”.

Now, do:

chmod +x camera*.sh

This will make the scripts executable.

Now, just run the three scripts in order:

./camera_mkfifo.sh
./camera_output.sh
./camera_bambuser.sh

You should now be broadcasting LIVE. My stream, should anyone want to see it (and if it’s actually streaming) is at http://bambuser.com/channel/recantha

Please bear in mind that the resolution isn’t all that good. This is to get the frames-per-second up. If you increase the width and height of the video being created using raspivid, it will reduce the fps with an increase in quality.

8 comments for “Streaming live with the #RaspberryPi camera module to Bambuser

  1. Thanks for this 🙂 The avconv is now in the libav-tools package (sudo aptitude install libav-tools), it’s replaced the old ffmpeg package..

  2. Thanks for this tutorial.
    Is it possible to use V4L2 driver for the Raspberry Pi Camera Module to stream to bambuser?
    If yes, would the quality and fps be better?

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.