Ffmpeg – Resampling 240 FPS video down to 30 FPS

ffmpeg

I have a folder of frames (saved as jpg) extracted from a 240 FPS video. What I’d like to do is create a new video at 30 FPS (i.e. sampling only every 8th frame – since 240/30=8).

I have tried the following command:

ffmpeg -i %05d.jpg "select='mod(n,8)’” -r 30 output.mp4

However, the video does not look correct (in fact when I ffprobe, the resulting video does not have the correct number of frames).

I can’t work out what I’m doing wrong. Does anyone have any suggestions?

Best Answer

ffmpeg assumes that image sequences have a framerate of 25 unless you tell otherwise.

There are two ways to do this:

ffmpeg -framerate 240 -i %05d.jpg -r 30 output.mp4

or

ffmpeg -i %05d.jpg "select='not(mod(n,8))',setpts=N/30/TB” -r 30 output.mp4