# cv2.error: OpenCV(4.8.0) /modules/videoio/src/cap_gstreamer.cpp:1058: error: (-215:Assertion failed) gst_pipeline is NULL in function 'CvCapture_GStreamer::open'

- **ID:** `opencv/video-capture-gstreamer-pipeline-failed`
- **Domain:** opencv
- **Category:** runtime_error
- **Error Code:** `-215`
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

The GStreamer pipeline string passed to VideoCapture is invalid or GStreamer is not properly initialized.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.5.5 | active | — | — |
| 4.8.0 | active | — | — |
| 4.9.0 | active | — | — |

## Workarounds

1. **gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
# If this works, adapt the same pipeline string for OpenCV:
cap = cv2.VideoCapture('videotestsrc ! videoconvert ! appsink', cv2.CAP_GSTREAMER)** (85% success)
   ```
   gst-launch-1.0 videotestsrc ! videoconvert ! autovideosink
# If this works, adapt the same pipeline string for OpenCV:
cap = cv2.VideoCapture('videotestsrc ! videoconvert ! appsink', cv2.CAP_GSTREAMER)
   ```
2. **cap = cv2.VideoCapture('rtspsrc location=rtsp://example.com/stream ! decodebin ! videoconvert ! appsink', cv2.CAP_GSTREAMER)** (80% success)
   ```
   cap = cv2.VideoCapture('rtspsrc location=rtsp://example.com/stream ! decodebin ! videoconvert ! appsink', cv2.CAP_GSTREAMER)
   ```

## Dead Ends

- **** — If OpenCV is built without GStreamer backend, the error changes; this error specifically occurs when GStreamer is present but pipeline fails. (40% fail)
- **** — For RTSP or network streams, a file path won't work; the pipeline must be correctly formatted. (60% fail)
- **** — Missing plugins (e.g., 'videotestsrc') cause pipeline construction to fail silently; the error is not just about syntax. (50% fail)
