MaartenBaert / ssr

SimpleScreenRecorder, a screen recorder for Linux
http://www.maartenbaert.be/simplescreenrecorder/
GNU General Public License v3.0
2.51k stars 287 forks source link

OpenGL recording fails with JOGL applications #172

Open ghost opened 10 years ago

ghost commented 10 years ago

When using the experimental OpenGL recording under Mageia Linux 3 (32 bits), the library gets correctly injected but SSR claims that no OpenGL window has been created. I use the following RPM: http://forum.freegamedev.net/viewtopic.php?f=46&t=4898&p=56016#p55948

HOW TO TEST: DO: Follow these instructions to build the pre-beta version of TUER: http://tuer.sourceforge.net/download.php DO: Run SSR DO: Click onto the button "Continue" DO: Click onto the radio button "Record OpenGL (experimental)" DO: Click onto the button "OpenGL Settings..." DO: Fill the text field "Command" with this line: java -cp .:lib/ardor3d/ardor3d-collada-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-core-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-math-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-savable-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-extras-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-jogl-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-ui-1.0-SNAPSHOT.jar:lib/fettle/fettle-0.7.0.jar:lib/google-collect/guava-14.0.1.jar:lib/gluegen-rt/gluegen-rt.jar:lib/joal/joal.jar:lib/jogl/jogl-all.jar:lib/pss/CodecJOrbis.jar:lib/pss/LibraryJavaSound.jar:lib/pss/LibraryJOAL.jar:lib/pss/SoundSystem.jar engine.service.Ardor3DGameServiceProvider DO: Fill the text field "Working directory" with the directory in which TUER has been compiled DO: Click onto the button "Close" DO: Click onto the button "Continue" DO: Enter the file path of the video in the text field "Save as" DO: Click onto the button "Continue" DO: Click onto the button "Start recording" DO: SSR injects its library successfully: [GLInjectLauncher::Init] Full command: LD_PRELOAD=libssr-glinject.so SSR_GLINJECT_SHM=16646161 java -cp .:lib/ardor3d/ardor3d-collada-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-core-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-math-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-savable-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-extras-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-jogl-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-ui-1.0-SNAPSHOT.jar:lib/fettle/fettle-0.7.0.jar:lib/google-collect/guava-14.0.1.jar:lib/gluegen-rt/gluegen-rt.jar:lib/joal/joal.jar:lib/jogl/jogl-all.jar:lib/pss/CodecJOrbis.jar:lib/pss/LibraryJavaSound.jar:lib/pss/LibraryJOAL.jar:lib/pss/SoundSystem.jar engine.service.Ardor3DGameServiceProvider [PageRecord::StartPage] Started page. [SSR-GLInject] Library loaded (32-bit). [SSR-GLInject] Library successfully initialized. [SSR-GLInject] Library loaded (32-bit). [SSR-GLInject] Library successfully initialized. avr. 27, 2014 7:50:14 PM engine.integration.DesktopIntegration Infos: operating system: linux avr. 27, 2014 7:50:14 PM engine.integration.DesktopIntegration Infos: operating system family: Linux avr. 27, 2014 7:50:14 PM engine.integration.DesktopIntegration Infos: XDG_DESKTOP_DIR denotes an existing directory: /home/gouessej/Bureau avr. 27, 2014 7:50:14 PM engine.integration.DesktopIntegration Infos: operating system supported. Desktop path: /home/gouessej/Bureau [SSR-GLInject] Hooked: dlsym(glXGetProcAddressARB). avr. 27, 2014 7:50:25 PM engine.renderer.ReliableRenderer Infos: the deallocator has been successfully initialized EXPECTED: SSR starts recording RESULT: SSR doesn't record anything, it just shows that in the console: [PageRecord::StartPage] Starting page ... [GLInjectLauncher::Init] Full command: LD_PRELOAD=libssr-glinject.so SSR_GLINJECT_SHM=16646161 java -cp .:lib/ardor3d/ardor3d-collada-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-core-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-math-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-savable-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-extras-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-jogl-1.0-SNAPSHOT.jar:lib/ardor3d/ardor3d-ui-1.0-SNAPSHOT.jar:lib/fettle/fettle-0.7.0.jar:lib/google-collect/guava-14.0.1.jar:lib/gluegen-rt/gluegen-rt.jar:lib/joal/joal.jar:lib/jogl/jogl-all.jar:lib/pss/CodecJOrbis.jar:lib/pss/LibraryJavaSound.jar:lib/pss/LibraryJOAL.jar:lib/pss/SoundSystem.jar engine.service.Ardor3DGameServiceProvider [PageRecord::StartPage] Started page. [PageRecord::StartOutput] Starting output ... [PageRecord::StartOutput] Error: Could not get the size of the OpenGL application. Either the application wasn't started correctly, or the application hasn't created an OpenGL window yet. If you want to start recording before starting the application, you have to enable scaling and enter the video size manually. [PageRecord::StartOutput] Error: Something went wrong during initialization. Switching to windowed mode doesn't allow to work around this bug.

I remind you that the pre-beta version of TUER uses JOGL 2. It creates an OpenGL window with its native windowing toolkit called NEWT, it should work except if JOGL refuses to load the injected library under the hood (which I have to check).

MaartenBaert commented 10 years ago

You are using an older version of SSR (i.e. not git master), the current git version has a completely new OpenGL recording system which may fix your issue. Please try that first. If the current version is still affected, I will look into it.

OpenGL recording has always worked fine with Minecraft, so I doubt that Java is the culprit here. The following line indicates that function hooking is at least partially working:

[SSR-GLInject] Hooked: dlsym(glXGetProcAddressARB).
ghost commented 10 years ago

Thank you for the complementary information. I'll build SSR from source as soon as possible.

Minecraft is a really bad example even though it uses Java as unlike Poxnora, Megacorps Online, Salem and TUER, it does not use JOGL.

My machine uses a graphics card ATI Radeon 9250 Pro that supports only OpenGL 1.3. I hope that you use nothing very fancy in the new implementation of OpenGL recording, I'm going to look at it.

MaartenBaert commented 10 years ago

My machine uses a graphics card ATI Radeon 9250 Pro that supports only OpenGL 1.3.

I am using FBOs (actually I just disable them temporarily in case the game uses them, I don't actually use them myself), I think FBOs became official in OpenGL 2.0 but they were already available as an extension long before that. I am not actually querying the extension, so if the driver doesn't expose FBOs as a core feature then GLInject will probably fail to load, or crash as soon as it tries to call those functions.

How old is the machine you're using? I'm afraid that even if you can get SSR to work, it will be too slow to be usable. Video encoding is inherently a very CPU-intensive task. You said in that forum thread that the normal recording mode in SSR was very slow - my experience is that OpenGL recording is actually slightly slower than normal recording on all the machines that I've tested (but the actual video quality is usually higher because there is no tearing or stuttering).

I can do a normal recording (not OpenGL) with a resolution of 1920x1080 at 190fps on my machine. So the normal recording mode is definitely not slow on modern hardware.

ghost commented 10 years ago

My graphics card supports FBOs better than some modern Intel chips but slow enough to drive WebGL applications unusable (WebGL uses offscreen rendering most of the time and only with FBOs as far as I know). My main computer was manufactured in 2005. Thank you for pointing out that OpenGL recording is slower than screen rendering, I'll be forced to use a more powerful machine to use SSR. I'll ask xranby and sgothel to help me.