'How to fix this VideoWriter issue?

COLORS = [(0,255,0),(0,0,255)]
fourcc = cv2.VideoWriter_fourcc(*"DIVX")
writer = cv2.VideoWriter('output.avi', fourcc, 5,(888,500))
writer = VideoWriter('output.avi',(frame.shape[1], frame.shape[0]))
writer.open()

I am getting error on the 5th line of the code snippe

NameError: name 'VideoWriter' is not defined



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source