Are any codecs included with opencv?

I have been unable to write an uncorrupted video file using:

fourcc = cv2.VideoWriter_fourcc(*'DIVX')
writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height), True)	

I get a file but it is corrupted. If I try to use ‘MJPG’ or ‘MPV4’ with a mp4 extension I get unsupported codec error. Is there any workable fourcc setting and output for opencv 4.4.0+

Change this:
writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height), True)
to:

writer = cv2.VideoWriter(out.avi, fourcc, 30, (width, height))

Link: FOURCC

welcome.

please print(cv2.getBuildInformation()) and report this back to us.

Thanks Christoph,

reporting back, command worked fine…built from git/bin to get what I needed. Best.

Thank you Supra!..best

1 Like

You are welcome, Markworth .