centos7 cv2 VideoWrite error!

asked 2017-07-10 02:32:32 -0600

updated 2017-07-10 02:37:39 -0600

berak gravatar image

OpenCV Error: Unspecified error (GStreamer: cannot link elements ) in CvVideoWriter_GStreamer::open, file /data/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp, line 1492 VIDEOIO(cvCreateVideoWriter_GStreamer(filename, fourcc, fps, frameSize, is_color)): raised OpenCV exception:

/data/opencv-3.2.0/modules/videoio/src/cap_gstreamer.cpp:1492: error: (-2) GStreamer: cannot link elements in function CvVideoWriter_GStreamer::open

my code:

```

# coding: utf-8

import numpy as np
import cv2
import base64


fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter("avi_file.avi", fourcc, 24, (307, 568))
for i in range(0, 45):
   img12 = cv2.imread('/data/zgsee/opencv/img/{}.jpg'.format(i))
   out.write(img12)
out.release()

```

edit retag flag offensive close merge delete