Streaming with Raspberry Pi Camera

Area for discussing streaming over the Internet, especially as it relates to ATV
Forum rules
This forum is run by the BATC (British Amateur Television Club), it is service made freely available to all interested parties, please do not abuse this privilege.

Thank you
Post Reply
G4KLB
Posts: 244
Joined: Wed May 28, 2008 10:46 am

Streaming with Raspberry Pi Camera

Post by G4KLB » Fri May 24, 2013 8:00 pm

I have been playing with the new Raspberry Pi camera module and attempting to stream the output to my BATC Member stream.
I have found the following works, but I'm sure it could be improved to give better quality.


Stream from Raspberry Pie camera

On the Pi, do:
apt-get update
apt-get install avconv

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 -fps 20 -w 352 -h 288 -hf -t 10000000 -b 500000 -o fifo.264 &

Now create another script called camera_avconv.sh

avconv -f h264 -r 25 -i fifo.264 -metadata title="Raspberry Pi Camera Module (LIVE)" -f flv rtmp://fms.batc.tv/live/XXXXX/XXXXX

XXXXX is your stream name
note : the forum post will make rtmp:/ etc look like a link, but its a continuation of the text.
You probably don't need -metadata title="Raspberry Pi Camera Module (LIVE)"
I just cut and paste from what I have working :D

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_avconv.sh


Try different values for –w and –H and –b
Eg /opt/vc/bin/raspivid -fps 20 -w 640 -h 480 -hf -t 10000000 -b 600000 -o fifo.264 &
See how you get on

When you have improved it please post your results here. :D

I started with ffmpeg but didn't manage to connect to the stream.

73
Colin G4KLB :D
Last edited by G4KLB on Fri May 24, 2013 8:11 pm, edited 2 times in total.

shooding
Posts: 1
Joined: Tue Dec 10, 2013 7:31 am

Re: Streaming with Raspberry Pi Camera

Post by shooding » Tue Dec 10, 2013 7:37 am

It works indeed!
I noticed that fps is much less than expected, so I tried to modify camera_avconv.sh and using '-vcodec copy' to save Pi from re-encoding.
However the bitrate becomes zero.
Any ideas?

Post Reply

Return to “Streaming”