##FFMPEG
Since ubuntu 14.04 instead of ffmpeg is distributed libav-tools fork.
ffmpeg -f alsa -i pulse -f x11grab -r 30 -s 1024x768 -i :0.0 -acodec pcm_s16le -vcodec libx264 -vpre lossless_ultrafast -threads 0 output.mkv
ffmpeg -f x11grab -s 1024x768 -r 25 -i :0.0 -sameq output.mkv
avconv -f x11grab -s 1024x768 -r 25 -i :0.0 output.mkv <<<