Slow down or speed up: altering the speed / framerate with ffmpeg.
22 Jun 2023I used the ‘raw bitstream method’ of ffmpeg to increase the framerate of a video, see trac.ffmpeg.org for more details and options.
The raw bitstream method:
This method is lossless and apart from changing the timestamps, copies the video stream as-is. Use this if you require no other changes to your input video.
And then for a 15 frames per second video I did the following to speed it up to 45 frames / second (the -r
flag):
ffmpeg -i some.mp4 -map 0:v -c:v copy -bsf:v h264_mp4toannexb raw.h264
ffmpeg -fflags +genpts -r 45 -i raw.h264 -c:v copy output.mp4
A note: to use the h264_mp4toannexb
filter I needed to use a .mp4
video, and not another type video, as input.