提前谢谢!
这是我使用的代码:
import cv2
import numpy as np
cap = cv2.VideoCapture(r'C:\Users\CSC\Desktop\SmartDesert\1.mp4')
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(r'C:\Users\CSC\Desktop\SmartDesert\1_Output.mp4', fourcc, 25, (640, 480))
while True:
ret, frame = cap.read()
if ret == True:
b = cv2.resize(frame, (640, 480), fx=0, fy=0, interpolation=cv2.INTER_CUBIC)
out.write(b)
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()