As an example :
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out_corner = cv2.VideoWriter('img_corner_1.avi',fourcc, 20.0, (640, 480))
At that place, have to define X,Y as width and height
But, when you create an image (a blank image for instance) you have to define Y,X as height and width :
img_corner = np.zeros((480, 640, 3), np.uint8)