原视频

代码
import cv2
video = cv2.VideoCapture('inference/video/lianzhang.mp4')
width = int(video.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(video.get(cv2.CAP_PROP_FRAME_HEIGHT))
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
output = cv2.VideoWriter('inference/video/output.mp4', fourcc, 30.0, (height, width))while video.isOpened():ret, frame = video.read()if not ret:breakrotated_frame = cv2.rotate(frame, cv2.ROTATE_90_COUNTERCLOCKWISE)output.write(rotated_frame)cv2.imshow('Rotated Video', rotated_frame)if cv2.waitKey(10) & 0xFF == ord('q'):break
video.release()
output.release()
cv2.destroyAllWindows()
旋转后
