[FFmpeg-user] Changing video speed

Moritz Barsnick barsnick at gmx.net
Mon Jan 21 15:42:11 EET 2019


On Sat, Jan 19, 2019 at 14:55:55 -0700, JD wrote:
> I have a video that was sped up and now the voice is like
> that of cats in cartoons.
> How can I at least lower the pitch back to normal?
> Since the whole video was sped up, I would rather
> slow down the whole video (video and audio) AND lower
> the pitch back to near normal?

There's a wiki page covering this:
https://trac.ffmpeg.org/wiki/How%20to%20speed%20up%20/%20slow%20down%20a%20video

(There's a part saying "Using a complex filtergraph, you can speed up
video and audio at the same time:". IMO, you can also do this with
separate "simple" filters, using "-vf" and "-af".)

Carl Eugen failed to mention that the setpts filter doesn't change the
audio speed. The audio example in the wiki, using "atempo", changes the
speed while _maintaining_ the pitch. To stretch the audio _including_
pitch change, you need to instead change the sample speed with the
"asetrate" filter, and re-adapt the output sample rate (because your
output file will require a sane sample rate such as 44.1k or 48k) with
"-ar".

E.g. to reduce the speed of the audio to 0.8x of the given input,
assuming an input sample rate of 48000k:

$ ffmpeg -i input -af asetrate=38400 -ar 48000 output

(38400 is 0.8 * 48000. I wish asetrate would understand an "input
sample rate" variable.)

Moritz


More information about the ffmpeg-user mailing list