Slow down or speed up: altering the speed / framerate with ffmpeg.

ffmpeg video

I 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.

© Amy Tabb 2018 - 2023. All rights reserved. The contents of this site reflect my personal perspectives and not those of any other entity.