mavlink / qgroundcontrol

Cross-platform ground control station for drones (Android, iOS, Mac OS, Linux, Windows)
http://qgroundcontrol.io
3.3k stars 3.63k forks source link

SRT Support in Video Streaming #12057

Open PrcsnFlyer opened 1 week ago

PrcsnFlyer commented 1 week ago

Using the SRT protocol for receiving video feeds would be highly beneficial, especially since it is already supported by GStreamer, making implementation straightforward.

SRT offers several advantages over traditional protocols like MJPEG and RTSP, primarily through features like Forward Error Correction (FEC) and encryption. These enhancements improve reliability and security without adding significant latency or bandwidth overhead.

For more information about SRT, please refer to the following resources:

SRT on GitHub SRT Support in GStreamer

Paschalis commented 1 week ago

I've implemented an example for H.265 video and audio encoding using the gst-launch-1.0 terminal tool, leveraging the SRT protocol for streaming. Below are the details for both the sender and receiver pipelines, along with their respective diagrams.

Sender Side Pipeline:

gst-launch-1.0 -e v4l2src device=/dev/video0 ! \
  queue max-size-buffers=1 ! "video/x-raw, width=640, height=480, framerate=30/1" ! \
  videoconvert ! clockoverlay time-format="8A, %d %B %y, H:%M:%S" ! \
  queue max-size-buffers=1 ! x265enc tune=zerolatency ! video/x-h265 ! mux. \
  alsasrc device="hw:1" ! audio/x-raw, width=16, depth=16, rate=44100, channels=1 ! \
  queue ! audioconvert ! audioresample ! fdkaacenc ! aacparse ! \
  mpegtsmux name=mux ! srtsink uri=srt://:8888/

Receiver Side Pipeline:

gst-launch-1.0 srtsrc uri=srt://<sender-ip>:8888 ! \
  tsdemux name=demux ! \
  queue ! h265parse ! video/x-h265 ! avdec_h265 ! videoconvert ! autovideosink \
  demux. ! queue ! aacparse ! avdec_aac ! audioconvert ! autoaudiosink

Diagrams:

sender

These pipelines allow the sender to stream H.265 video and audio using SRT, while the receiver decodes and plays back the content. If you're interested, I can also provide the C code for this implementation. Also, I will try to integrate the SRT protocol into QGroundControl