josephd edited this page Aug 27, 2013 · 6 revisions

How to capture


To capture an application, execute

glc-capture [application to capture]

When you want to start or stop capturing, press Shift + F8.

When you have successfully captured your first video, you might want to play or encode it.

Note: if you are capturing threaded windows application, use wine-pthread executable.

Common options

For complete list of available options see glc-capture --help

-o, --out=FILE

Set stream file name. %d is expanded to program's pid.

default: pid-%d.glc

-f, --fps=FPS

Capture at FPS. Capturing frame rate is indipendent from application's fps and glc does not block application if system is not ready to capture a frame (eg. HDD is busy).

default: 30

-r, --resize=FACTOR

Multiply frame dimensions by FACTOR. For example capturing glxgears (by default 300x300) with -r 0.5 results 150x150 video stream.

FACTOR must be greater than zero. FACTOR 0.5 uses special scaling path which is significantly faster than others. FACTOR 1.0 disables scaling.

default: 1.0

-c, --crop=WxH+X+Y

Capture only WxH pixels starting at X,Y (measured from upper left corner). If X and Y are not specified 0,0 is used. If specified area is larger than window, only the intersection is calculated. If X or Y is larger than window dimensions 0 is used.

-a, --record-audio=CONFIG

Record specified ALSA devices. CONFIG format is device,rate,channels;device2....

-s, --start

Start capturing as soon as application intializes either ALSA or OpenGL. Use this if hotkey does not work in application (eg. compiz).

-e, --colorspace=CSP

glc supports RGB (-e bgr) and YV12 ITU-R BT.601 (-e 420jpeg) colorspaces. Framebuffer is in BGR format so conversion to YV12 ITU-R BT.601 requires extra calculations but cuts stream size in half and often results better compression.

default: 420jpeg

-k, --hotkey=HOTKEY

Start or stop capturing when HOTKEY is pressed. and modifiers are supported.

default: F8


Using GL_ARB_pixel_buffer_object is possible to retvieve data from GPU to system memory while application is drawing the next frame. See NVIDIA's [ document] about fast texture transfers.

default: GL_ARB_pixel_buffer_object is used if present

-z, --compression=METHOD

glc supports stream compression using LZO (lzo) or QuickLZ (quicklz). Setting this to none disables compression.

default: quicklz is used


By default frames are read with GL_PACK_ALIGNMENT 8 which makes pixel rows double-word aligned (this is recommended here). If you wish to use GL_PACK_ALIGNMENT 1 (byte-aligned rows), enable this.

default: GL_PACK_ALIGNMENT 8 is used

-i, --draw-indicator

glc can draw a red square at the upper left corner of the window being captured. This does not work when capturing front buffer.

default: indicator is not drawn

-v, --log=LEVEL

Log messages with lesser than, or equal to LEVEL level. Levels are

  • 0 - errors
  • 1 - warnings
  • 2 - performance information
  • 3 - information
  • 4 - debug

default: do not log messages

-l, --log-file=FILE

Write log to FILE. Like in -o, %d is expanded to program's pid.

default: log is written to stderr


Currently audio capture is done via hooking snd_pcm_write() and snd_pcm_mmap_() functions. When application sends data to ALSA, glc copies it to a temporary location and sends signal to a thread which writes the data to actual capture buffer. If subsequent call to hooked ALSA write function occurs before the thread has finished writing data to the buffer, glc either skips new data or waits until the thread has finished depending on whether --audio-skip is set.

Since in ALSA's asynchronous mode write calls can occur from signal handlers, glc must use [ busy waiting] to wait for the thread which inflicts an additional overhead.

''default: glc doesn't skip audio data''


Set this to disable audio capture.

default: audio is captured


Install signal handler to flush capture buffer to disk when application is terminated via Ctrl+C for example.

default: signal handler is not used

-g, --glfinish

By default glc reads a frame when glXSwapBuffers() is called. Some applications however (most notably compiz) may sometimes draw directly to the front buffer and not call glXSwapBuffers(). Enabling this option makes glc to capture the selected buffer (see --capture) when glFinish() is called. Use this option to capture compiz.

''default: don't capture when glFinish() is called''

-j, --force-sdl-alsa-drv

Sets SDL_AUDIODRIVER=alsa environment variable. This is just for convinience.

default: SDL_AUDIODRIVER=alsa is not set

-b, --capture=BUFFER

Read frames from either GL_FRONT (front) or GL_BACK (back).

default: frames are read from front buffer