Doc /


ffmpeg and VirtualBox

I use to start VirtualBox on the upper right corner of my screen (HD:1920x1080). When launching the openSUSE dvd, we can't choose the screen definition, it's always 800x600. After the first boot it changes, usually for 1024x768 (no 16x9 available - see Vesa definitions).

If the install is stopped (on a menu, for example, move the cursor on the boot menu to stop), and then re-positionned, it keeps it's place next boot.


On first boot, the VirtualBox screen, as reported by xwininfo -frame (see below) is:

Corners: +1116+23 -4+23 -4-416 +1116-416
-geometry 800x641-4+23

From this we can guess VirtualBox decoration size:

0 (zero) on left and right (we still have 800 pixels, the screen full size), 641-600=41 pixels. We have to guess what is the part of the upper ribbon (menus) and the lower (information icons). Seems to be half for each, so I use 43 pixels offset for ffmpeg

This gives for the first windows:

/usr/bin/ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0+1116,43 -target pal-dvd /local/data/temp-data/114.mpg

 -r 25

is for frame number per second


for second size windows (also upper right aligned)

Corners: +892+23 -4+23 -4-248 +892-248 -geometry 1024x809-4+23
/usr/bin/ffmpeg -f x11grab -r 25 -s 1024x768 -i :0.0+892,43 -target pal-dvd /local/data/temp-data/114.mpg


Last part 1280x960

Corners: +636+23 -4+23 -4-56 +636-56
-geometry 1280x1001-4+23

/usr/bin/ffmpeg -f x11grab -r 25 -s 1280x960 -i :0.0+636,43 -target pal-dvd /local/data/temp-data/114.mpg


Xwindows measurements are not that easy to understand.

Corners are counted as upper left (1), upper right (2), lower right (3), lower left (4).

The numbers are pixel (option -metric add mm), a "+" in front means "from left", a "-", "from right"

xwininfo -frame
Corners: +1228+628 -0+628 -0-0 +1228-0
geometry 692x452-0-0

means (here Konsole):

The windows is 692x452 pixels, including Kde decorations. The lower right corner is on the lower right position of the screen (-0-0). The upper left corner is at 1228 pixels from the left limit of the screen (1228+692=1920, I have a HD screen). Upper right corner is (-0) just on the right limit of ther screen, and at (+628) 628 pixels from the upper limit of the screen (1080-628=452).

Without the frame option, xwininfo gives the windows size without the kde decoration:

Corners: +1232+651 -4+651 -4-4 +1232-4
-geometry 684x425-0-0

You can see than kde deco is 4 pix wide on bottom, left and right (-4-4), the upper ribbon is 23 pixels height (651-628=23). This do not take account of the proper application decoration.

on the web

ffmpeg -f x11grab -s 1280x1024 -r 10 -i :0.0 -f alsa -i pulse -sameq -r 30 test.mpg