Make short timelapse movie from long boring movie?

I have an .mp4 file to turn into a timelapse movie.

How can I encode every n frames from the source movie into a new movie file, preferably using ffmpeg? Solutions that extract a bunch of stills from the original and then re-encode are not OK, it will use too march hard disk space (but solutions that just use temporary images one by one and pipe them in are OK)

I found the following video filter:

ffmpeg -i in.mp4 -vf select='not(mod(n\,25))' out.mp4

But it seems to need tweaking, my output video is now still the same length but with a very slow framerate.


Using a complex filtergraph, you can speed up video and audio at the same time:

Factor of 2:

ffmpeg -i input.mkv -filter_complex '[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]' -map '[v]' -map '[a]' output.mkv

Factor of 4:

Using a complex filtergraph, you can speed up video and audio at the same time:

ffmpeg -i input.mkv -filter_complex '[0:v]setpts=0.25*PTS[v];[0:a]atempo=2.0,atempo=2.0[a]' -map '[v]' -map '[a]' output.mkv

etc.