FFmpeg: slow down audio+video.

Step-by-Step descriptions of how to do things.
Post Reply
User avatar
peter_b
Chatterbox
Posts: 371
Joined: Tue Nov 12, 2013 2:05 am

FFmpeg: slow down audio+video.

Post by peter_b »

SWIM honestly had to admit that "Peppa Pig" episodes freak them out: The episodes "feel" way tooo fast and without any air to breathe in between.

So I offered SWIM this ffmpeg-recipe to slow things down:

Code: Select all

$ ffmpeg -i peppa-Science_Museum.mp4 \
-filter_complex "[0:v]setpts=1.2*PTS[v];[0:a]atempo=0.834[a]" \
-map "[v]" -map "[a]" \
-c:v libx264 -crf 23 \
-c:a aac -b:a 128k \
peppa-01-Science_Museum.mp4
The values for "setpts" and "atempo" seem weird:
"1.2 to 0.834"

That's because ffmpeg's code for changing video tempo multiplies PTS timestamp positions, whereas "atempo" for audio assumes a scaling factor to realtime (=1.0) playback speed.

So, this would be "twice as slow" (2.0) = (0.5) half the realtime speed"

Code: Select all

setpts=2.0PTS; atempo=0.5
So: 1.2PTS would be "point-2 something-slower than realtime".

Let's call this "1.x" for video "video-factor". And atempo can be calculated like this:
atempo = 1 / video-factor
So 1/1.2 = 0.83333333333333333333... = "0.834"
Post Reply