0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

How can speed up a video by 2X in ffmpeg?

Last updated at Posted at 2021-07-20
# 1.25x speed
ffmpeg -i origin.mp4 -filter_complex "[0:v]setpts=0.8*PTS[v];[0:a]atempo=1.25[a]" -map "[v]" -map "[a]" fast.mp4

# 2x speed
ffmpeg -i input.mkv -filter_complex "[0:v]setpts=0.5*PTS[v];[0:a]atempo=2.0[a]" -map "[v]" -map "[a]" output.mkv

# 2x speed
# chatgpt generate the cli
ffmpeg -i input.mp4 -filter:v "setpts=0.5*PTS" -filter:a "atempo=2.0" output.mp4

ffmpeg -i input.mp4 -filter:v "setpts=PTS/2" fast.mp4 only speed up video

shell script

Thank ChatGPT

#!/bin/bash

# Ask the user for the input video file
read -p "Enter the path to the input video file: " input_file

# Ask the user for the speed multiplier
read -p "Enter the speed multiplier (e.g. 2 for 2x speed): " speed_multiplier

# Build the ffmpeg command with the input file and speed multiplier
ffmpeg_command="ffmpeg -i $input_file -filter:v \"setpts=$(bc -l <<< "1/$speed_multiplier")*PTS\" -filter:a \"atempo=$speed_multiplier\" output.mp4"

# Run the ffmpeg command
eval $ffmpeg_command

echo "Done!"

Ref:

0
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?