ffmpeg tips
ffmpeg 从视频中提取音频文件保存为MP3
ffmpeg -i apple.mp4 -f mp3 -vn apple.mp3ffmpeg 从视频中提取音频文件,修改播放速度
ffmpeg -i apple.mp4 -filter:a "atempo=1.3" -f mp3 -vn apple.mp3注意:
- 倍率调整范围为[0.5, 2.0]
#coding:utf-8
#description: MP42mp3
import os,sys
import argparse
import subprocess
def convert(path):
bin = "ffmpeg.exe"
ls = os.listdir(path)
for x in ls:
if x.endswith("mp4"):
cmdargs = '%s -i "%s" -filter:a "atempo=1.3" -f mp3 -vn "%s"' % (bin ,x,x.replace(".mp4",".mp3"))
print cmdargs
if __name__ =="__main__":
if ( os.path.isdir(sys.argv[1])):
path = sys.argv[1]
convert(path)
参考链接:https://blog.csdn.net/matrix_laboratory/article/details/53158307
评论已关闭