赞
踩
import os.path as osp import os def mkdir_if_missing(d): if not osp.exists(d): os.makedirs(d) if __name__ == '__main__': for i in range(1, 28): input_video_path = 'E:/ysz/' + str(i) + '.mp4' result_root='E:/ysz/' + str(i) mkdir_if_missing(result_root) output_video_path = osp.join(result_root, str(i) + '_r.mp4') crop_cmd_str ='ffmpeg -i {} -vf crop=iw/2:ih:960:0 {}'.format(input_video_path,output_video_path) os.system(crop_cmd_str) keyframe_cmd_str="ffmpeg -i {} -vf select='eq(pict_type\,I)' -vsync 2 -s 960*1080 -f image2 {}/%05d.jpg".format(output_video_path,result_root) print(keyframe_cmd_str) os.system(keyframe_cmd_str)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。