Page 1 of 1

Streaming with Raspberry Pi Camera

Posted: Fri May 24, 2013 8:00 pm
by G4KLB
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

Re: Streaming with Raspberry Pi Camera

Posted: Tue Dec 10, 2013 7:37 am
by shooding
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?