Errors in code execution Gstreamer

asked 2019-07-14 01:44:49 -0600

Olivia_Kelly gravatar image

When I run my code

import cv2

filepath = raw_input("enter the path to the video  ")
#cap = cv2.VideoCapture(filepath)
cap = cv2.VideoCapture('filesrc location-/media/kelly/Files/aaaa.mp4 ! decodebin ! appsink', cv2.CAP_GSTREAMER)

if not cap.isOpened():
    print("Cannot capture test src. Exiting.")
    quit()

The following errors appear

(python:28088): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed

(python:28088): GLib-GObject-WARNING **: invalid cast from 'GstFileSrc' to 'GstBin'

(python:28088): GStreamer-CRITICAL **: gst_bin_iterate_elements: assertion 'GST_IS_BIN (bin)' failed

(python:28088): GStreamer-CRITICAL **: gst_iterator_next: assertion 'it != NULL' failed

(python:28088): GStreamer-CRITICAL **: gst_iterator_free: assertion 'it != NULL' failed OpenCV Error: Unspecified error (GStreamer: cannot find appsink in manual pipeline ) in cvCaptureFromCAM_GStreamer, file /home/kelly/opencv-3.4.0/modules/videoio/src/cap_gstreamer.cpp, line 805 VIDEOIO(cvCreateCapture_GStreamer (CV_CAP_GSTREAMER_FILE, filename)): raised OpenCV exception:

/home/kelly/opencv-3.4.0/modules/videoio/src/cap_gstreamer.cpp:805: error: (-2) GStreamer: cannot find appsink in manual pipeline in function cvCaptureFromCAM_GStreamer

I tried to find a solution myself. But I did not succeed. How can fix these errors?

edit retag flag offensive close merge delete

Comments

There is typo error. Replace this 'filesrc location- to 'filesrc location=

supra56 gravatar imagesupra56 ( 2019-07-14 21:15:15 -0600 )edit