Easy Linux screen captures with ffmpeg
cmw.osdude 120000QT77 Comment (1) Visits (8499)
One of the challenges for using Linux is to translate everyone else's view of the world into what works for me. I remember when I was wanting to print a document in a book form, with the pages automatically set up to stack. I searched and searched in vain to find a tool that would do it and found nothing. Then I discovered that the function was already built into the printing system.
Here we go again! This time it's with video capture of the screen for doing demos. I know that a lot of people use Camtasia and such for Windows, but that's not available in Linux-- at least not that I've found. As it turns out there is a very straightforward way of capturing video and audio using ffmpeg. Thanks to Alexandru Csete with his wiki page that got me started.
I'm going to give you a quick demo of how I do this in the video below.
So... what did I do there? I actually did 2 captures simultaneously. The first one was started in another tab, using an almost identical command. The second was for show. At the end of the video I didn't stop talking before I switched tabs to stop the primary capture, so you get a glimpse of it. The audio is being captured through my laptop microphone -- which is why it's all so noisy. However, it would be very easy for me to change this to use my USB microphone or any other input I wanted.
Here is the command that I used:
ffmpeg -f alsa -ac 2 -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0 -acodec pcm_s16le \ -vcodec libx264 -preset ultrafast -crf 0 -threads 0 nop.mkv
-f alsa -ac 2 -i pulse all describe how I want the audio captured, going through alsa and recording in stereo.
I can easily write a script for this and attach it to a button (if I must). I'll probably just set up a script called godemo which will fire everything up and let me press a key to start capturing. This means I can record a demo almost instantly. Expect more of this, because I'm exploring a number of social media techniques in Linux and some of it is pretty good stuff that you will want to use. This is just a quickie because I was pretty excited to find it.