Speed Up FFmpeg Video Stream 4x Using setpts

To speed up a video stream by a factor of 4 using FFmpeg, you need to manipulate the Presentation Time Stamps (PTS) using the setpts video filter. This article provides the exact command-line syntax required to accelerate your video’s playback speed by 4x, explains the math behind the filter, and details how to adjust the accompanying audio stream to maintain synchronization.

To speed up the video track only, use the setpts filter and multiply the PTS by 0.25 (the reciprocal of 4).

ffmpeg -i input.mp4 -filter:v "setpts=0.25*PTS" output.mp4

By reducing the presentation timestamp of each frame to a quarter of its original value, FFmpeg displays the frames four times faster. However, this command only affects the video stream, meaning the original audio will no longer be in sync.

To speed up both the video and the audio by a factor of 4, you must use a complex filtergraph. The audio speed is adjusted using the atempo filter. Because the atempo filter only supports speed factors between 0.5 and 2.0, you must chain two atempo filters together (2.0 multiplied by 2.0 equals 4.0) to achieve the 4x audio speedup:

ffmpeg -i input.mp4 -filter_complex "[0:v]setpts=0.25*PTS[v];[0:a]atempo=2.0,atempo=2.0[a]" -map "[v]" -map "[a]" output.mp4

This command takes the input video and audio streams, applies the 0.25x PTS filter to the video, applies the chained 2.0x tempo filters to the audio, and maps both processed streams to the final output file.