Step 1: Install PulseAudio Volume Control and ffmpeg
Search your distribution’s software repository to install them. On a typical Ubuntu like OS the terminal command would be
$ sudo apt-get install pavucontrol ffmpeg
Step 2: Record
Use following command to record your desktop.
ffmpeg -f alsa -i default -f x11grab -s 1366x768 -r 30 -i :0.0 -sameq filename.avi
Parameters
x11grab: Record the desktop
s: Size of the recording area (For true HD it would be 1920×1080 i.e 1080p). However, it depends upon your monitor resolution. Anything greater will fail, Use Displays to find the resolution.
r: Frame rate. If you intend to record game play videos, adjust the frame rate until you don’t get choppy output.
-f and -i: These two variable are for audio. If default does not work, use “pulse” instead.
Note: If the recording fails, try to change the format. E.g mpg, mkv etc.
Step 3: Switching between internal audio and microphone
While recording, open PulseAudio Volume Control (pavucontrol) and in the Recording section, switch between microphone and Internal audio (see figure below). Use “Built-in Audio Analog Stereo” for recording from microphone and “Monitor of Built-in Audio Analog Stereo” to record sound playing in your computer. Make sure you are actually recording the desktop to change these options, ffmpeg option does not show up in pavucontrol until you start the recording.
Step 4: Create a script
Create a script, say recorddesktop.sh, so that you don’t have to remember it all the time. Create the bash file in a directory you use to add scripts e.g ~/bin (/home/username/bin) and add it to PATH variable in .bashrc as (export PATH=$PATH:~/bin). Content of that file would be something like this (Adjust resolution and other parameters as you prefer).
#!/bin/bash # Example recorddesktop.sh output.avi STR="@" FILENAME="out.avi" if [ $STR ]; then FILENAME="$@" else echo "No file name specified, using out.avi" FILENAME="out.avi" fi #FILENAME="$(echo $FILENAME | sed 's/\ /\\ /g')"; echo "Recording into $FILENAME ..."; ffmpeg -f alsa -i default -f x11grab -s 1366x768 -r 30 -i :0.0 -sameq "$FILENAME"
Cheers !!

Here’s my command, will automatically use your desktop size and the parameters are for YouTube. Adjust “-b:v 16384k” for desired bitrate video quality.
ffmpeg -f alsa -i hw:0,0 -f x11grab -r 15 -s $(xwininfo -root | grep ‘geometry’ | awk ‘{print $2;}’) -i :0.0 -acodec wmav1 -vcodec flv -b:v 16384k output.avi
Another command to find the dimension could be
xdpyinfo | grep ‘dimensions:’|awk ‘{print $2}’
Beaudy. Very simple and enough to play with and get yourself in trouble, but, also enough to get you going practically.
Thank you
Reblogged this on Lost Packets.
Reblogged this on Ace Worldwide Services and commented:
Just great and ideal for the use!
Awesome. Thanks!
i found another link http://www.anotation.com/how-to-capture-screen-using-ffmpeg-on-linux/ with nice detailed steps