ffmpeg linux capture desktop

C++
$ ffmpeg -f x11grab -s 1280x1024  -r 25 -i :0.0+0,0 out.mp4
Source

Also in C++: