Hide

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again.

Delete that bloated snippets file you've been using and share your personal repository with the world. 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.


If you have a new feature suggestion or find a bug, please get in touch via http://commandlinefu.uservoice.com/

Get involved!

You can sign-in using OpenID credentials, or register a traditional username and password.

First-time OpenID users will be automatically assigned a username which can be changed after signing in.

World cup college
Hide

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:

Hide

News

2010-03-03 - Commandlinefu @ SXSW 2010
Am going to be at SXSW this year, in case you want to submit any CLI nuggets or suggestions to me in person. Ping me on the @codeinthehole Twitter account.
2009-09-12 - Email updates now available
You can now enable email updates to let you know each time you're command is commented on.
2009-07-11 - API and javascript blog widget now available
A simple API has been released, allowing commands to be retrieved in various formats. This also allows commands to be embedded on blogs/homepages.
2009-05-17 - Added duplicate suggestions to the new command form
When adding a new command, a quick background search is performed to make sure you're not duplicating a command already in the system.
Hide

Tags

Hide

Functions

Capture video of a linux desktop

Terminal - Capture video of a linux desktop
ffmpeg -f x11grab -s wxga -r 25 -i :0.0 -sameq /tmp/out.mpg
2009-02-05 17:23:43
User: wwest4
123
Capture video of a linux desktop

Alternatives

There is 1 alternative - vote for the best!

Terminal - Alternatives
ffmpeg -f x11grab -r 25 -s 800x600 -i :0.0 /tmp/outputFile.mpg
2009-06-05 21:11:17
User: dcabanis
Tags: video X11 ffmpeg
24

Grab X11 input and create an MPEG at 25 fps with the resolution 800x600

Know a better way?

If you can do better, submit your command here.

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...

Comment by GreyCardinal 56 weeks and 6 days 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

Comment by manspaceunix 56 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.

Comment by raphink 55 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.

Comment by raphink 55 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

Comment by skibrianski 54 weeks and 2 days ago

Seemed to have the same video quality as gtk-recordmydesktop, but with a crappier mouse pointer.

Comment by Vadi 54 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)

Comment by skibrianski 54 weeks and 2 days ago

Also, recordmydesktop doesn't work well with compiz.

Comment by skibrianski 54 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.

Comment by Viaken 52 weeks and 3 days ago

looks the same with this command http://www.commandlinefu.com/commands/view/1618/record-your-desktop

Comment by tristan_ph 50 weeks 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

Comment by mluich 45 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

Comment by tr0k0l0 42 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

Comment by natmaka 34 weeks 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

Comment by nadavkav 15 weeks and 1 day ago

Your point of view

You must be signed in to comment.

Related sites and podcasts