I recompiled today ffmpeg because I wanted to have support for a couple more of formats but when I finished the installation (using the latest SVN version), I was unable to capture the screen any more. Got this error:
Unknown input or output format: x11grabI have been searching and reading almost hundreds of pages but no one seemed to have encountered this issue before in Ubuntu 9.10, or they were able to fix it but never bothered posting about that.
Finally in an act of desperation I decided to read the configure script and looked for instances of x11. This line looked very suspicious:
x11_grab_device_indev_extralibs="-lX11 -lXext -lXfixes"I checked (using Synaptic Package Manager) and found that although I had the X11 dev and Xext dev libraries installed on my system, I was missing Xfixes. So I installed libxfixes-dev:
sudo apt-get install libxfixes-dev(or you can do it with Synaptic too!)
I depends on x11proto-fixes-dev, so you need to install that one as well, of course.
Then I ran configure again using this set of switches:
./configure --enable-gpl --enable-version3 --enable-nonfree --enable-postproc \
--enable-pthreads --enable-libfaac --enable-libfaad --enable-libmp3lame \
--enable-libtheora --enable-libx264 --enable-libxvid --enable-x11grab \
--enable-libvorbisAnd made sure that x11_grab_device was in the Enabled indevs
section from configure’s output:
Enabled indevs:
alsa oss v4l2
dv1394 v4l x11_grab_deviceIf x11_grab_device hadn’t been there (and trust me, it wasn’t before installing xfixes) that would render the whole process of compiling ffmpeg useless, since it wouldn’t have support for grabbing the X11 display (which is what you need for screen capturing).
Then I recompiled ffmpeg again, etc, etc… but the old examples from the manual don’t seem to work any more. Their syntax needs to be adjusted:
this (from the manual):
ffmpeg -f x11grab -s cif -i :0.0 /tmp/out.mpggives me the following error:
[x11grab @ 0x1e0e420]device: :0.0 -> display: :0.0 x: 0 y: 0 width: 352 height: 288
[x11grab @ 0x1e0e420]AVParameters don't have video size and/or rate. Use -s and -r.
:0.0: Input/output errorIt seems that now we need to specify both the size and rate for the capture. So for example this will do (note the extra -r 30 which specifies the capture rate to be 30 frames per second):
ffmpeg -f x11grab -r 30 -s cif -i :0.0 /tmp/out.mpgHappy screen capturing! 😀
Ah, I see now why you prefer Linux to Windows. Much easier to use! 🙂
Considering that ffmpeg is in version < 1.0 and already has an impressive array of features, I think it's worth to spend a couple of hours with it. This hasn't anything to do with Linux... if you wanted to compile it for Windows you would have to satisfy the library dependencies anyway! 😛 Nice seeing you here, Saga - I just learnt recently that you are in the OpenMPT team. Good to see some demoscene-love in the group 😀
Thanks for your great paragraph. Now I can capture my desktop too. ^_^
hello, I met a problem about record the desktop, coulu you give me a favor?
The problem is the following.
First, I want to record the desktop, but the computer is the server. So, i need to use VNC Client to login the server and receive the screen from VNC Server. Now, I want to record the screen on the VNC Client. I open the terminal and I use the command “ffmpeg -f x11grab -r 30 -s cif -i :0.0 /tmp/out.mpg” to record the screen on VNC Client. The commnad can work, but the recored video content is not my VNC screen. So, I would like to know how to record my VNC screen.
Could you give me any direction or suggestion. Thanks a lot!!
No idea, sorry. There might be some programs out there for recording VNC sessions, I think…
Every time I install a new Linux workstation, and recompile ffmpeg, and X11 screen capture doesn’t work, I Google the error message, and this page comes up. I install Xext, Xfixes (and dependencies), recompile ffmpeg one more time, and watch it work.
Thank you. You rule.
Haha, that’s funny 😀
You’re welcome. Glad it’s useful!
Thanks. I had the same problem and this fixed it for me! Wonder why ffmpeg’s configure didn’t exit with an error!
That’s certainly a very good question. But taking into account that ffmpeg is supposed to be non stable yet… I guess that “explains” something.