Whats your fpv streamer?

I made this batch file to help me launch GStreamer on Windows 8.1:

C:\GStreamer\1.0\x86_64\bin\gst-launch-1.0 -v udpsrc port=9000 caps="application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264" ! rtph264depay ! avdec_h264 ! videoconvert ! autovideosink sync=f

Then on the Pi two scripts, one to GStream to a local address, then another to broadcast from that address via UDP:

Camera Stream.sh

printf "Starting GStreamer camera stream...\n"
killall raspivid
raspivid -n -w 1280 -h 720 -b 1000000 -fps 15 -t 0 -o - | \
   gst-launch-1.0 -v \
   fdsrc !  \
   h264parse ! \
   rtph264pay config-interval=10 pt=96 ! \
udpsink host=127.0.0.1 port=9000 \
    > /home/pi/Camera\ Stream.log &

Broadcast.sh

printf "Starting broadcast...\n"
sudo killall socat
sudo socat UDP4-LISTEN:14550,fork UDP4-DATAGRAM:192.168.74.255:14550,broadcast,range=192.168.74.0/255 &
sudo socat UDP4-LISTEN:9000,fork UDP4-DATAGRAM:192.168.74.255:9000,broadcast,range=192.168.74.0/255 &

You’ll notice I also redirect another port (14550), that’s for APM. My APM start script is:

APM Start.sh

#!/bin/sh
printf "Starting APM for Navio+...\n"
sudo killall ArduCopter-quad
sudo ArduCopter-quad -A udp:127.0.0.1:14550 > /home/pi/APM\ Start.log &

This way, everything is broadcast and point-to-point connections are avoided. People reported problems with point to point connections when going in/out of network range. I still have to do range testing, but this seems pretty logical to me.

Hope that helps!

p.s. credit for the redirect idea goes to somebody on this forum (sorry I forgot the username). If you search on “socat” in this forum you should find more background information on this solution.

3 Likes