OpenCV VideoWriter Not Writing to Output.avi
The reason of error is the differences between the dimension of the cropped_frame
(640,340) and the dimension declared in the writer
(640,360).
So the writer should be:
out = cv2.VideoWriter('output.avi', fourcc, 20.0,(640,340))