Record video using ffmpeg
Grab the screen and output it
ffmpeg -f x11grab -i :0.0 out.mkv
Play the video
ffplay out.mkv
Specify the resolution if needed along with the audio
ffmpeg -video_size 1366x768 -framerate 25 -f x11grab -i :0.0 -f alsa -ac 2 -i hw:0 out.mkv