-215
opencv
config_error
ai_generated
true
cv2.error: OpenCV(4.5.5) /modules/videoio/src/cap_gstreamer.cpp:1156: error: (-215:Assertion failed) !pipeline.empty() in function 'open'
ID: opencv/gstreamer-pipeline-string-error
88%Fix Rate
82%Confidence
1Evidence
2023-03-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4.5.5 | active | — | — | — |
| 4.6.0 | active | — | — | — |
| 4.7.0 | active | — | — | — |
Root Cause
GStreamer pipeline string passed to VideoCapture is empty or malformed, causing the pipeline to fail to initialize.
generic中文
传递给VideoCapture的GStreamer管道字符串为空或格式错误,导致管道初始化失败。
Official Documentation
https://docs.opencv.org/4.5.5/d4/d15/group__videoio__flags__gstreamer.htmlWorkarounds
-
90% success Ensure the pipeline string is non-empty and correctly formatted, e.g., `cap = cv2.VideoCapture('videotestsrc ! appsink')`
Ensure the pipeline string is non-empty and correctly formatted, e.g., `cap = cv2.VideoCapture('videotestsrc ! appsink')` -
85% success Test the pipeline with `gst-launch-1.0` command line before using it in OpenCV to verify syntax.
Test the pipeline with `gst-launch-1.0` command line before using it in OpenCV to verify syntax.
-
70% success If using a camera, use `cap = cv2.VideoCapture(0)` instead of a pipeline string to avoid this error.
If using a camera, use `cap = cv2.VideoCapture(0)` instead of a pipeline string to avoid this error.
中文步骤
Ensure the pipeline string is non-empty and correctly formatted, e.g., `cap = cv2.VideoCapture('videotestsrc ! appsink')`Test the pipeline with `gst-launch-1.0` command line before using it in OpenCV to verify syntax.
If using a camera, use `cap = cv2.VideoCapture(0)` instead of a pipeline string to avoid this error.
Dead Ends
Common approaches that don't work:
-
Adding quotation marks around the pipeline string in Python.
50% fail
Adding extra spaces or quotes around the pipeline string does not fix the underlying syntax; GStreamer expects exact format.
-
Passing a video file path without the 'filesrc location=' prefix.
80% fail
Using a file path instead of a pipeline string still triggers the assertion because the pipeline is empty.
-
Reinstalling GStreamer from source without checking pipeline syntax.
40% fail
Installing a different GStreamer version may break syntax compatibility.