11

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?

1
  • Is there a super need for this, like making sped up demo or how-to videos or something?
    – Xen2050
    Dec 9, 2015 at 7:24

1 Answer 1

12

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

3
  • With the command from this answer will be 1 screenshot per second taken, shown later at 30 fps - resulting in 30x speedup. In case you want more, you can e.g. use -framerate 0.5, resulting in a 60x speedup, still shown at 30 fps.
    – Zaroth
    May 23, 2019 at 21:43
  • 2
    It would be nice, if you could elaborate on the options. Or omit them if not needed for a MWE. May 8, 2020 at 14:06
  • i'm trying to record at 1 frame per 3 seconds, but when the recording starts I get the message The driver changed the time per frame from 1000/333 to 1/5 i.e. it sped it up from 0.333fps to 5fps which is not what I want! How do I force it to record a slower frame rate?
    – Michael
    Jun 18, 2022 at 20:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .