import cv2
def test01():
uri = ""
cap = cv2.VideoCapture(uri)
# Define the codec and create VideoWriter object
# fourcc = cv2.VideoWriter_fourcc(*'XVID')
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter('video_save.mp4', fourcc, 30.0, (1920, 1080))
while cap.isOpened():
ret, frame = cap.read()
if ret:
# frame = cv2.flip(frame, 0) # 翻转
# write the flipped frame
out.write(frame)
cv2.imshow('frame', frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
# Release everything if job is finished
cap.release()
out.release()
cv2.destroyAllWindows()