0

I am running into strange problems with the Python wrapper for OpenCV. I am using the cv2 binding and have been able to do a lot with it but the latest problem is my inability to create a VideoWriter.

When I try to create a video writer using this command:

cv2.VideoWriter('foo.out.mov', cv2.cv.CV_FOURCC('m','p','4','v'), 25, (704, 480), 1)

I get the following error:

error: /builddir/build/BUILD/OpenCV-2.3.1/modules/highgui/src/cap_gstreamer.cpp:483:     error: (-210) Gstreamer Opencv backend doesn't support this codec acutally. in function CvVideoWriter_GStreamer::open

When create a VideoCapture I can successfully retrieve frames by using the read method, but any calls to the get method to retrieve parameters such as frame width, frame height, or FOURCC code all return 0.0.

I wanted to get the exact codec from the file I am opening to pass this into VideoWriter, but since this only returns 0.0 I don't know what to do.

Any help would be greatly appreciated.

4

1 回答 1

0

尝试将 -1 作为fourcc 参数传递。这应该会弹出一个对话框,让您选择一个视频编解码器。我用这种方式,效果很好。

cv2.VideoWriter('foo.out.mov', -1, 25, (704, 480), 1)
于 2013-04-09T13:40:11.780 回答