ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg

Capture video of a linux desktop


237
By: wwest4
2009-02-05 17:23:43

5 Alternatives + Submit Alt

What Others Think

hmm... wtf? : ffmpeg -f x11grab -s sxga -r 25 -i :0.0 -sameq ~/tst.mpg FFmpeg version r11872+debian_3:0.svn20080206-12ubuntu3, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-pp --enable-swscaler --enable-x11grab --prefix=/usr --enable-libgsm --enable-libtheora --enable-libvorbis --enable-pthreads --disable-strip --enable-libfaad --enable-libfaadbin --enable-liba52 --enable-liba52bin --enable-libdc1394 --disable-armv5te --disable-armv6 --disable-altivec--disable-vis --enable-shared --disable-static libavutil version: 49.6.0 libavcodec version: 51.50.0 libavformat version: 52.7.0 libavdevice version: 52.0.0 built on Oct 3 2008 22:40:31, gcc: 4.3.2 [x11grab @ 0xb7ec4388]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1280 height: 1024 No protocol specified [x11grab @ 0xb7ec4388]Could not open X display. :0.0: I/O error occured Usually that means that input file is truncated and/or corrupted. Sad -:( now I have to read mans...
GreyCardinal · 485 weeks ago
FFmpeg version r11872+debian_3:0.svn20080206-12ubuntu3, Copyright (c) 2000-2008 Fabrice Bellard, et al. configuration: --enable-gpl --enable-pp --enable-swscaler --enable-x11grab --prefix=/usr --enable-libgsm --enable-libtheora --enable-libvorbis --enable-pthreads --disable-strip --enable-libfaad --enable-libfaadbin --enable-liba52 --enable-liba52bin --enable-libdc1394 --disable-armv5te --disable-armv6 --disable-altivec --disable-vis --enable-shared --disable-static libavutil version: 49.6.0 libavcodec version: 51.50.0 libavformat version: 52.7.0 libavdevice version: 52.0.0 built on Oct 3 2008 22:40:31, gcc: 4.3.2 [x11grab @ 0xb7f8f388]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 1366 height: 768 [x11grab @ 0xb7f8f388]shared memory extension found X Error of failed request: BadMatch (invalid parameter attributes) Major opcode of failed request: 148 (MIT-SHM) Minor opcode of failed request: 4 (X_ShmGetImage) Serial number of failed request: 9 Current serial number in output stream: 9 Doesn't work for me too
manspaceunix · 484 weeks and 4 days ago
I confirm that it doesn't work on Ubuntu Intrepid (ffmpeg version r11872+debian_3:0.svn20080206-12ubuntu3). I get the same trace as manspaceunix. It's because you haven't set the size to fit your needs. For example, my screen is 1024x768, so instead of "-s sxga", I have to use "-s xga" and it does it.
raphink · 483 weeks and 3 days ago
Hmm, actually, I ended up using ffmpeg -f x11grab -s sxga -r 24 -i :0.0 /tmp/out.mpg on Ubuntu Intrepid and it works, although I find that the result blinks horribly.
raphink · 483 weeks and 3 days ago
you can also use -s XxY, for example i use -s 1680x1050 on my machine. Or, assuming you have randr, use this for the general case: ffmpeg -f x11grab -s `xrandr | grep "Screen 0" | awk '{ print $8 }'`x`xrandr | grep "Screen 0" | awk '{ print $10 }' | sed 's/,.*//'` -r 25 -i :0.0 -sameq /tmp/out.mpg
skibrianski · 482 weeks and 3 days ago
Seemed to have the same video quality as gtk-recordmydesktop, but with a crappier mouse pointer.
Vadi · 482 weeks and 2 days ago
This works on machines without gtk-recordmydesktop (ubuntu doesn't have it, not to mention kde, xfce, etc. based environments)
skibrianski · 482 weeks and 2 days ago
Also, recordmydesktop doesn't work well with compiz.
skibrianski · 482 weeks and 2 days ago
I've used vlc in the past to record like this... Open screen:// with vlc and use its streaming features to save it.
Viaken · 480 weeks and 4 days ago
looks the same with this command http://www.commandlinefu.com/commands/view/1618/record-your-desktop
tristan_ph · 478 weeks and 1 day ago
I found the video looks better if played back on a different computer. Also if you don't know the size of your scree and want to record the whole thing this variation works well. ffmpeg -f x11grab -s `xdpyinfo | grep 'dimensions:'|awk '{print $2}'` -r 25 -i :0.0 -sameq /tmp/out.mpg
mluich · 473 weeks and 1 day ago
Doesn't work in my Ubuntu 8.04 FFmpeg version SVN-rUNKNOWN, Copyright (c) 2000-2007 Fabrice Bellard, et al. configuration: --enable-gpl --enable-pp --enable-swscaler --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libogg --enable-libgsm --enable-dc1394 --disable-debug --enable-shared --prefix=/usr libavutil version: 1d.49.3.0 libavcodec version: 1d.51.38.0 libavformat version: 1d.51.10.0 built on Mar 16 2009 21:16:26, gcc: 4.2.4 (Ubuntu 4.2.4-1ubuntu3) Unknown input or output format: x11grab
tr0k0l0 · 470 weeks and 6 days ago
Debian: may abort ("ffmpeg: symbol lookup error: ffmpeg: undefined symbol: ffm_nopts") if you use the debian-multimedia.org repository See http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=489209
natmaka · 462 weeks and 1 day ago
this is what worked for me on debian unstable and... FFmpeg version SVN-r20547, Copyright (c) 2000-2009 Fabrice Bellard, et al. built on Nov 18 2009 19:13:44 with gcc 4.3.4 configuration: --prefix=/usr --extra-cflags='-Wall -g ' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-libfaad --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libtheora --enable-libdc1394 --enable-libspeex --enable-nonfree --disable-stripping --enable-avfilter --enable-libdirac --disable-decoder=libdirac --enable-libschroedinger --disable-encoder=libschroedinger --enable-avfilter-lavf --enable-libopenjpeg --enable-version3 --disable-altivec --disable-armv5te --disable-armv6 --disable-vis libavutil 50. 4. 0 / 50. 4. 0 libavcodec 52.41. 0 / 52.41. 0 libavformat 52.39. 2 / 52.39. 2 libavdevice 52. 2. 0 / 52. 2. 0 libavfilter 1. 8. 0 / 1. 8. 0 libswscale 0. 7. 1 / 0. 7. 1 libpostproc 51. 2. 0 / 51. 2. 0 ffmpeg -f x11grab -s 1440x900 -r 15 -i :0 -vcodec libx264 -vpre normal -threads 0 ~/videofile.mp4
nadavkav · 443 weeks and 2 days ago

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: