opencv
runtime_error
ai_generated
true
[ WARN:0] global /tmp/opencv-4.9.0/modules/videoio/src/cap_gstreamer.cpp (2401) open OpenCV | GStreamer warning: unable to start pipeline
ID: opencv/video-capture-gstreamer-pipeline-error
87%Fix Rate
86%Confidence
1Evidence
2024-09-10First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 4.8.0 | active | — | — | — |
| 4.9.0 | active | — | — | — |
| 4.10.0 | active | — | — | — |
Root Cause
The GStreamer pipeline string provided to VideoCapture is malformed or references a source that does not exist or is not accessible.
generic中文
提供给 VideoCapture 的 GStreamer 管道字符串格式错误,或引用了不存在或无法访问的源。
Official Documentation
https://docs.opencv.org/4.x/d0/da7/videoio_overview.htmlWorkarounds
-
90% success Verify the GStreamer pipeline by testing it in terminal first: gst-launch-1.0 filesrc location=/path/to/video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink. If it fails, install missing plugins: sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad.
Verify the GStreamer pipeline by testing it in terminal first: gst-launch-1.0 filesrc location=/path/to/video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink. If it fails, install missing plugins: sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad.
-
85% success Use raw video device pipeline with proper format: cv::VideoCapture cap('v4l2src device=/dev/video0 ! videoconvert ! appsink', cv::CAP_GSTREAMER);
Use raw video device pipeline with proper format: cv::VideoCapture cap('v4l2src device=/dev/video0 ! videoconvert ! appsink', cv::CAP_GSTREAMER);
中文步骤
Verify the GStreamer pipeline by testing it in terminal first: gst-launch-1.0 filesrc location=/path/to/video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink. If it fails, install missing plugins: sudo apt-get install gstreamer1.0-plugins-good gstreamer1.0-plugins-bad.
Use raw video device pipeline with proper format: cv::VideoCapture cap('v4l2src device=/dev/video0 ! videoconvert ! appsink', cv::CAP_GSTREAMER);
Dead Ends
Common approaches that don't work:
-
Installing GStreamer from source without proper plugins (e.g., missing gst-plugins-good)
80% fail
Missing plugin packages cause pipeline initialization to fail even if GStreamer core is installed.
-
Using a pipeline string with absolute file paths containing spaces without proper escaping
90% fail
GStreamer requires spaces in paths to be escaped with single quotes or backslashes; without escaping, the pipeline fails to parse.