1 下载ffmeg
wget https://github.com/BtbN/FFmpeg-Builds/releases/download/latest/ffmpeg-master-latest-win64-gpl.zip
把bin目录配置到path中,或者cd到ffmeg的bin目录下调用脚本
2 下载pydub
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pydub
3 使用
# 导入
from pydub import AudioSegment
song = AudioSegment.from_wav("G:/click2.wav")
# 剪辑前一秒 1000=1s
one_s = 1000
one_s_song = song[:one_s]
# 导出
one_s_song.export("G:/click3.wav", format="wav")
<_io.BufferedRandom name='G:/click3.wav'>
4 教程
https://github.com/jiaaro/pydub
标签:song,python,剪辑,AudioSegment,https,wav,pydub From: https://www.cnblogs.com/80sVolxxxx/p/18408034