Streaming box

  • Youtube, Livestream, Raspberry pi, Fun

Simple streaming with raspberry pi.

Autostartscript startlivestreaming.sh

#!/bin/sh

# Start Youtube LiveStream
raspivid -o - -t 0 -vf -hf -fps 30 -b 6000000 |
	ffmpeg -re -ar 44100 -ac 2 -acodec pcm_s16le -f s16le -ac 2 -i /dev/zero -f h264 -i - -vcodec copy -acodec aac -ab 128k -g 50 -strict experimental -f flv
	rtmp://a.rtmp.youtube.com/live2/[your-secret-live-streaming-id]

# -b Bitrate
# -fps Framerate
# more help: "raspivid —help" and "ffmpeg —help"

			
# /etc/rc.local are run when startup from raspbery pi is complete.
$ sudo nano /etc/rc.local

# Startyoutube Livestream
/home/pi/startLiveStreamSC.sh

exit 0

			

Configure your WLAN

$ ifconfig -a

wlan0    Link encap:Ethernet  Hardware Adresse [your:mac:address]
         UP BROADCAST MULTICAST  MTU:1500  Metrik:1
         RX packets:0 errors:0 dropped:0 overruns:0 frame:0
         TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
         Kollisionen:0 Sendewarteschlangenlänge:1000
         RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

			
$ sudo nano  etc/network/interfaces

auto wlan0
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ap-scan 1
wpa-scan-ssid 1
wpa-ssid "[your-wifi-ssid]"
wpa-psk "[your-wifi-super-secred-password]"

# start networkscan
$ sudo wpa_cli scan && sleep 5 && sudo wpa_cli scan_results

			

Compile ffmpeg for raspbery pi (optional) you find more informations here: https://trac.ffmpeg.org/wiki/CompilationGuide/RaspberryPi.

$ git clone git://source.ffmpeg.org/ffmpeg.git
$ cd ffmpeg
$ ./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libmp3lame
$ make -j$(nproc) && make install