# 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`
- **Domain:** opencv
- **Category:** config_error
- **Error Code:** `-215`
- **Verification:** ai_generated
- **Fix Rate:** 88%

## Root Cause

GStreamer pipeline string passed to VideoCapture is empty or malformed, causing the pipeline to fail to initialize.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 4.5.5 | active | — | — |
| 4.6.0 | active | — | — |
| 4.7.0 | active | — | — |

## Workarounds

1. **Ensure the pipeline string is non-empty and correctly formatted, e.g., `cap = cv2.VideoCapture('videotestsrc ! appsink')`** (90% success)
   ```
   Ensure the pipeline string is non-empty and correctly formatted, e.g., `cap = cv2.VideoCapture('videotestsrc ! appsink')`
   ```
2. **Test the pipeline with `gst-launch-1.0` command line before using it in OpenCV to verify syntax.** (85% success)
   ```
   Test the pipeline with `gst-launch-1.0` command line before using it in OpenCV to verify syntax.
   ```
3. **If using a camera, use `cap = cv2.VideoCapture(0)` instead of a pipeline string to avoid this error.** (70% success)
   ```
   If using a camera, use `cap = cv2.VideoCapture(0)` instead of a pipeline string to avoid this error.
   ```

## Dead Ends

- **Adding quotation marks around the pipeline string in Python.** — Adding extra spaces or quotes around the pipeline string does not fix the underlying syntax; GStreamer expects exact format. (50% fail)
- **Passing a video file path without the 'filesrc location=' prefix.** — Using a file path instead of a pipeline string still triggers the assertion because the pipeline is empty. (80% fail)
- **Reinstalling GStreamer from source without checking pipeline syntax.** — Installing a different GStreamer version may break syntax compatibility. (40% fail)
