Search code examples
linuxopenglscreen-captureqglwidget

OpenGL window video capture problem


Probably this is very easy but I can't find the right words for google to spit out what I need. I have a custom derived QGLWidget and want to do some video capturing to show it to others.

The capturing works well for all other widgets (Buttons, Checkboxes, ...) but my GLWidget remains blank (to the normal user it is fully responsive). When I hover the mouse over it, then the rectangular area of the mouse is redrawn on the widget.

How can I tell my widget/the windowsystem to refresh the whole area when motion capturing?

Probably related to the same problem: I once made a session in TeamViewer where the same problem occurred.

EDIT

When I use the Qt Demo Hello GL and capture it there is the same problem.

EDIT2

I tried one of my GLUT Demos and they did not work either, also I read about problems recording opengl output but this was on windows machines. Maybe there are also problems on linux?

Btw. I use xvidcap for the capturing.


Solution

  • Btw. I use xvidcap for the capturing.

    I'm not sure, but IIRC xvidcap uses the Xdamage extension to grab only, what programs report as being rendered new. OpenGL operations don't set the damage flag.

    Personally I use ffmpeg for screencapturing under X11. Something along the lines

    ffmpeg -f x11grab -r $FRAMERATE -s $WIDTHx$HEIGHT -i $DISPLAY+$XOFFSET,$YOFFSET -vcodec ... -b -y output_file
    

    For example

    ffmpeg -f x11grab -r 18 -s 800x600 -i :0+0,0 -vcodec mjpeg out.avi
    

    I found mjpeg, ljpeg or x264 / fast lossless codecs being well suited for this task.