Speed Up Video 2x with FFmpeg on Linux
To speed up a video by double its original speed using FFmpeg on
Linux, you need to adjust both the video stream and the audio stream to
keep them in sync. This is achieved by using the video filter
-filter:v "setpts=0.5*PTS" to compress the presentation
timestamps by half, and the audio filter
-filter:a "atempo=2.0" to double the audio playback speed.
Combining these two filters into a single command allows you to
efficiently accelerate your media files right from your terminal without
losing quality.
The Basic FFmpeg Command
To double the speed of your video and audio simultaneously, open your terminal and run the following command:
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -filter:a "atempo=2.0" output.mp4Understanding the Command Breakdown
-i input.mp4: Specifies the path to your source video file.-filter:v "setpts=0.5*PTS": Thesetpts(set presentation timestamp) filter changes the speed of the video track. Multiplying the PTS by0.5causes the frames to display at twice the speed, effectively cutting the video duration in half.-filter:a "atempo=2.0": Theatempofilter adjusts the audio speed. A value of2.0doubles the speed of the audio track while automatically adjusting the pitch so the voices do not sound like chipmunks.output.mp4: The name and format of your newly generated, high-speed video file.
Advanced Alternative: Speeding Up Without Re-encoding Audio
If your video does not have audio, or if you plan to discard the audio entirely to save processing time, you can drop the audio track completely. This method is much faster because FFmpeg does not have to re-encode any audio data:
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -an output.mp4The -an flag tells FFmpeg to disable audio recording in
the output file, leaving you with a silent, double-speed video.