批量导出MP4的音频 Python+ffmpeg

匿名 (未验证) 提交于 2019-12-02 22:11:45

需求:先把把视频素材用 无损视频裁剪合并编辑工具SolveigMM Video Splitter Business Edition 5 剪切成很多段mp4,然后用这个脚本提取所有mp4的音频

import os  #批量导出MP4的音频  indir = "G:/PythonIO/video"  def dirlist(path, allfile):     filelist = os.listdir(path)      for filename in filelist: #广义         filepath = os.path.join(path, filename)         if os.path.isdir(filepath):             dirlist(filepath, allfile)          elif filepath.endswith("mp4"):              filepath = filepath.replace("\\","/")             allfile.append(filepath)             print(filepath)     return allfile   allfile = dirlist(indir,[]) i = 1 for infile in allfile:     os.system("ffmpeg -i \""+ infile +"\" -f mp3 "+str(i)+".mp3")     i+=1 
文章来源: https://blog.csdn.net/wsl985/article/details/90344597
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!