I have had a 3DR Solo drone since last summer and have been looking for interesting ways to expand its capabilities. One thing that I thought should be possible is to stream live video from the drone while it’s in flight. The Solo controller has an HDMI port to push video to a monitor but I wanted to see if I could get to the video stream directly, through software. I’m proud to say that I figured out how to do it.
First you need a separate computer, preferably a laptop or something portable. The computer will need to connect to the WiFi network that the Solo controller creates. Once you’ve got your computer joined, make sure it’s connected by pinging the controller (IP address 10.1.1.1).
Next, create an SDP file on your laptop as discussed on the 3DR Solo wiki.
c=IN IP4 10.1.1.1
m=video 5600 RTP/AVP 96
… save this as sololink.sdp.
The controller will only stream video if it’s got a TCP connection from the host requesting a stream. In a terminal window, connect to the controller as follows:
telnet 10.1.1.1 5502
nc 10.1.1.1 5502
Now the controller should be able to stream video using a tool such as VLC or ffmpeg. For VLC, open the osololink.sdp file you created above. You should see the drone video appear on your laptop. VLC is nice for checking the video but I haven’t worked out how to send it to YouTube yet. I believe it does not properly handle the RTMP media format that YouTube needs, though I’m not sure of this.
FFMPEG, however, does handle RTMP and can video to YouTube. Through trial and error (with lots of help from blogger George Timmermans and blogger “Yatko”), I worked out the proper command line options:
ffmpeg -f lavfi -i anullsrc -i ~/Videos/sololink.sdp -tune zerolatency -s 432×320 -pix_fmt + -c:v libx264 -b:v 600K -c:a aac -strict experimental -f flv rtmp://a.rtmp.youtube.com/live2/xxxx-xxxx-xxxx-xxxx
… where xxxx-xxxx-xxxx-xxxx is the Stream Name/Key that can be found when you log into YouTube’s Live Dashboard and set up your stream (under Basic Info – Encoder Setup at the bottom of the page). It also helps to know what formats/resolutions YouTube expects.
There is probably some optimizing I can make to this ffmpeg command line. Also, I need to adjust it so I can see the video in real-time as it comes off the controller (perhaps a tee command).
One quirk of this method of streaming is that only one device gets the video at a time. Thus, if your laptop’s getting video, your smartphone/iPad mounted on the controller is not getting video. If the laptop is showing video and positioned near the remote pilot, however, the pilot can position the drone using the video like before.
Another addition I’m considering is to put a RTSP proxy of some sort on the controller. That way the video can be split to multiple devices at once. There’s also the possibility of running ffmpeg directly on the controller, but without Internet access for the controller what would be the point? A better solution would be an ffmpeg instance on the smartphone configured where the Solo app gets its video while ffmpeg streams it. To be continued!