python+opencv图片合成视频

学习笔记

#coding=utf-8
import cv2

fps = 24
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
videoWriter = cv2.VideoWriter('test3678.avi', fourcc, fps, (1080,1920))
for i in range(1,100):
    p2=i
    img12 = cv2.imread('image/IMG_3678/'+str(p2)+'.jpg')
   # cv2.imshow('img', img12)
   # cv2.waitKey(1000/int(fps))
    print(str(p2))
    videoWriter.write(img12)
videoWriter.release()

成功合成了视频,然而视频打不开

你可能感兴趣的:(python+opencv图片合成视频)