3

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?

1 Answer 1

4

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
2
  • 1
    This works! Can you explain why I needed to add the setpts part in?
    – Kyle Jones
    Commented Dec 15, 2016 at 16:28
  • If output framerate is not set, it uses the input framerate, here 30. The select filter is passing along each 5th frame with its timestamp i.e. X.00 seconds, X.16 seconds, X.33 seconds, X.50 seconds, X.66 seconds, X.83 seconds..etc, so ffmpeg duplicates frames to get 30 fps. The setpts retimes the output so that each 30 frames from the select fit within a second.
    – Gyan
    Commented Dec 15, 2016 at 16:36

You must log in to answer this question.

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