2
votes

I am working on a Deep Learning algorithm for videos. Given a video footage I want to save my results on another video. To do so, I am using OpenCV and Python on Windows. OpenCV worked correctly for my video preprocessing to train my model. I need to save my results but the VideoWriter method gives me no output file.

fourcc = cv2.VideoWriter_fourcc(*'DIVX')
outVid = cv2.VideoWriter( 'outputfile.avi', fourcc, fps, tuple(shape.astype(np.int)), 1)

I process every frame and then I write this frame in the output file

outVid.write(np.uint8(RECONSTRUCT_IMG))

There is no issue returned by the console, but the output file is a 6 Ko video file, which cannot be read obviously.

I tried several codec for the fourcc (*'DIVX' should be used on Widows according to OpenCV Documentation).

Anyone with a similar issue?

1
give your program access to opencv_ffmpeg*.dll during runtime, e.g. by placing it into the workung directory. - Micka
if that does not help, try different codecs lile MJPG to limit/narrow error sources - Micka

1 Answers

0
votes

check that you have rights to write in this directory. If it was created by a root user or superuser, you might not have access.

I just remove and create the dir again and it worked