mavlink / qgroundcontrol

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

MPEG-TS H.264 stream is not shown #11140

Open ddatsko opened 9 months ago

ddatsko commented 9 months ago

MPEG-TS H.264 stream is not shown in QGC, however the video can be recorded well

Expected Behavior

Current Behavior

When performing the steps above, the video is not shown in QGC. However, when the stream is running, the "Record" button becomes active and is fully functional. After recording the video, the .mkv file with recording contains the valid received video

Steps to Reproduce:

  1. In QGC, set up video source to MPEG-TS (h.264) and UDP port to 8081
  2. Run the gstreamer pipeline from above

System Information

Log Files and Screenshots

ddatsko commented 9 months ago

UPD: I was debugging the issue more deeply, and it looks that the problem is in the decodebin3 gstreamer plugin. When the decoder is set to decodebin instead of decodebin3 in the code, the video is played and I obtain the following pipeline inside of the QGC with properly selected avdec_h264 decoder: pipeline-with-new-decoder-pad However, if I keep the decodebin3, the pipeline is created only till this stage and looks like decodebin3 cannot properly handle the stream pipeline-with-decoder All this also fits well with the observation that video recording works well: there is just no decoding there and the stream goes directly into matroskamux and the file

After this, I was able to replicate the same problem with just gstreamer. When sending the MPEG-TS stream with the pipeline above, all these pipelines work for receiving: gst-launch-1.0 udpsrc port=8081 ! parsebin ! decodebin ! videoconvert ! autovideosink sync=False gst-launch-1.0 udpsrc port=8081 ! decodebin ! videoconvert ! autovideosink sync=False gst-launch-1.0 udpsrc port=8081 ! decodebin3 ! videoconvert ! autovideosink sync=False

However, the one created in QGC doesn't work: gst-launch-1.0 udpsrc port=8081 ! parsebin ! decodebin3 ! videoconvert ! autovideosink sync=False fails with Internal data stream error

I see two possible workarounds in this case:

fredowski commented 8 months ago

I dived into this 100m deep tank of shit of the gstreamer video stuff some time ago: https://github.com/mavlink/qgroundcontrol/pull/10420

My result is that it is impossible to setup a automagic pipeline that works for all video formats on all platforms. So if you figure out one pipeline setup that works for your particular video on your platform then you have to make sure that this works on all other platforms: linux, MacOS, Windows, Android. Then you have to make sure that you have not broken other video formats.

ericjohnson97 commented 8 months ago

I wanted to +1 this issue. I am seeing the same error in my QGC log on Windows when trying to receive a UDP h264 stream

[!] at D:\a\qgroundcontrol\qgroundcontrol\src\VideoReceiver\GstVideoReceiver.cc:1305 - "GStreamer error: Internal data stream error."