Record Desktop

ffmpeg can be used to record the desktop.

  ffmpeg -f x11grab -s wxga -r 15 -i :0.0 -qscale 5  out.avi

wxga specifies the resolugion 1366 x 768.

ffmpeg also supports cutting the video:

  ffmpeg -i out.avi -ss 4 -t 00:02:07.0 -vcodec copy cut.avi

The parameter ss skips the first x seconds. The parameter t specifies the duration in the format HH:MM:SS.sss.

Converting the video from avi to mpeg:

  ffmpeg -i cut.avi -vcodec libx264 -preset veryslow -crf 0 transcoded.mp4 

Slow down or speed up recording:

  mencoder -ovc copy -oac copy -speed .5 transcoded.mp4 -o transcoded-slow.mp4
  ffmpeg -i transcoded.mp4 -vf setpts=2*PTS -an transcoded-slow.mp4

Adding subtitle:

  ffmpeg -i subtitle.srt subtitle.ass
  ffmpeg -i transcoded-slow.mp4 -vf "ass=subtitle.ass" out.avi