In [4]:
# Define the codec and create VideoWriter object.The output is stored in 'output.avi' file.
# Define the fps to be equal to 10. Also frame size is passed.

cv2.VideoWriter('output_py.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 10, (frame_width,frame_height))