With any luck you should be able to see the live view from my window here:
http://newstream.hexten.net/picaster/
That's a 900kb/s 720p encode served using HLS. Setup is:
Pi Model B
Pi camera
mounted in a "high top" Pibow case (Pibow + longer screws + spacers + camera mounted on top plate)
Edimax Wifi dongle.
That's on my home broadband and is exposed to the internet on an IPv6 address.
Then there's a hosted box in Germany running a Varnish cache with this config:
Code: Select all
backend default {
.host = "INSERT PI'S ADDRESS HERE";
.port = "80";
}
sub vcl_fetch {
if (req.url ~ "\.m3u8$") {
set beresp.ttl = 2s;
}
if (req.url ~ "\.ts$") {
set beresp.ttl = 1d;
}
}
The Pi is running a patched version of raspivid that allows the intra period to be set on the command line. Here's the patch. James accepted the patch so I guess it'll make it into a release fairly soon.
Here's the script the Pi's running:
Code: Select all
#!/bin/bash
base="/var/www"
stamp=$( date +%Y%m%d-%H%M%S )
session="live-$stamp"
fifo="live.fifo.h264"
set -x
# bootstrap
for f in www/*; do
d="$base/$( basename "$f" )"
[ -e "$d" ] || cp "$f" "$d"
done
mkdir -p "$session"
rm -f "$base/live" "live"
ln -s "$PWD/$session" "live"
ln -s "$PWD/$session" "$base/live"
rm -f "$fifo"
mkfifo "$fifo"
# cleanup
{
while sleep 60; do
find "$session" -type f -name '*.ts' -mmin +240 -print0 | xargs -r -0 rm
done
} &
raspivid \
-w 1280 -h 720 -fps 25 -g 100 \
-t 0 -b 900000 -o - | psips > "$fifo" &
ffmpeg -y \
-f h264 \
-i "$fifo" \
-c:v copy \
-map 0:0 \
-f segment \
-segment_time 4 \
-segment_format mpegts \
-segment_list "$base/live.m3u8" \
-segment_list_size 1800 \
-segment_list_flags live \
-segment_list_type m3u8 \
"live/%08d.ts" < /dev/null
# vim:ts=2:sw=2:sts=2:et:ft=sh
I'm hoping to be able to push the bit rate up once BT upgrade my broadband this week.