• Featured: How To Screencap in Ubuntu With FFmpeg – from LinuxPurist.com

    by  • August 6, 2012 • Tutorial

    Ok, let’s get straight to the meat and potatoes of the matter; You want to record your desktop, but everything in the Ubuntu Software Center is shit, so let’s get this thing going in the terminal here. SUPER easy, many different configs for your different needs.

    First things first, let’s make sure we have FFmpeg, and if we don’t let’s snag a copy.

    sudo apt-get update && sudo apt-get dist-upgrade (you can skip this if you like)

    This will update your system to a more usable form. It is not mandatory, but suggested so that everyone is on the same page.

    ffmpeg -version

    This makes sure that FFmpeg is installed on your system. If you get anything about it not recognizing the command FFmpeg, then proceed to the next step. If you get some type of version number, SKIP the next step.

    sudo apt-get install ffmpeg

    YAY! STEP ONE IS DONE. YOU SHOULD NOW HAVE FFMPEG.

    To start recording, first we need to make sure we are in our Videos directory in your Home folder. If you are in Ubuntu or any similar distro, you can jump into your video directory like this:

    cd /home/user/Videos

    See the bold text that says user? replace that with your username to access your Videos folder.

    Turn your microphone on if you like, at this point.

    To record a video/audio file in MPG format, use the following command in the terminal line:

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -vcodec mpeg2video -ar 44100 -s wvga -y -sameq sample.mpg

    To record a video/audio file in ASF/WMV Microsoft format, use the following command in the terminal line:

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 10 -i :0.0 -sameq -f asf -ar 48000 -s wvga -ysample.asf

    OR

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 10 -i :0.0 -sameq -f asf -ar 48000 -s wvga -ysample.wmv

    To record a video/audio file in AVI format, use the following command in the terminal line:

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -sameq -f mpeg -ar 48000 -s wvga -ysample.avi

    To record a video/audio file in FLV format, use the following command in the terminal line:

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 10 -i :0.0 -sameq -f flv -ar 44100 -s wvga -ysample.flv

    To record a video/audio file in MP4 format, use the following command in the terminal line:

    • ffmpeg -f alsa -ac 2 -i hw:0,0 -f x11grab -s $(xwininfo -root | grep 'geometry' | awk '{print $2;}') -r 25 -i :0.0 -sameq -f mpeg -ar 48000 -s wvga -ysample.mp4

    When you are done press Q, or Control-C in the terminal window to stop the desktop recording.

    About

    James is an active member of his local tech community in Memphis, TN. He is a student of Science at the local college and an Information Security hobbyist, as well as an outspoken Linux Advocate, and open source proponent. After a hard day at the console, James likes to enjoy a vintage 2012 Mountain Dew, with a robe and a pipe by the fire.