Ask Your Question

Revision history [back]

I hope this helps.

videoFilePath = "/to/your/video.avi"

videoFile =cv2.VideoCapture(videoFilePath)

frame_width = int( videoFile.get(cv2.CAP_PROP_FRAME_WIDTH))

frame_height =int( videoFile.get( cv2.CAP_PROP_FRAME_HEIGHT))

fourcc = cv2.VideoWriter_fourcc(*'XVID')

out = cv2.VideoWriter('output.avi', fourcc, 1, (frame_height, frame_width))