标签:install join https 错误 批处理文件 sub build lse 安装
windows版本下需要先安装ffmpeg工具:
1:先下载指定(https://ffmpeg.zeranoe.com/builds/) 有Static,Shared,Dev三个版本,
2:安装ffmpeg的python扩展,该扩展可以让你直接在python脚本中直接调用,而不需要单独运行命令: pip install ffmpeg-python
4:假如提示ffmpeg为外部命令错误时,将ffmpeg的路径带上:
代码如下:
def getImage(video_path):
base_path = os.path.join(os.path.join(os.getcwd(), "mp4"), video_path)
img_count = 1
crop_time = 0.0
try:
while crop_time <= 22.0: #转化22s的视频
os.system(‘D:\\ffmpeg-20191210-e73688e-win64-static\\bin\\ffmpeg -i %s -y -f image2 -ss %s %s.jpg‘% (base_path, str(crop_time), str(img_count)))
img_count += 1
crop_time += 0.01 #每0.01秒截取一张照片
print(‘视频转化完成!!!‘)
except Exception as e:
print(e)
def save():
dir_s = os.path.join(os.getcwd(), "image")
if os.path.exists(dir_s):
shutil.rmtree(dir_s)
os.mkdir(dir_s)
for root, dirs, tmps in os.walk(os.getcwd()):
for file in tmps:
if file.endswith("jpg") and os.path.exists(os.path.join(dir_s, file)) is False:
shutil.move(file, dir_s)
video_path = "of2.mp4"
getImage(video_path)
save()
标签:install join https 错误 批处理文件 sub build lse 安装
原文地址:https://www.cnblogs.com/zhouzetian/p/12028805.html