This slows down one part of a video and keeps the rest as is.
ffmpeg -i Soon.mp4
-preset superfast -profile:v baseline output.mp4
How does it work?
atrim filters cut the video into different parts, from 0–2 seconds, from 2–5, and from 5 to the end.
- In each part a
asetpts filter is applied, which, when using the option
PTS-STARTPTS, "resets" the presentation timestamps of each frame in each part, so that they can later be concatenated easily.
- Each part is given an output label (e.g.
- For the video parts that need to be slowed down, every presentation timestamp is doubled (
2*(…)), which effectively halves the speed of the video. If you wanted to speed up the video, use a multiplier lower than 1.
- For audio parts to be sped up / slowed down, use the
atempo filter, whose parameter is the speedup (e.g.,
0.5 = half speed).
- These parts are finally concatenated using the