Cannot stream video to QGC with GStreamer

Hello,

i am using a raspberry camera on my quadcopter in order to stream video to my laptop. I have rasperry pi 3B with a raspberry camera attached. I have installed gstreamer both on my quadcopter’s raspberry and also on my windows laptop.
When i give the command gst-launch-1.0 rpicamsrc bitrate=1000000 ! ‘video/x-raw,width=640,height=480,framerate=25/1,profile=baseline’ ! jpegenc ! rtpjpegpay ! udpsink host=xxx.xxx.xxx.xxx port=5600 on my quadcopter’s raspberry and the command C:\gstreamer\1.0\x86_64\bin\gst-launch-1.0.exe -v udpsrc port=5600 ! application/x-rtp, encoding-name=JPEG, payload=26 ! rtpjitterbuffer ! rtpjpegdepay ! jpegdec ! autovideosink on my windows laptop, a popup video appears on my laptop where i can see my copter’s camera video feed as expected…

However, if instead of giving the above command on my laptop I open QGC where in the settings I have enabled the option UDP h.264 video stream , UDP port : 5600 , i cannot see any video feed within QGC… What am I doing wrong ?? How could i see my copter’s video within QGC using gstreamer?

Thanks a lot

Far from an expert but I think the issue is the rPi video stream output is MJPG encoding and the option selected in QGroundControl(QGC) is for h.264 encoding. I am not sure what is the easiest solution, but I would see if you can get a gstreamer pipeline on the rpi to output an h.264 or h.265 encoded video stream and then select a comparable option in QGC.

Another option would be to use mission planner. If you right click on the HUD/PFD you can go to the video menu and directly enter a gstreamer pipeline.

Hello DroneWrangler…

I tried on mission planner and I have specified directly the same command that I give on my windows laptop in the case where gstreamer appears in a separate window… But in mission planner i don’t get any video feed…I have also tried and installed SRT for gstreamer on my raspberry and laptop, but on my raspberry when i give the command gst-launch-1.0 rpicamsrc ! videoconvert ! x264enc bitrate=8000 tune=zerolatency speed-preset=superfast byte-stream=true threads=1 key-int-max=15 intra-refresh=true ! video/x-h264, profile=baseline ! mpegtsmux ! srtserversink uri=srt://0.0.0.0:8888/ latency=100 i get an error message as WARNING: erroneous pipeline: no element "srtserversink"

Greetings! I also encountered problems streaming videos using GStreamer to QGroundControl. My environment the next:

  • Ubuntu 22.04.2 LTS
  • gst-launch-1.0 --version: 1.20.3
  • QGroundControl v4.3.0

Here’s what I found:

  1. Source: MPEG-TS (h.264) Video Stream not work for me, for any tested gstreamer pipeline.
  2. Source: UDP h.264 Video Stream (default port: 5600) is RTP+H264 via UDP (not raw H264 via UDP).

So, trying to stream video to QGroundControl’s Source: UDP h.264 Video Stream (without using camera, rpicamsrc, etc), I found, that video format is important!

  • Streamer (simple) (based on pipeline from here) works:

    gst-launch-1.0 --verbose \
        videotestsrc ! \
        x264enc ! \
        h264parse ! \
        rtph264pay \
            config-interval=10 \
            pt=96 ! \
        udpsink \
            host=127.0.0.1 \
            port=5600
    
  • videotestsrc ! ... without params produces the next caps:

    • video/x-raw, width=(int)320, height=(int)240, framerate=(fraction)30/1, format=(string)Y444, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
      • This caps works, due to Y444 format.
  • videotestsrc ! "video/x-raw, width=640, height=480, framerate=30/1" ! ... (notice: only size changed, no ‘format’ specified) produces the next caps:

    • video/x-raw, format=(string)Y444_10LE, width=(int)640, height=(int)480, framerate=(fraction)30/1, multiview-mode=(string)mono, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
      • This caps DONT works, due to Y444_10LE format. I think QGroundControl cannot show such video!
  • videotestsrc ! "video/x-raw, width=640, height=480, framerate=30/1, format=Y444" ! ... with explicetely defined ‘format’ works.

  • v4l2src device="/dev/video0" do-timestamp=true ! "video/x-raw, width=640, height=480, framerate=30/1" ! ... (streaming webcam) produces the next caps:

    • video/x-raw, width=(int)640, height=(int)480, framerate=(fraction)30/1, format=(string)YUY2, pixel-aspect-ratio=(fraction)1/1, interlace-mode=(string)progressive
      • This caps works, due to YUY2 format.

I also tried to ‘tune’ x264enc, by setting tune=zerolatency, speed-preset=ultrafast, etc. - its not affect QGroundControl. So, propably, most problems with UDP h.264 Video Stream mode are due to unsupported video format.