How to see video in qgroundcontrol using raspberry pi and pikhawk

Hi

I am a newbie on this. I am trying to get video to qgroundcontrol from raspberry pi camera. I figure out all the raspberry pi end but not the video in the qgroundcontrol. I downloaded qgroundcontrol from here:

http://qgroundcontrol.org/downloads

But once I run qgroundcontrol with pikhawk and raspberrypi, everything works fine, but I don’t see any option to select a display and see the video stream in qgroundcontrol comming from raspberrypi. Does somebody now how to set that up in qgroundcontrol?

My setup is the same as described here:

http://dev.ardupilot.com/wiki/raspberry-pi-via-mavlink/#connecting_to_rpi_with_an_sshtelnet_client

On the raspberry pi end I am all set. I see the camara “on” and stream out. I use the command:

raspivid -t 0 -h 720 -w 1080 -rot 180 -fps 24 -hf -b 2000000 -o – | gst-launch-1.0 -v fdsrc ! video/x-h264,width=1080,height=720,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=ipaddress port=5000

But on the qgroundcontrol, I don’t even know how to set up and open a window there to see video. I only see the google map and the gps location and the rest of the controls working properly, but no video window.

I appreciate any help.

Thanks,

Christian

 

You need to install gstreamer on the machine running qgc, then build from source. The precompiled downloads don’t include video support. See the instructions here: https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoStreaming/README.md
Once built, there is a little rectangle in the lower left of the map that will show the video. If you click the rectangle it will replace the map with fullscreen video.
-Jacob

Thanks Jacob. I follow all the steps and I got now the qgroundcontrol with an image window. However, now on the raspberry pi I get stuck with Pipeline is PREROLLING …

this is the command I use on the raspberrypi (I have a raspberry pi camara connected to the raspberry pi)

raspivid -t 0 -h 720 -w 1080 -rot 180 -fps 24 -hf -b 2000000 -o – | gst-launch-1.0 -v fdsrc ! video/x-h264,width=1080,height=720,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=myipaddress port=5000

Setting pipeline to PAUSED …
Pipeline is PREROLLING …

is there a parameter missing in the gst-launch command?

Thanks for your help.

Hi Christian,

Here is the right command for streaming the video.


raspivid -n -fl -w 1280 -h 720 -b 10000000 -fps 30 -t 0 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=<remote ip> port=5000

Make sure you replace with the ip address of the computer with QGC running.

Best,

Rusty

Thanks Rusty, it works perfect now!

Great! See here for ways you can manipulate the raspivid output for different resolution, white balance, exposure, etc:

Thanks, this is very helpful! Looking forward to receive the motors and putting all together.

Hi people.

I was trying to perform this. You are talking about using the 5000 port. I just complie QGC and the port that attends is 5600.

Take a look to: https://github.com/mavlink/qgroundcontrol/tree/master/src/VideoStreaming

If I use the 5000 port does not work. Instead with 5600 works perfectly

Regards.

Hi,

It looks like they just changed the port from 5000 to 5600 a few days ago. Here’s the commit:

https://github.com/mavlink/qgroundcontrol/commit/d1cba94cd5e00f494e1a4cdbcc4c531e357ef503#diff-b230c70b3e357996e3bbe30ca1260527

Good find!

-Rusty

Hi Rusty,

We have everything on our BlueROV running except for the camera in Qgroundcontrol. Our RBpi is streaming to port 5600. On our windows 7 PC we can see binary data comming in on UDP port 5600 (in terminal program).

We have the latest daily build of QGC installed and after this installed the latest version of Gstreamer (1.8.2). When starting QGC we don’t see video appearing in the video window. Do we have to apply any settings in QGC or should this work automatically?

 

Hi Klaas,

Excellent that everything else is working!

I’ve had some trouble getting the video streaming to work with Windows as well. I think that feature just got added to the daily build recently. I’ll look into it and see if there’s anything that needs to be done differently for it to work. It should work automatically once the vehicle is connected.

Can you tell me what command you are using to initiate the streaming? Is your Windows computer set to the right IP address?

-Rusty

Hi Rusty,

 

We are using the commend you mentioned before in this topic:

raspivid -n -fl -w 1280 -h 720 -b 10000000 -fps 30 -t 0 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=10 pt=96 ! udpsink host=<remote ip> port=5600

The remote IP is set to the IP adress of the computer running QGC so this should be ok. I have also added port 5600 as an exception in the firewall. Is there any other way to check if the data is received by the PC correctly?

Klaas

Hi Klaas,

Okay. That should be correct, but as I mentioned, I haven’t gotten this to work on Windows yet either. That’s pretty high on my list right now so I’ll try to test this out and figure out a solution soon.

-Rusty

Hi there,

I am still having trouble getting camera feed to run in QGC on my windows 7 computer. I am getting camera feed on and off but it is never consistent. Is there something I need to do to fix this issue and resolve the camera feed? Have you found a solution for windows users?

Thanks for all your help!

Madi, what version of QGC are you running? Try installing the latest version and see if you still have issues. If you do, is it possible to try with another computer in order to narrow down the possible causes of your problem?
-Jacob

Hi. Hoping you can also help me, Rusty. I am having trouble getting the video from my raspberry pi camera to stream in QGroundControl.

When I enter in your code everything looks to be alright.
I have:
Pipeline is PREROLLED …
Setting pipeline to PLAYING …
New clock; GstSystemClock

That’s it.
I do not have video streaming. I don’t know what to do and Emlid Docs don’t really tell me much. Wondering if you can shed some light on this problem.

I’m not too sure on the setting in QGC either.

@maZZiveAttack

What code are you entering and where? What emlid docs are you looking at?

This here:
https://docs.emlid.com/navio2/common/dev/video-streaming/

I’ve just downloaded and installed:
https://github.com/mavlink/qgroundcontrol/blob/master/src/VideoStreaming/README.md
I’m going to try the PC version. I’d like to get this working with an Android Tablet eventually.

The code from Emlid is:
pi@navio: ~ 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=<remote_ip> port=9000

from respberry pi command line. I’m new to this. So much to just get a flight controller working along with video. But will be worth it.

  1. You need to make sure the pi and the computer/tablet are on the same network.
  2. You need to find the IP address of the computer that you want to send video to.
  3. You need to change the command and fill in your computer’s IP address.
  4. You need to set QGC video settings to UDP video stream, and make sure the port matches the command you enter on the Pi (9000 here). The video settings are on the General tab of the Application Settings page (click the ‘Q’ icon).

pi@navio: ~ 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=<remote_ip> port=9000

If you need further help, I recommend reaching out to Emlid. I am not familiar with how they have their Pi image set up.

Alright, mate. I’ll have a look at those settings. I was using something other than 9000 in the QGS, 14550, or something. I have changed that to 9000 now.

I have a connection with QGC. Connecting to this isn’t the problem. The main issue is all the things I need to do and match. Things for the PC (don’t even go to android just yet!) I need to download and install. Not sure if that is done correctly. Also, what’s up with all this:
Pipeline

For the time being, the pipeline is somewhat hardcoded, using h.264. It’s best to use a camera capable of hardware encoding h.264, such as the Logitech C920. On the sender end, for RTP (UDP Streaming) you would run something like this:

gst-launch-1.0 uvch264src initial-bitrate=1000000 average-bitrate=1000000 iframe-period=1000 device=/dev/video0 name=src auto-start=true src.vidsrc ! video/x-h264,width=1920,height=1080,framerate=24/1 ! h264parse ! rtph264pay ! udpsink host=xxx.xxx.xxx.xxx port=5600
Where xxx.xxx.xxx.xxx is the IP address where QGC is running. You may tweak the bitrate, the resolution and the FPS based on your needs and/or available bandwidth.

To test using a test source on localhost, you can run this command:

gst-launch-1.0 videotestsrc pattern=ball ! x264enc ! rtph264pay ! udpsink host=127.0.0.1 port=5600

I’m struggling here!