https://www.cnblogs.com/yeungchie/
提取音频
import moviepy.editor as m
audio = m.AudioFileClip(r'xxx.mp4')
audio.write_audiofile(r'xxx.mp3')
读入音频
from pydub import AudioSegment as a
sound = a.from_mp3(r'xxx.mp3')
截取音频
- 截取 0~7 s
s7 = sound[:7*1000]
- 截取 5m 29s 到最后
s5_29 = sound[(5*60+29)*1000:]
保存音频
s7.export(r's7.mp3')
原创文章,作者:carmelaweatherly,如若转载,请注明出处:https://blog.ytso.com/273564.html