Menu

Post image 1
Post image 2
1 / 2
0

How to Speed Up or Slow Down Video with FFmpeg

DEV Community·Javid Jamae·27 days ago
#LNyOXVlb
#ffmpeg#api#tutorial#speed#atempo#setpts
Reading 0:00
15s threshold

Originally published at ffmpeg-micro.com . You need to speed up a video for a timelapse effect or slow it down for dramatic slow motion. FFmpeg handles both with two filters: setpts for video and atempo for audio. But getting them to work together without desyncing audio or producing choppy output trips up most developers. This guide covers both the raw FFmpeg CLI commands and how to do the same thing with a simple API call through FFmpeg Micro. How setpts Controls Video Speed The setpts (set presentation timestamps) filter controls how fast video frames play back. The formula is simple: multiply the PTS value to slow down, divide to speed up. Double speed (2x faster): ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" -an output_fast.mp4 Enter fullscreen mode Exit fullscreen mode The 0.5*PTS halves the timestamp gaps between frames, so they display twice as fast. The -an flag removes audio because audio and video speed need separate handling.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More