Rahul
Rahul

Reputation: 33

Unable to save the video using opencv in videoWriter module in python

Below is the code snippet.

fourcc = cv2.VideoWriter_fourcc(*)
out = cv2.VideoWriter('/Users\Dell\Documents\GitHub\capstoneproject\ProjectS\sample\example_03.mp4',fourcc, 20.0, (640,480))

while(cap.isOpened()):
    ret, frame = cap.read()


        # write the flipped frame
    out.write(frame)

    cv2.imshow('frame',frame)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

in the above it is not able to save the video.

Upvotes: 0

Views: 79

Answers (1)

Ajay.kundu
Ajay.kundu

Reputation: 305

I think you forgot to provide the type of codec. The proper code should be.

fourcc = cv2.VideoWriter_fourcc(*'type of codec')

type of codec can be mp4, XVID etc.

Upvotes: 1

Related Questions