{
  "id": "opencv/videocapture-gstreamer-pipeline-failed",
  "signature": "OpenCV: GStreamer: cannot link elements: source -> decodebin",
  "signature_zh": "OpenCV: GStreamer: 无法链接元素: source -> decodebin",
  "regex": "GStreamer: cannot link elements",
  "domain": "opencv",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The GStreamer pipeline string passed to VideoCapture contains incompatible elements or missing plugins, preventing the source element from linking to decodebin.",
  "root_cause_type": "generic",
  "root_cause_zh": "传递给 VideoCapture 的 GStreamer 管道字符串包含不兼容的元素或缺少插件，导致源元素无法链接到 decodebin。",
  "versions": [
    {
      "version": "opencv-4.5.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "opencv-4.8.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "opencv-4.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Change the video file path to an absolute path",
      "why_fails": "The error is about GStreamer element linking, not file path resolution. Absolute paths don't fix element compatibility.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Reinstall OpenCV with gstreamer support using cmake -DWITH_GSTREAMER=ON",
      "why_fails": "If OpenCV already has GStreamer support (the error message shows GStreamer is running), recompiling won't fix the pipeline syntax.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Use CAP_FFMPEG backend instead by setting cv::CAP_FFMPEG",
      "why_fails": "This workaround avoids GStreamer but may not be available if FFMPEG is not compiled in, or the source requires GStreamer-specific features.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Test the pipeline outside OpenCV first: run 'gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! fakesink'. If it fails, install missing plugins: 'sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly'. Then adjust the pipeline string: cv::VideoCapture cap('filesrc location=video.mp4 ! decodebin ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "success_rate": 0.85,
      "how": "Test the pipeline outside OpenCV first: run 'gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! fakesink'. If it fails, install missing plugins: 'sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly'. Then adjust the pipeline string: cv::VideoCapture cap('filesrc location=video.mp4 ! decodebin ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Simplify the pipeline to use autovideosrc for live cameras: cv::VideoCapture cap('autovideosrc ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "success_rate": 0.75,
      "how": "Simplify the pipeline to use autovideosrc for live cameras: cv::VideoCapture cap('autovideosrc ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Provide a full GStreamer pipeline with explicit caps: cv::VideoCapture cap('filesrc location=video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "success_rate": 0.8,
      "how": "Provide a full GStreamer pipeline with explicit caps: cv::VideoCapture cap('filesrc location=video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Test the pipeline outside OpenCV first: run 'gst-launch-1.0 filesrc location=video.mp4 ! decodebin ! fakesink'. If it fails, install missing plugins: 'sudo apt-get install gstreamer1.0-plugins-bad gstreamer1.0-plugins-ugly'. Then adjust the pipeline string: cv::VideoCapture cap('filesrc location=video.mp4 ! decodebin ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
    "Simplify the pipeline to use autovideosrc for live cameras: cv::VideoCapture cap('autovideosrc ! videoconvert ! appsink', cv::CAP_GSTREAMER);",
    "Provide a full GStreamer pipeline with explicit caps: cv::VideoCapture cap('filesrc location=video.mp4 ! qtdemux ! h264parse ! avdec_h264 ! videoconvert ! appsink', cv::CAP_GSTREAMER);"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://docs.opencv.org/4.x/d0/da7/videoio_overview.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2023-09-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}