import subprocess import os # ffmpeg -i /data/video_1.mp4 -f image2 -vf fps=fps=1/60 -qscale:v 2 /data/mp4-%05d.jpg def videoFileName(videoDir, framesDir, ffmpegCmd): videoFiles = os.listdir(videoDir) for video in videoFiles: sinVideoDir = os.path.join(videoDir, video) if (sinVideoDir.endswith(".avi")): videoName = os.path.basename(sinVideoDir) videoBaseName = videoName.rsplit('.') curVideoFrameOut = framesDir + '\\'+ "%04d.jpg" video2framesCmd = ffmpegCmd + " -i " + sinVideoDir + " -f image2 -vf fps=fps=30 -qscale:v 2 " + curVideoFrameOut subprocess.call(video2framesCmd, shell=True) if __name__ == "__main__": ffmpegCmd = "D:\\Anaconda3\\envs\\pytorch1.10\\Library\\bin\\ffmpeg.exe" # ffmpeg 路径 # frameDir = "E://ImageTe
文章来源地址https://www.toymoban.com/news/detail-403230.html
文章来源:https://www.toymoban.com/news/detail-403230.html
到了这里,关于python 调用ffmpeg 命令行对批量视频进行图片分解并保存到对应文件夹的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!