qgroundcontrol icon indicating copy to clipboard operation
qgroundcontrol copied to clipboard

Video streaming seems not work in windows qt6 qgc

Open hyeonseung89 opened this issue 1 year ago • 13 comments

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

  • Operating System: Windows 11 Home 22H2
  • Graphic Card: rtx3060ti
  • QGC Version: master branch
  • QGC build: daily
  • gstreamer version : 1.18.1
  • Qt 6.6.1 msvc 2019 64bit

Detailed Description

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

Log Files and Screenshots

  • Screenshots of QGC console. image

hyeonseung89 avatar Feb 06 '24 03:02 hyeonseung89

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

DonLakeFlyer avatar Feb 06 '24 16:02 DonLakeFlyer

Yes I do.

zdanek avatar Feb 06 '24 18:02 zdanek

Thank so much for looking at this.

DonLakeFlyer avatar Feb 06 '24 19:02 DonLakeFlyer

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

log.txt

AlexKlimaj avatar Feb 09 '24 19:02 AlexKlimaj

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

DonLakeFlyer avatar Feb 09 '24 19:02 DonLakeFlyer

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?

NiiAAip avatar Feb 24 '24 04:02 NiiAAip

@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?

zdanek avatar Feb 24 '24 10:02 zdanek

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

DonLakeFlyer avatar Feb 27 '24 23:02 DonLakeFlyer

+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

TishSerg avatar Apr 25 '24 09:04 TishSerg

Latest daily is just spamming gst_element_factory_make when rtsp is enabled.

image

AlexKlimaj avatar Jul 03 '24 22:07 AlexKlimaj

Hello everyone, has anyone resolved this issue yet?

doquangquan93 avatar Aug 16 '24 08:08 doquangquan93

Hello everyone, has anyone resolved this issue yet?

See #11421

TishSerg avatar Aug 16 '24 09:08 TishSerg

Hello everyone, has anyone resolved this issue yet?

See #11421

Thank you very much! Luckily, it worked

doquangquan93 avatar Aug 17 '24 05:08 doquangquan93