Skip to content

Capture

sobkas edited this page Jun 17, 2013 · 12 revisions

How to capture

Quickstart

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.

Common options

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

-p, --pulseaudio

Use pulseaudio instead of alsa

-o, --out=FILE

Write output to FILE Following tags are available:

  •                   %app%:     application name
    
  •                   %pid%:     process ID
    
  •                   %capture%: counter
    
  •                   %year%:    4-digit year
    
  •                   %month%:   2-digit month
    
  •                   %day%:     2-digit day
    
  •                   %hour%:    2-digit hour
    
  •                   %min%:     2-digit minute
    
  •                   %sec%:     2-digit second
    

default value is %app%-%pid%-%capture%.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, --audio-devices=CONFIG

Record specified alsa/pulse devices

Each device specified here should write to a separate stream.

format is device;device2...

example: -a "alsa_output.pci-0000_00_14.2.analog-stereo;alsa_output.pci-0000_00_14.2.analog-stereo.monitor"

-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

--pbo

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 [http://http.download.nvidia.com/developer/Papers/2005/Fast_Texture_Transfers/Fast_Texture_Transfers.pdf 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).

default: lzo is used

--byte-aligned

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

--audio-skip

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 [http://en.wikipedia.org/wiki/Busy_waiting busy waiting] to wait for the thread which inflicts an additional overhead.

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

--disable-audio

Set this to disable audio capture.

default: audio is captured

--sighandler

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