Preparation: ffmpeg needs to be installed
Method: command prompt input
All we need to do is just input:
ffmpeg -n -i input.wav -filter:a "atempo=0.5" output.wav
Where input.wav and output.wav are input files and output files, respectively, and can be other file formats, such as:
ffmpeg -n -i input.m4a -filter:a "atempo=0.5" output.mp3
Among them, 0.5 represents the multiple, and changing to 2 means 2 times speed up.
It can also be processed in batches, such as (Python):
import osimport sys
m4a_path = "./m4a/" # m4a文件所在文件夹
finish_path = "./finished/"
def run(): m4a_file = os.listdir(m4a_path) str1 = '-filter:a \"atempo=2\"' print('m4a') for i, m4a in enumerate(m4a_file): os.system("ffmpeg -n -i "+ m4a_path + m4a + " " +str1 + " "+finish_path + m4a[0:-4] + ".mp3" )
run()
Reference:
https://stackoverflow.com/questions/45441557/how-to-change-speed-of-a-wav-file-while-retaining-the-sampling-frequency-in-pyth/45441708
没有评论:
发表评论