Using every Nth image in sequence to create video using FFmpeg
I have a series of timelapse images that I am using to generate a video. These images are large (1080p) so I am trying to take up as little space on my computer as possible. I currently have about 3500 images. If I use FFmpeg to generate a video at 30fps and 3500kb/s the file is about 50MB which is not really a feasible size to be used in PowerPoint presentations. So I would like to use FFmpeg to generate a video but only use every Nth frame from this image sequence in the video. I have found a bunch of posts that suggest ways to do this but all of which are taking an existing video and cutting it down. I have attempted using the select
command to achieve this but to no avail. This is the command that I have been using:
ffmpeg -framerate 30 -i Image%08d.jpg -filter:v select='not(mod(n\,5))' -b:v 3500k Output.mp4
Anyone have any suggestions?
Solution 1:
You can just use CRF mode, instead of specifying a bitrate:
ffmpeg -framerate 30 -i Image%08d.jpg -crf 23 Output.mp4
Lower values are better but produce larger files. 18-28 is a decent range.
To use every 5th frame,
ffmpeg -framerate 30 -i Image%08d.jpg -vf "select='not(mod(n,5))',setpts=N/30/TB" -crf 23 Output.mp4