How can I speed up a video without pitch distortion in Linux?
setpts & atempo filters
Examples using ffmpeg
with the setpts and atempo filters:
Fast motion
ffmpeg -i input -filter_complex "[0:v]setpts=PTS/2[v];[0:a]atempo=2[a]" -map "[v]" -map "[a]" output
Slow motion
ffmpeg -i input -filter_complex "[0:v]setpts=PTS/0.5[v];[0:a]atempo=0.5[a]" -map "[v]" -map "[a]" output
Range for atempo value is 0.5-100.
setpts & rubberband filters
Alternatively you can use the rubberband filter instead of atempo, and it may sound better, but your ffmpeg
will need to be compiled with --enable-librubberband
. You can refer to ffmpeg -filters
to see if you can use it.
Fast motion
ffmpeg -i input -filter_complex "[0:v]setpts=PTS/2[v];[0:a]rubberband=tempo=2[a]" -map "[v]" -map "[a]" output
Slow motion
ffmpeg -i input -filter_complex "[0:v]setpts=PTS/0.5[v];[0:a]rubberband=tempo=0.5[a]" -map "[v]" -map "[a]" output