What Is the Difference Between asetpts and atempo in FFmpeg Audio Filters?

Viewed 4196

I have been using FFmpeg to slow down or speed up video files (with audio). It seems that to speed up a video, setpts=0.5*PTS should be used. However, when speeding up an audio, asetpts=0.5*PTS and atempo=2.0 are both available. What is the difference between these two options? Which is the better option?

3 Answers

Like setpts, asetpts drops or duplicates audio frame to the specified frame rate while atempo changes the speed of audio.

Comparing asetpts=PTS/2 and atempo=2.0, some information is lost when you use in asetpts. Try it and you can hear the difference.

If you only use setpts=0.5*pts as part of your filter, you'll notice that this only applies to the video stream causing the output to become desynchronized. That's why the atempo=2.0 option is available and intended to be used in conjunction with setpts.

More information can be found here

From the ffmpeg official wiki, we can see that atempo is recommended.

In my own test case, the asetpts can't work. (I used ffprobe to check the pkt_pts, it doesn't change. Also, I played it and it doesn't change too)

Related