Capturing video of one's desktop
by
, 25-May-2011 at 14:14 (7081 Views)
The idea of a blog on the forum is interersting, so I'm posting this to get a better 'handle' as to what one can put in a blog post! And I thought I would throw in a small guide at the same time (on a subject that is currently of interest to me).
Capturing one's desktop
I've recently switched from using xvidcap to using ffmpeg for capturing video to my desktop, and I'm quite happy with the capabilities of ffmpeg. Now why you may ask, use the command line ffmpeg instead of the GUI based xvidcap ?
My answer: stability.
Despite my like for xvidcap, it was not sufficiently stable. ffmpeg on the other hand, with the 'right' input arguments, works well for me in capturing my desktop.
Capture desktop using ffmpeg with pulse audio
My main PC is running at 1920x1200 resolution (on a Core i7 920 with 6GB RAM). Since this computer has lots of CPU (with 8 virtual cores) I typically capture the entire desktop with:
Now in this case the desktop is being captured with both video and audio (audio using pulse audio). Its important thus one has pulse audio setup to record audio from ffmpeg. I use the program 'pavucontrol' to ensure ffmpeg is properly configured for audio recording. One may have to install ffmpeg if it is not already installed.Code:ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1920x1200 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output
In that command note I am capturing at 30 frames per second (in the -r 30 option) that might be too high a frame rate for some users and 15 frames per second may work better. Note also I am capturing at a resolution of 1920x1200. Thats very high ! On my laptop I typically capture at 1440x900.
I am capturing the entire screen. Its possible to capture only a fraction of the screen following the guidance here: How to do Proper Screencasts on Linux Using FFmpeg (although its not very user friendly).
Finally, note the size of the captured file using the above command will be massive (in the order of MANY gigabytes for just a short recording). Typically after recording, I will chop out the front and back parts of the recorded clip using the program 'avidemux' packaged by packman packagers and then I will crop parts of the desktop recording (that I don't want) using microchip's script xvidenc (or h264enc or divxenc).
I may eventually write a how-to or guide on using ffmpeg for screen capture, although in truth I'm very new at this and likely don't have the knowledge to over-come problems of users who were not able to follow the path I took in getting this to work.
... On a personal note, I'm off to Holland on vacation for 5 days, and with limited time and internet access, I won't be spending much of my volunteer time on the forum!