[FFmpeg-user] How to slow down a video

Ulf Zibis Ulf.Zibis at CoSoCo.de
Tue May 5 15:27:49 EEST 2020


Am 05.05.20 um 13:25 schrieb Michael Koch:
> Am 05.05.2020 um 13:21 schrieb Ulf Zibis:
>> Am 04.05.2020 um 12:56 schrieb Michael Koch:
>>> Am 04.05.2020 um 11:00 schrieb Ulf Zibis:
>>> >//>/Am 27.03.20 um 04:06 schrieb Ted Park: />>/Hi, />>//>>>/for video: -vf setpts=0.5*PTS />>>/for audio: -af atempo=2 />>//>>/Actually, he wanted to slow down the video so you probably meant the />>/reciprocal of this, 2*PTS and atempo 1/2 />//>/Thanks alot, this works fine. />//>/Now I want to tweak a little bit more. I want to slow down the video />/by 1.4 and then increase the audio frequency by 1.25. So I did: />/ffmpeg -i in.mp4 -vf setpts=PTS*1.4 -af />/asetrate=48000*1.25,atempo=1/1.25/1.4 out.mp4 />//>/This resulted in really bad audio quality. The reason is maybe, that />/the sampling rate of the output was transformed to 64.000, but I want />/48.000. I guess there is a possibility to get a better result by using />/-af aresample, but I have problems to understand it's syntax. /
>>> try  -af aresample=48000
>> Do you mean, I should add this at the end of my filter chain? I can't imagine, that using it singular instead would do what I want.
>>
>
> yes, add it at the end of the filter chain.

Thanks!

I now tried:
ffmpeg -i in.mp4 -vf setpts=PTS*1.4 -af atempo=1/1.25/1.4,asetrate=48000*1.25,aresample=48000 out.mp4

The audio quality is still bad, i.e. the voices flip in a way. Therefore I'm thinking about using aresample with:
async
     For swr only, simple 1 parameter audio sync to timestamps using _stretching_, _squeezing_, filling and trimming. Setting this to 1 will enable filling and trimming, larger values represent the maximum amount in samples that the data may be stretched or squeezed for each second. Default value is 0, thus no compensation is applied to make the samples match the audio timestamps.

But I'm lost how use it correctly. I want to slow down the video by 1.4 and then increase the audio frequency (pitch) by 1.25.

Can you give me some hint?

-Ulf



More information about the ffmpeg-user mailing list