charleslinquist
Posts: 112
Joined: Wed Sep 05, 2012 12:43 pm

4G video/telemetry from drone

Sat Jan 07, 2017 12:04 am

I build and fly multirotor drones. I have a Verizon 4G "dongle" connected to a RPi 3 as well as the V2 camera (8MP). I'm sending live video from the craft to the ground over the 4G link while simultaneously receiving telemetry and sending control information back to it (at 57.6Kbaud). I'm using UV4L for the video stream and MJPEG for the compression. The setup has (in some cases) nearly unlimited range, but my frame rate with 720X480 resolution is not that great (2-8 frames/sec). I would like to improve that. I'm thinking that if I could send less data (more compression) I could improve the frame rate.

I'm using a Novatel USB551 modem and the datasheet says it has an upload speed of "2-5Mbits/sec".
The low compression rate is causing me to spend too much for my 2 data plans (one for the drone -> Verizon and the other for Verizon -> Laptop).

Can anyone give me an idea on the best setup to get high frame rates (10-30fps) at - say 720X480 resolution from the Raspberry camera and send it over 4G? I know that the Raspberry isn't a powerhouse when it comes to encoding, but I need to improve my setup. I would be willing to change to another processor board if that would help.

RpiName
Posts: 712
Joined: Sat Jul 06, 2013 3:14 am

Re: 4G video/telemetry from drone

Sat Jan 07, 2017 1:04 am

charleslinquist wrote:Can anyone give me an idea on the best setup to get high frame rates (10-30fps) at - say 720X480 resolution from the Raspberry camera and send it over 4G? I know that the Raspberry isn't a powerhouse when it comes to encoding, but I need to improve my setup. I would be willing to change to another processor board if that would help.
Use UV4L, with WebRTC, not with MJPEG. You can easily get 30fps HD over 4G with ~200ms delay. The video bitrate with WebRTC is adapative to the available bandwidth.

charleslinquist
Posts: 112
Joined: Wed Sep 05, 2012 12:43 pm

Re: 4G video/telemetry from drone

Sat Jan 07, 2017 11:50 pm

Thanks! But I'm having a bit of trouble getting webRTC configured.
I would prefer not to use SSH for the time being - simply because I believe I need to start 'simple'.

I invoke uv4l with the string
sudo uv4l -nopreview --auto-video_nr --driver raspicam --encoding mjpeg --width 640 --height 480 --framerate 60 --server-option '--port=9090' --server-option '--max-queued-connections=30' --server-option '--max-streams=25' --server-option '--max-threads=29'

I have modified /etc/uv4l/uv4l-raspicam.conf as follows:

##################################
# raspicam driver options
##################################

encoding = h264 <--- changed from mjpeg
# width = 640
# height = 480
framerate = 30

and

h264 options -
bitrate = 25000000 <- - changed from 17000000

and

WebRTC options -
server-option = --enable-webrtc=yes
server-option = --enable-webrtc-datachannels=yes
server-option = --webrtc-datachannel-label=uv4l
server-option = --webrtc-datachannel-socket=/tmp/uv4l.socket
server-option = --enable-webrtc-video=yes

(all the above were commented out)

--------------------------------------------------------------------------------------------------------------------------------

But - on my PC, when I click on WebRTC on the webserver page, I just get the msg that some browsers do not support the non-encrypted version and a blank pane. I tried both Chrome and EDGE. Neither one works. Must I use SSH? What other things should I do? I'm trying to view using Win10.

Nolaan
Posts: 57
Joined: Thu Jul 10, 2014 6:35 pm
Contact: Website

Re: 4G video/telemetry from drone

Wed Jan 11, 2017 11:17 pm

charleslinquist wrote:Thanks! But I'm having a bit of trouble getting webRTC configured.
I would prefer not to use SSH for the time being - simply because I believe I need to start 'simple'.

I invoke uv4l with the string
sudo uv4l -nopreview --auto-video_nr --driver raspicam --encoding mjpeg --width 640 --height 480 --framerate 60 --server-option '--port=9090' --server-option '--max-queued-connections=30' --server-option '--max-streams=25' --server-option '--max-threads=29'

I have modified /etc/uv4l/uv4l-raspicam.conf as follows:

##################################
# raspicam driver options
##################################

encoding = h264 <--- changed from mjpeg
# width = 640
# height = 480
framerate = 30

and

h264 options -
bitrate = 25000000 <- - changed from 17000000

and

WebRTC options -
server-option = --enable-webrtc=yes
server-option = --enable-webrtc-datachannels=yes
server-option = --webrtc-datachannel-label=uv4l
server-option = --webrtc-datachannel-socket=/tmp/uv4l.socket
server-option = --enable-webrtc-video=yes

(all the above were commented out)

--------------------------------------------------------------------------------------------------------------------------------

But - on my PC, when I click on WebRTC on the webserver page, I just get the msg that some browsers do not support the non-encrypted version and a blank pane. I tried both Chrome and EDGE. Neither one works. Must I use SSH? What other things should I do? I'm trying to view using Win10.
Hi charleslinquist,
I'm still in the process of learning/implementing WebRTC but I'll try to help. The error you're getting is because of ssl, you have to use this option. It's unrelated to ssh. Now ssl is mandatory to use with webrtc (think https), so I guess you will need to generate those certificate with openssl and use the proper options (read the manual, man uv4l).
http://www.jetsonblog.com
twitter : @nolaan_boy

charleslinquist
Posts: 112
Joined: Wed Sep 05, 2012 12:43 pm

Re: 4G video/telemetry from drone

Wed Jan 11, 2017 11:48 pm

Thanks, I did get things to work with the FireFox browser - NON SSL. (HTTP:)

But there are a few things I still don't understand -
When I try to generate a key I get a "permissions error" even though I use sudo. So I tried to get around that by to elevatating my permissions using "su -", but I always get a password error no matter what I type in. For example, after using NOOBS, the login is pi and the password is raspberry. I changed the password from 'raspberry' to 'foobar9'. I can log in via SSH as user 'pi' and password 'foobar9'. But when I use 'su -' and get the prompt PASSWORD: and type in 'foobar9' it tells me the password is incorrect. What IS the superuser password?

The next thing that I don't understand is how logging in with SSL works at all. SSL is a tcp protocol, which sends an ACK back for every packet, thereby slowing down the transfer. I thought webRTC used UDP protocol. So how can you 'package' a UDP protocol inside a tcp protocol?

RpiName
Posts: 712
Joined: Sat Jul 06, 2013 3:14 am

Re: 4G video/telemetry from drone

Thu Jan 12, 2017 12:25 am

charleslinquist wrote:I thought webRTC used UDP protocol. So how can you 'package' a UDP protocol inside a tcp protocol?
The protocols are DTLS-SRTP . Read the IETF drafts for details. Read the UV4L instructions to know how to generate the keys used for the signaling over HTTPS:
http://www.linux-projects.org/uv4l/installation/

baerX63
Posts: 7
Joined: Mon Jan 23, 2017 2:48 pm

Re: 4G video/telemetry from drone

Thu Feb 16, 2017 10:41 pm

Hi guys i also need your help with uv4l. i ve installed it on a pi3 with the camera v2 and take the default webRTC page from linux-org for streaming. The problem is with the encoding/decoding mechanism from the uv4l driver.
I've take in the raspicam.conf for encoding h264. It is also in the command prompt written when i manually start uv4l. But when i switch while streaming ( hw codec input box clicked) to the camera control panel the format is YUV so i think the pi not really take the assisted hardware encoding h264 from the broadcom one which i want. Or isn't that correct? Normally the Browser has to decode? when i don't click the hw codec box how will the data transfered and decoded ? how will they compressed when i take the mjpeg stream?
Thanks in advance

Best regards
Philipp

Return to “Advanced users”