OpenCV python .avi video doesn't work
Hello.
I have a script which uses OpenCV and python and creates a video ( avi format ) from a set of png images.
The resolution of these images is good.
The problem is that the resolution of the resulting video is very low with '1' as fourcc parameter. But if I change this parameter as cv2.VideoWriter_fourcc(*'DIVX') or as cv2.VideoWriter_fourcc('D','I','V','X') the result is an .avi video with 0KB and an error.
How can I improve the resolution and make this work?
Is the low resolution related to the images format?
CODE:
writer = cv2.VideoWriter( "C:\Users.../demo3_4.avi", -1, 1, ( width, height ) ) nFrames = 24
for i in range( 1, nFrames ): img = cv2.imread( os.path.join( str( inf ), "colorraster%d.jpg"%i ) ) writer.write( img )
cv2.destroyAllWindows()
writer.release()
Hopes you help me Thank you
on windows, you need the divx codec installed (per machine) , e.g. from here: http://fourcc.org/
Thanks for the answer. Can you tell me which one I must download from here http://fourcc.org/downloads/?
Ok, I installed the Codec Pack All in 1 6.0.3.0. I run but the video has 0 KB and this message appears: Windows Media Player encountered a problem while playing the file. Can you help me?