mavlink / qgroundcontrol

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

Video streaming seems not work in windows qt6 qgc #11020

Open hyeonseung89 opened 8 months ago

hyeonseung89 commented 8 months ago

Expected Behavior

Want to RTSP Video source play and work at qt6 QGC test source is rtsp://210.99.70.120:1935/live/cctv004.stream

Current Behavior

Recently saw that gstreamer fixes for qt6 qgc were merged. But it doesn't seem to play in Windows apps. I haven't tried any other OS.

Steps to Reproduce:

Please provide an unambiguous set of steps to reproduce the current behavior

  1. Download generated latest app by CI action
  2. In video settings, set source to rtsp
  3. input address

System Information

When posting bug reports, include the following information

Detailed Description

When I compiled it myself up to qt 5.15, it worked normally.

Log Files and Screenshots

DonLakeFlyer commented 8 months ago

@zdanek Do you have the ability to test under Windows?

zdanek commented 8 months ago

Yes I do.

DonLakeFlyer commented 8 months ago

Thank so much for looking at this.

AlexKlimaj commented 7 months ago

[!] at D:\a\qgroundcontrol\qgroundcontrol\src\VideoReceiver\GstVideoReceiver.cc:1370 - "GStreamer error: Could not initialize window system"

log.txt

DonLakeFlyer commented 7 months ago

I vaguely seem to remember fixes in the qmlsink thingy for Windows. Maybe we lost those somewhere along the way?

NiiAAip commented 7 months ago

I obtained some important information through https://www.qt.io/blog/graphics-in-qt-6.0-qrhi-qt-quick-qt-quick-3d. Qt Quick aims to accelerate rendering using hardware. By default, it will be built on the low-level graphical API that is most suitable for the target platform. For example, on Windows, it will default to Direct3D, while on macOS, it will default to Metal.

So here, this line of code cannot run properly. https://github.com/mavlink/gst-plugins-good/blob/5ff0a6af0e1fd29bafc9f6644e728d24349d0ce7/ext/qt6/qt6glitem.cc#L527

In this way, we can simply bypass it by adding QQuickWindow:: setGraphicsApi (QSGRenderInterface:: GraphicsApi:: OpenGL); to the main function. I successfully verified it on my MacBook m2. I think Windows can do the same. On Windows, it may also be possible to implement it through QCoreApplication: setAttribute (Qt:: AA_UseOpenGLES); or QCoreApplication: setAttribute (Qt:: AA_UseSoftwareOpenGL);.

However, I am not sure if doing so is correct. Does it have an impact on performance?

zdanek commented 7 months ago

@NiiAAip great finding! Thank you. I will check it with Windows. I don't have an access to Mac. Can you create a PR with a fix?

DonLakeFlyer commented 7 months ago

I switched Mac builds to OpenGL. I also tested and it works there at least.

TishSerg commented 5 months ago

+1 for this. I have the same issue: video still doesn't work as of a commit d785993 (master).

At the same time, builds of Stable branches have video working ok (at least UDP RTP h264/h265, RSTP; MPEG-TS video isn't shown, but can be recorded with button).

To make video work in master build I've tried changing decoder from decodebin3 to decodebin in GstVideoReceiver.cc and QQuickWindow::setGraphicsApi(QSGRendererInterface::OpenGL); in main.cc. Still no luck :'(

Windows 11 23H2, Qt 6.6.1/5.15.2 MSVC2019 64bit

AlexKlimaj commented 3 months ago

Latest daily is just spamming gst_element_factory_make when rtsp is enabled.

image

doquangquan93 commented 1 month ago

Hello everyone, has anyone resolved this issue yet?

TishSerg commented 1 month ago

Hello everyone, has anyone resolved this issue yet?

See #11421

doquangquan93 commented 1 month ago

Hello everyone, has anyone resolved this issue yet?

See #11421

Thank you very much! Luckily, it worked