video

cap = cv2.VideoCapture("./data/2020-10-22-14-09-22.mp4")

frame = cap.read()

fourcc = cv2.VideoWriter_fourcc(*'MJPG')

videoname = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())

# vout = cv2.VideoWriter('output/' + videoname + '.avi', fourcc, 30.0, (1280, 720))

vout = cv2.VideoWriter('output/'+videoname + '_tusimple.avi', fourcc, 20.0, (1280, 720))

while(1)

  rval,frame= cap.rean()

  if rval== false:

   break

 vout.write(frame)

 

上一篇:OpenCV 保存视频


下一篇:OpenCV学习笔记