Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.

Bug 987905

Summary: GStreamer Theora error with VideoWriter in Python
Product: [Fedora] Fedora Reporter: Jan Sedlák <jsedlak>
Component: opencvAssignee: Nicolas Chauvet (kwizart) <kwizart>
Status: CLOSED NOTABUG QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 19CC: hhorak, i, karlthered, kwizart, nomis80
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2014-08-19 06:52:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Jan Sedlák 2013-07-24 11:55:38 UTC
Description of problem:
When I try to use VideoWriter in Python and I use Theora as a codec, it shows traceback:

>>> vw = cv2.VideoWriter("test.ogv", cv2.cv.CV_FOURCC('T', 'H', 'E', 'O'), 2, (1024, 768), True)
OpenCV Error: Unspecified error (GStreamer: cannot link elements
) in CvVideoWriter_GStreamer::open, file /builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp, line 552
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
cv2.error: /builddir/build/BUILD/opencv-2.4.5/modules/highgui/src/cap_gstreamer.cpp:552: error: (-2) GStreamer: cannot link elements
 in function CvVideoWriter_GStreamer::open

I don't really know what codec I should use for VideoWriter, because Theora doesn't work and MPEG is proprietary.

How reproducible:
Always.

Steps to Reproduce:
1. Install opencv-python bindings.
2. Start python console, import cv2.
3. Run "cv2.VideoWriter("test.ogv", cv2.cv.CV_FOURCC('T', 'H', 'E', 'O'), 2, (1024, 768), True)"

Actual results:
It shows "unspecified error".

Expected results:
It should work.

Comment 1 Nicolas Chauvet (kwizart) 2013-07-24 12:42:00 UTC
I don't why it doesn't work with THEO, maybe related to the content or size expected by the encoder ?
Now it seems to work with VP80, please verify to have the libvpx gstreamer plugin.

Comment 2 Jan Sedlák 2013-07-24 14:28:38 UTC
It may be problem in GStreamer and not in cv2, but I don't know. Are you able to create VideoWriter using THEO? Anyway, VP8, as it seems, works.

Comment 3 Nicolas Chauvet (kwizart) 2013-07-24 15:23:31 UTC
No I cannot create a VideoWriter with THEO either.

Comment 4 Jan Sedlák 2013-07-30 08:21:56 UTC
To be honest, I am still unable to create video using VideoWriter and VP80 codec. I create VideoWriter using "vw = cv2.VideoWriter("out.webm", cv2.cv.CV_FOURCC(*"VP80"), 2, (1024, 768), True)", load several 1024x768 PNG images with cv2.imread() and write them using "vw.write(image)", but out.webm is somehow corrupted and it seems that "vw.write(image)" doesn't really write images into output file.

Comment 5 Nicolas Chauvet (kwizart) 2013-10-01 21:33:09 UTC
Did you tried with others codec ?

Comment 6 Jan Sedlák 2013-10-02 08:50:43 UTC
I am able to create output video file using XVID, but I think that I had to install something from rpmfusion to be able to do it.

Comment 7 Nicolas Chauvet (kwizart) 2013-10-02 09:00:22 UTC
Using additional dependencies would have been expected, because the encoder and even the decoder are not in fedora. But it should work on free codec provided that the encoder is installed (which might not be done by default)