How to grab whole window without monitor or HDMI dummy plug?
-
I'm doing a streaming work, the device is without any monitors or HDMI dummy plug. I tried to use "grab()" but it seems to be forced to update all widgets, however, these widgets are required to update at specific time so "grab()" is not suitable for this situation. And "grabWindow(this->winId())" had been tried, but it only captrues 1/4 area of the window, other areas were shown as black. I doubt the incorrect "winId()" caused error result because gnome terminal would be startup first to execute shell script. Anyone please advise some effective methods or enlightenments, thanks!
system: ubuntu18.0.4
qt version: 5.9.5
device: nvidia tx2program execute steps:
1、startup shell script is be executed by a gnome terminal after booting
2、above mentioned script execute the qt program -
Hi and welcome to devnet,
How are you doing the streaming part ?
-
@SGaist Hi, i grab window images through a "QTimer", and images encoded into H.264 format frames using "ffmpeg", then frames are streamed using the 3rd party API. The frame's size and proportions are the same as the original grabbed window image.
I can get the correct whole window image by "grab()", stream frames and show them normally. Due to using "QOpenGLWidget" to render some textures, some image flickering occurred, and no effective ways i can solve currently.
I later tried to use X11 to grab the window image, but still need a monitor or HDMI dummy plug to realize such as make the GPU perform initialization process.
I am curious about how the "grab()" implements grabbing the correct full image without the monitor or HDMI dummy plug.
-
Did you try with Qt's offscreen plug-in to see if does what you need ?
Another option is to use a headless X
Or maybe Xvfb -
@harlan56 Hi, have you tried QApplication::desktop()->grab(); function?
3/5