After much chasing, and testing, I have found this to be an efficient way of getting low latency high quality HD video out of an Aircraft. The latency is around 0.4 seconds at worst which would be OK for an FPV with an APM doing the hard work.
I will continue to search for methods to drop the latency down further, but this is a lot better than the 6-12 seconds I was getting on my first attempts.
Any comment (with useful instructions) would be appreciated.
For the wireless link, I am using two UBIQUITY ROCKET M 900 with Australian ACMA approved firmware, at the base station, I am using a tracking (yet to built the tracker...) 1.5 meter long X and Y polarised Yagi, and on the plane, two RF Design flexible strip antennas, placed at right angles to each other.
but how you do that bit is up to you.....
the critical bit is getting the Raspberry Pi's to chat to each other.
I have tried to make this as user friendly as possible... good luck.
Setting up IP video for Raspberry Pi 1080p video (FPV)
You will need 2 B model Raspberry Pi's and 1 Pi Camera. (Element 14, or RS components)
Preparing your Raspberry Pi for first boot…
Follow the instructions at http://www.raspberrypi.org/wp-content/uploads/2012/04/quick-start-guide-v2_1.pdf
Install the prepared SD card in the Pi and boot.
Setting up your Pi
Connect the Pi to your router with a network cable.
On Start-up it will resize the FAT partition and present you with a menu.
Set your language, and keyboard layout.
Select Raspbian… then click install.
After this has extracted (will take a while….) it will reboot into the configuration screen (again will take a while for this first boot.)
The important things to change here are
- Enable the camera
- In advance options…..
- Set the host name (camera, for the camera end, receiver, for the viewing end)
- Memory split, set the memory for the GPU to 256
- Enable SSH ( will come in handy later, as you may need to talk to the Pi in the air.....
Then finish and reboot.
First login
Username: pi
Password: raspberry
Setting up the required programs for video streaming
Install the dependencies by running the following in a terminal:
sudo apt-get install mplayer netcat
cd /opt/vc/src/hello_pi
make –C libs/ilclient
make –C libs/vgfont
cd /opt/vc/src/hello_pi/hello_video
make
cd ~
Now repeat this for the other Pi….
Streaming…
First set up the receiver….
Ensure the receiver is connected to your network and run
ifconfig
after you press enter, you can find your ip Address. Note this down.
Then run the following.
mkfifo buffer
nc -p 5001 -l > buffer | /opt/vc/src/hello_pi/hello_video/hello_video.bin buffer
the Pi will now wait for the feed.
On the Camera Pi
Ensure camera is connected to the Pi
Ensure Pi is connected to the network (you can confirm this with ifconfig)
(see instructions at http://www.raspberrypi.org/camera for how to connect the camera)
In the following command, replace the ip address with the one you just noted down.
raspivid -t 0 -fps 15 -o - | nc 192.168.1.85 5001
if all goes well you should be streaming 1080P video at 15fps with less than 0.5seconds of delay..
now add your wireless bridge between the two, and away you go J
This information has come from the Raspberry Pi foundation website, and other sources, tested and proven by myself..
Comments
@Patrick when this thread started I also went out and got myself the RPI and Pi Camera but I have everything working now streaming at UDP (tcp is way too lagy) and I got my 3g dongle up and running and streaming thru the vpn (works awesome) now I want to connect my telemetry thru it but there is no clear way of doing it, there was a guy on this thread who did it but he did not use a level converter putting his 5v directly on the 3v which he says it works fine but with my luck I just might burn something. And another guy on youtube which I have pasted the video here but he does not explain his wiring just the setup and I am after the wiring.
When this is done I want to do a failover if the 3g is gone try to connect via the 3DR module but that is another ball game on its own.
Thanks for sharing Gary. I'm going to work on getting gstreamer setup on my windows machine tomorrow. Had you made any attempts to stream from pi to pi via gstreamer, or only pi to your windows machine?
I'm going to give your method a run tomorrow evening if I can get an hour or two to myself. I'll keep you posted.
Thanks again!
Best speeds from me so far.
More to follow.
Prepare Pi. I used wheezy.
sudo echo 1 > /proc/sys/net/ipv4/tcp_low_latency
sudo sed -i 's/defaults,noatime/defaults,noatime,nodiratime/g' /etc/fstab
sudo echo "net.ipv6.conf.all.disable_ipv6=1" > /etc/sysctl.d/disableipv6.conf
echo 'blacklist ipv6' >> /etc/modprobe.d/blacklist
sed -i '/::/s%^%#%g' /etc/hosts
echo -e "arm_freq=800\nsdram_freq=450\ncore_freq=350\nforce_turbo=1" >> /boot/config.txt
sed -i 's/deadline/noop/g' /boot/cmdline.txt
reboot
Then my gstreamer -
On windows -
gst-launch-1.0 -e -vvvv udpsrc port=5001 ! application/x-rtp, payload=96 ! rtpjitterbuffer ! rtph264depay ! avdec_h264 ! queue ! autovideosink
On pi -
raspivid -t 999999 -h 1080 -w 1920 -fps 25 -hf -b 5000000 -o - |gst-launch-1.0 -e -vvvv fdsrc ! h264parse ! rtph264pay pt=96 config-interval=5 ! udpsink host=192.168.101.50 port=5001 sync=false
We need to keep this thread going! Got me interested enough that I grabbed a couple of RPI's and the Pi Camera. Everything hit my door last Friday, and within 4 hours I had the two Pi's up and running with streaming video using Mplayer and Netcat per the OP over wifi with less than 300ms latency (40' between camera pi and reciever pi direct connected to router), and that was with some cheap wifi dongle I had sitting in a drawer from a a couple of years back... With both Pi's connected via ethernet I was able to stay right around 150ms to 200ms with consistency.
Working now on a lonish range wifi setup with a ubiquiti bullet m5 on the quad and a nonostation on the ground. Hopefully can keep wifi latency in check and come up with a streaming method with a little lower latency, gstreamer maybe?? Ive got gstreamer working on the Pi camera side, but havent got it working on the pi reciever side; anyone had any luck with RPI to RPI with gstreamer? I get an error on the reciever side regarding rtph264 not being valid or something to that effect; any ideas? I'm sitting at my office so cant get the specifics...
The thought of HD FPV has me going, going enough that this is my first post to DIY Drones after a couple of years of stalking the forums.. Thanks in advance for any help with this.
Hope to get this up and running before my Sony HMZ T3 wireless HD goggles show which is supposed to be around the 27th... Figured I would dive in to the idea of HD FPV headfirst!
@SaadTiwana: If you want to do TI chipset development on the cheap, use the Pandaboards. http://pandaboard.org/content/resources/references
Hi Tommy,
I have a DM368 EVM kit (or a part of it) on loan from a buddy who got it from his university. Sad part is, it's really expensive http://www.ti.com/tool/tmdxevm368 (for me atleast). The encoder is TVP7002, i think..again from TI, on the same board. I don't have the LCD or the camera shown in the kit. Just the bare board. And I'll have to return this kit eventually :(
There are some nice kits from Z3 technolgies available, but they're expensive also (no surprise). I'm trying to find something cheaper. Wish me luck with that.
Thanks for the gstreamer script. If i'm not wrong, that's the script for the transmitting side. I am having issues on the receiving side...could you guide me on that please? I spent the better part of last 2 days with that, and it's killing me by now.
Also, the software you sent didnt execute "Not a valid win32 application". I'm still on windows xp, 32 bit. is the application for 64 bit? Or do i need to copy the dlls somewhere else?
Regards, Saad
@SaadTiwana: What kind of "analog-to-digital converter" do you use??
And do you have a link to the "TI DM368" also ?
Here is a simple software to measure the latency. Just point the camera on the screen and se the difference in time by taking a picture of the screen and monitor at the same time.
https://www.dropbox.com/s/hzhlscn069rtx9i/millisecond-timer-softwar...
I got Gstreamer working very good :) Do you have a link to the "TI DM368" ?
https://www.dropbox.com/s/pzt7qlzejef1uoh/gss.sh
Guys,
I have been trying to stream HD video using DM368 for the last few days, and got it working over wireless today. My setup was: GoPro Hero (HD component out) -> analog-to-digital converter -> TI DM368 (conversion to H.264 and send using TCP/IP) -> wifi-> wifi-> Macbook Pro. End-to-end to delay was less than 500ms (including the delay in GoPro livefeed)
However, so far i got it to work using tcp/ip, which obviously has its problems. I have been trying to use RTCP/UDP, but couldn't get the gstreamer pipelines configured correctly. Has anyone had any luck with that?
Also, did anyone find a good (and convenient) way of measuring the end-to-end latency? (or intermediate even)
Regards,
Saad