Home
Fractals
Tutorials
Books
My blog
My LinkedIn Profile

BOOKS i'm reading

Napoleon Hill Keys to Success: The 17 Principles of Personal Achievement, Napoleon Hill, ISBN: 978-0452272811
The 4-Hour Workweek: Escape 9-5, Live Anywhere, and Join the New Rich (Expanded and Updated), Timothy Ferriss, ISBN: 978-0307465351
The Fountainhead, Ayn Rand, ISBN: 0452273331
Web Hosting Canada

mailto:olivier@olivierlanglois.net

I have discovered glc

12/09/13

Permalink 10:59:40 pm, by lano1106, 603 words, 2228 views   English (CA)
Categories: Linux

I have discovered glc

I was looking to screen capture opengl gaming sessions on Linux. On my first attempt, I have tried to use ffmpeg x11grab. This initial attempt failed since all recent OpenGL graphic cards drivers support direct rendering. This means OpenGL rendering simply bypass communicating with the xserver and makes x11grab useless. x11grab will grab anything on the screen that is behing the fullscreen foreground opengl window that use direct rendering.

I have then found glc that even if there is no recent activity on its github page, is very effective in what it is doing. It has not a lot of documentation on it but you can find a basic usage wiki page on it.

How does glc works?

It somehow place itself between the application to capture and the ALSA and OpenGL APIs with the help of a library called elfhacks, intercept the raw data and store it in a glc file that can become huge. The fact that it only support only very minimal realtime compression is one of the weakness of the tool. To give you an idea on how big the file can become, here is a quick calculation for a 1920x1080 resolution: 1920x1080 is about 2 millions pixels. Each pixel taking 4 bytes, it gives about 8MB per frame. At 30 fps, it is little bit less than 250MB per second! If you apply compression, I think that I have seen disk space consumption close to 1GB/minute. I have the plan to modify glc to pipe the captured raw data to ffmpeg for possibly improve a little bit the compression.

I intend to write a couple of posts on glc because there is not a lot written on it and hopefully it will help many to start using it so I'll cover things that I had to set up to be able to use it. The first thing will be to clarify glc audio capture options. I was under the impression that I had to use -a option and to provide an ALSA capture device to capture the application pcm streams. glc can record several pcm streams.

First it places ALSA hooks to intercept the application calls to ALSA to record the applications pcm stream. This is the default behavior and nothing needs to be added to the command line to record this audio. You can disable this recording with the option --disable-audio.
Secondly, you can add additionnal streams by using the -a option.

There exist a third option that I have developped due to my misinterpretation of how glc capture audio. You can disable glc ALSA hook recording and instead use ALSA snd_aloop driver fed by a pcm plug that split the stream between the sound card and the loopback device. This can be handy if you have surround 7.1 system with sampling rate of 192kHz and you want to downsample the stream and reduce the number of recorded channels. Even if this is not something you are confronted with, I will try to make it useful as an ALSA tutorial. ALSA lib doxygen output documents well the API but IMHO, it lacks some good examples to help understanding how to use ALSA.

On the GL side, frames can be acquired by 2 different methods: glReadPixels or GL_ARB_pixel_buffer_object (PBOs). You can use the switch --pbo to indicate to glc to try to use PBOs for the frame acquisition. PBOs have been introduced after glReadPixels. Their usage can provide a performance hedge over the former method for reasons that escape my undertanding. I will try to benchmark both methods to be able to compare them.

Pingbacks:

No Pingbacks for this post yet...

Olivier Langlois's blog

I want you to find in this blog informations about C++ programming that I had a hard time to find in the first place on the web.

December 2024
Sun Mon Tue Wed Thu Fri Sat
 << <   > >>
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31        

Search

Custom Search

Misc

XML Feeds

What is RSS?

Who's Online?

  • Guest Users: 11

powered by
b2evolution