I"m experiencing the same problem a lot of other people are experiencing with openCV, in that when I use the following code, openCV fails to write a video file. I am using openCV 2.4.10 and python 2.7
out = cv2.VideoWriter('C:\motion\output.avi',cv2.cv.CV_FOURCC('X','V','I','D'), 20, (640,480),True)
a viable work around is to replace the second argument with -1, which gives a popup window with coded choices when the program is run. When one of these is selected, the video is created.
The problem is, I am adding it to a motion detection software which writes a 15 second timestamped file every time it detects motion, and obviously selecting a codec manually does not work with this scheme.
Is there a way to direct openCV to select one of these codecs using VideoWriter, or some other method?
THINGS I HAVE TRIED ALREADY: copying opencv_ffmpeg.dll to python folder and selecting FMP4 codec from FOURCC