I'm trying to use slow motion effect on my videos. Let's say I have a 2 minutes long video and I want to use this effect between 20 and 30 seconds.
I found this command from a blog:
ffmpeg -i input.mp4 -vf "setpts=(<speed>/1)*PTS" output.mp4
But i don't know how to implement duration in it.
Best Answer
The
setpts
filter does not have timeline editing functionality like some of the other filters (refer toffmpeg -filters
to see which do).This means you will have to make a slow video and concatenate it into your normal speed videos or perform some fancy filtering.
Example: video only
Using the
trim
,setpts
, andconcat
filters:The input in this example has a duration of 60 seconds. 0-10 will be normal speed, 10-30 will be 50% slower, and 30-end will be normal speed resulting in an output with a duration of ~80 seconds:
Example: with audio
slowmoVideo
Alternatively you could try slowmoVideo which will probably result in a better looking slowdown effect compared to ffmpeg alone (slowmoVideo uses ffmpeg). It also allows you to use Bézier curves to plot the effect so you can smoothly initiate the effect, and it can include motion blur.