Linux – Record a time-lapse screen-capture directly in ffmpeg

ffmpeglinuxscreen capturetimelapsevideo

Can I use ffmpeg to record my Xorg desktop (without audio) at one frame a second into a video file that will play back the frames at 30 frames per second without requiring a conversion process?

The following command records my left display at 1 frame per second but the resulting video will advance the video frame once per second.

ffmpeg -r 1 -f x11grab -s 1920,1080 -i :0.0+0,0 -vcodec libx264 -crf 0 -preset ultrafast -threads 0 out.mkv

Known alternatives:

  1. Make screenshots at an interval, then combine videos using mencoder
  2. As #1 but using ffmpeg
  3. Record a video of the desktop with ffmpeg at 1 fps or less, if the encoder supports such numbers and speed up the video afterwards via ffmpeg.

If it is not possible with ffmpeg alone, would a combination of import and ffmpeg or some other tools allow the time-leap video to be ready as quickly as possible after ending the recording?

Best Answer

This should work:

ffmpeg -framerate 1 -f x11grab -s 1920,1080 -i :0.0+0,0 -vf settb=\(1/30\),setpts=N/TB/30 -r 30 -vcodec libx264 -crf 0 -preset ultrafast -threads 0 out.mkv

EDIT: escaped parentheses from the shell

Related Question