You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0f1b8f5
Browse filesBrowse the repository at this point in the historyBrowse files
authored
Add GStreamer backend support for RTSP streaming (#92)
* using gst backend for opencv
* Update documentation
* restore dockerfile
* update with gstreamer backend comment
* fix test and remove gst backend test script
* update readme with instructions for gst backend usage
* add sample script for testing gst backend
* misc code cleanup
* update sample script to accept protocol arg
* allow using different protocols
* seperate dockerfile for opencv+gst build
* unit tests for mock testing
* set protocol, tcp udp or tcp+udp
* fix unit test
* Update documentation
* stop blocking when grab() takes longer than timeout
* Automatically reformatting code with black and isort
* bump version
* use toml file for installing sharable dependencies
* remove comments
* clean up gst support section
* fix comment
* Update documentation
* updates per PR comments
* trigger CI on PR
* trigger CI on various PR states
* Update documentation
* fix unit tests (vibe-kanban 5a852cc6)
please check and fix
FAILED test/test\_all\_grabber\_types\_generic.py::TestAllGrabberTypes::test\_create\_config
```javascript
FAILED test/test_rtsp_backends.py::TestRTSPBackends::test_gstreamer_backend_with_max_fps
```
* try with push only again
---------
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Auto-format Bot <autoformatbot@groundlight.ai>
-[Command line interface (CLI)](#command-line-interface-cli)
17
18
-[Frame Grabbing](#frame-grabbing)
19
+
-[RTSP Backends](#rtsp-backends)
18
20
-[Configurations](#configurations)
19
21
-[Autodiscovery](#autodiscovery)
20
22
-[RTSP Discovery](#rtsp-discovery)
@@ -57,6 +59,63 @@ To install all optional dependencies, run:
57
59
pip install framegrab[all]
58
60
```
59
61
62
+
### GStreamer Support
63
+
64
+
The RTSP input type supports two backends: **FFmpeg** (default) and **GStreamer**. The GStreamer backend provides lower latency and better real-time performance for RTSP streaming.
65
+
66
+
**Why GStreamer for RTSP?**
67
+
- ✅ **Zero-buffering** with leaky queues for always-fresh frames
68
+
- ✅ **Lower latency** (~60-80ms vs 200-500ms with FFmpeg)
69
+
- ✅ **Better network handling** with configurable timeouts
70
+
- ✅ **Frame rate limiting** at the pipeline level
71
+
72
+
By default, `pip install opencv-python` includes only FFmpeg support. To use GStreamer, you need OpenCV compiled with GStreamer libraries.
73
+
74
+
#### Option 1: Docker (Recommended)
75
+
76
+
Use the sample `Dockerfile.gstreamer` which includes GStreamer support:
You might have several cameras that you want to use in the same application. In this case, you can load the configurations from a yaml file and use `FrameGrabber.create_grabbers`. Note that currently only a single Raspberry Pi CSI2 camera is supported, but these cameras can be used in conjunction with other types of cameras.
181
276
182
277
If you have multiple cameras of the same type plugged in, it's recommended that you include serial numbers in the configurations; this ensures that each configuration is paired with the correct camera. If you don't provide serial numbers in your configurations, configurations will be paired with cameras in a sequential manner.
@@ -222,6 +317,7 @@ for grabber in grabbers.values():
222
317
display_image(frame) # substitute this line for your preferred method of displaying images, such as cv2.imshow
223
318
grabber.release()
224
319
```
320
+
225
321
### Configurations
226
322
#### Dictionary or YamlFormat
227
323
The table below shows all available configurations and the cameras to which they apply. This is the format used when creating grabbers from dictionaries or yaml strings. If you want to use the python FrameGrabberConfig object, the format is slightly different to optimize for python readability (see format and examples). We use the python pydantic model to validate the dictionary and yaml format
@@ -251,9 +347,11 @@ use the python pydantic model to validate your configuration.
In addition to the configurations in the table above, you can set any Basler camera property by including `options.basler.<BASLER PROPERTY NAME>`. For example, it's common to set `options.basler.PixelFormat` to `RGB8`.
0 commit comments