How to live stream on Steem using a Raspberry Pi Zero W

in hackerspace •  7 years ago  (edited)

We'd love to stream some of the activity from our hackerspace to Steem but we need to see if we could do it from a Raspberry Pi Zero W as we have a few spare with raspicam's attached and don't really want to buy any specialised hardware to achieve this. Here is how we got it to work:

Install ffmpeg

Install ffmpeg to do the streaming and you should build it to make use of the hardware capabilities of the Raspberry Pi's (which have some h264 hardware available):

$ sudo apt-get install build-essential
$ git clone https://github.com/FFmpeg/FFmpeg.git
$ cd FFmpeg
$ ./configure --arch=armel --target-os=linux --enable-gpl \
  --enable-omx --enable-omx-rpi --enable-nonfree
$ make -j2
[ ... wait a few hours ... ]
$ sudo make install

Stream to dlive.io

Visit dlive, login and then click Go Live. Fill in the required fields (image, title,description, etc.) and you will need to use the values in the lower right to build your rtmp URL. Your rtmp URL is created as such:

rtmp://[USERNAME]:[PASSWORD]@[SERVER URL]:1935/[STREAM NAME/KEY]

Now click next to compose your steem post, click next again and on the following screen you can then start the stream (by clicking start) and once you are at this point you can run the command to start streaming:

And the command you will want to run to start broadcasting is:

raspivid -o - -t 0 -fps 25 -w 1280 -h 720 -b 3000000 | \
  ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 \
  -i /dev/zero -f h264 -thread_queue_size 512 -i - -vcodec copy \
  -acodec aac -ab 128k -g 50 -strict experimental -f flv \
  rtmp://[USERNAME]:[PASSWORD]@[SERVER URL]:1935/[STREAM NAME/KEY]

This doesn't send any audio but as we're using a Pi Zero it doesn't have any easy way to bring in audio. We'll leave that until we need audio :)

How does it perform?

Pretty good. Streaming on a Pi Zero W hovers around 50% CPU utilisation with the settings above. You can tweak the -fps and -b (bandwidth) settings depending on your internet connection. We're still tweaking things but this will at least get you up and running as much as we have, be sure and let us know if you can improve it! We're here to learn (and teach :))

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  7 years ago (edited)

Hay @hackerspace,
want to set up a similar thingy :) nice guide!

But how do i find the [SERVER URL] ?