Recently I needed to show some people how to do something, rather than writing a load of descriptions and capturing lots of screen captures, it was easier to record my session. For this you will need a recent version of ffmpeg, im using this one
[jtang@duo ~]$ ffmpeg -version
FFmpeg version SVN-r15261, Copyright (c) 2000-2008 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg
--libdir=/usr/lib64 --shlibdir=/usr/lib64
--mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2
-g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic
-D_ISOC99_SOURCE -D_POSIX_C_SOURCE=200112 -fasm -std=c99
-fno-math-errno --enable-libdc1394 --enable-libfaac
--enable-libfaad --enable-libgsm --enable-libmp3lame
--enable-libtheora --enable-libvorbis --enable-libx264
--enable-libxvid --enable-x11grab --enable-avfilter
--enable-avfilter-lavf --enable-postproc --enable-swscale
--enable-pthreads --disable-static --enable-shared
--enable-gpl --enable-x11grab --enable-libdirac --disable-debug
--disable-optimizations --disable-stripping
libavutil 49.10. 0 / 49.10. 0
libavcodec 51.71. 0 / 51.71. 0
libavformat 52.22. 1 / 52.22. 1
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 1. 0 / 0. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Jan 10 2009 12:53:49, gcc: 4.1.2 20071124 (Red Hat 4.1.2-42)
FFmpeg SVN-r15261
libavutil 49.10. 0 / 49.10. 0
libavcodec 51.71. 0 / 51.71. 0
libavformat 52.22. 1 / 52.22. 1
libavdevice 52. 1. 0 / 52. 1. 0
libavfilter 0. 1. 0 / 0. 1. 0
libswscale 0. 6. 1 / 0. 6. 1
libpostproc 51. 2. 0 / 51. 2. 0
Note --enable-x11grab is needed for all this to work. First you need to pick the window you want to record by using xwininfo
[jtang@duo ~]$ xwininfo -frame
xwininfo: Please select the window about which you
would like information by clicking the
mouse in that window.
xwininfo: Window id: 0x800529 "urxvt"
Absolute upper-left X: 2229
Absolute upper-left Y: 231
Relative upper-left X: 2229
Relative upper-left Y: 231
Width: 478
Height: 303
Depth: 32
Visual Class: TrueColor
Border width: 1
Class: InputOutput
Colormap: 0x800522 (not installed)
Bit Gravity State: ForgetGravity
Window Gravity State: NorthWestGravity
Backing Store State: NotUseful
Save Under State: no
Map State: IsViewable
Override Redirect State: no
Corners: +2229+231 -491+231 -491-664 +2229-664
-geometry 79x22+2229+231
It will ask you to select a window, this will give you the window location and dimensions including the window decor. You will need from the xwininfo output is the size of the window, and the co-ordinates of the window (the co-ordinate of the upper left hand window) I my case I needed the absolute X and absolute Y co-ordinates and the Height and Width.
Now to run ffmpeg to capture your session
ffmpeg -f x11grab -s 478x302 -b 10000 -i :0.0+2229,231 out.avi
According to the docs at ffmpeg, in my case
- 0.0 is display.screen number of your X11 server, same as the DISPLAY environment variable.
- 2229 is the x-offset and 231 the y-offset for the grabbing.
- 478x302 is the Height and Width of the window I want to capture, noticed I rounded it down to 302, this is because some (if not all) video formats require a number divisible by 2 (or even 4) for the input/output sizes
- 10000 is the bitrate in bits per second (need to check this), the bigger the value the better the quality.
- out.avi is of course the target output file.
- you can also specify the frame rate with the -r option