input_source = "sample.mp4" cap = cv2.VideoCapture(input_source) hasFrame, frame = cap.read()
vid_writer = cv2.VideoWriter('output.avi',cv2.VideoWriter_fourcc('M','J','P','G'), 10, (frame.shape[1],frame.shape[0])) vid_writer.write(frame)
Above is short code snippets to put one frame. Please tell me how to make it for 2 frames in a single window output.