Also see WebM, Theora, and CheatSheet/Photointervalometry for other FFmpeg-related stuff.
Creating a screencast
1 screencap() {
2 RESOLUTION="1920x1080" # Make this the capture size
3 QUALITY="libvpx-1080p" # Run ls /usr/share/ffmpeg and pick a preset
4 THREADS="16" # Change this to the amount of cpu threads you want ffmpeg to use
5 OUTPUT="VideoFileName.mp4" # Leave the extension, change the file name to whatever
6
7 ffmpeg -f alsa -i pulse -vol 255 -f x11grab -r 25 \
8 -s $RESOLUTION -i :0.0+0,0 -acodec pcm_s16le \
9 -vcodec libx264 -vpre $QUALITY \
10 -threads $THREADS temp.mkv
11
12 ffmpeg -i temp.mkv -vcodec libx264 -vpre $QUALITY -strict -2 -crf 22 -threads $THREADS $OUTPUT
13
14 rm temp.mkv
15 }
Source: Reddit