mobius-rtsp is a GStreamer-based RTSP server for infinite video files streaming.
How It Works
- Place supported video files in the
data/videosfolder - On startup, the server reads video filenames (without extensions) and adds them as RTSP streams
- In infinite mode, each video is decoded in a dedicated producer pipeline and forwarded internally into the RTSP pipeline
Example:
videofile: data/videos/9c0a140d548c8313e7719b7590d029dc.mp4
rtsp stream: rtsp://0.0.0.0:8554/mobius-stream/9c0a140d548c8313e7719b7590d029dc
Supported video formats:
- mp4
- avi
- mkv
- mov
- webm
- flv
- wmv
- m4v
- 3gp
The following GStreamer libraries and plugins are required:
- libgstreamer1.0-0
- libgstreamer-plugins-base1.0-0
- libgstreamer-plugins-good1.0-0
- libgstreamer-plugins-bad1.0-0
- libgstrtspserver-1.0-0
- gstreamer1.0-plugins-base
- gstreamer1.0-plugins-good
- gstreamer1.0-plugins-bad
- gstreamer1.0-plugins-ugly
- gstreamer1.0-x
- gstreamer1.0-tools
Rust compiler version 1.88 or higher is required.
Build and run the project:
cargo runRun using Docker Compose:
docker compose upThe server can be configured using environment variables:
| Variable | Default | Description |
|---|---|---|
MOBIUS_PORT |
8554 | RTSP server port |
MOBIUS_SHARED |
true | Individual stream per client (false) or shared stream (true) |
MOBIUS_PREFIX |
mobius-stream | RTSP server resources prefix |
MOBIUS_INFINITE |
true | Streaming without EOS message by replaying an internal producer pipeline |
MOBIUS_ENCODER_BITRATE |
6000000 | OpenH264 bitrate in bits per second |
MOBIUS_ENCODER_GOP_SIZE |
30 | Number of frames between keyframes |
MOBIUS_ENCODER_COMPLEXITY |
high | OpenH264 complexity: low, medium, or high |
| Variable | Default | Description |
|---|---|---|
MOBIUS_CORRUPTED |
false |
Enable/Disable the dynamic network sabotage thread |
MOBIUS_MIN_DROP_PROBABILITY |
0.05 |
Packet loss probability during "normal" operation (0.0 to 1.0) |
MOBIUS_MAX_DROP_PROBABILITY |
0.9 |
Packet loss probability during "outage" (0.9 is recommended for glitches) |
MOBIUS_MIN_TIME_BETWEEN_BREAK |
10 |
Minimum uptime (seconds) before an outage occurs |
MOBIUS_MAX_TIME_BETWEEN_BREAK |
30 |
Maximum uptime (seconds) before an outage occurs |
MOBIUS_MIN_DISCONNECTED_TIME |
10 |
Minimum duration (seconds) of the network outage |
MOBIUS_MAX_DISCONNECTED_TIME |
30 |
Maximum duration (seconds) of the network outage |
Custom port:
MOBIUS_PORT=9000 cargo runIndividual streams:
MOBIUS_SHARED=false cargo runResources prefix:
MOBIUS_PREFIX=custom-stream cargo runInfinite streaming mode:
MOBIUS_INFINITE=true cargo runHigher quality encoding:
MOBIUS_ENCODER_BITRATE=10000000 MOBIUS_ENCODER_GOP_SIZE=60 MOBIUS_ENCODER_COMPLEXITY=high cargo runDocker with custom configuration:
docker run -p 9000:9000 -e MOBIUS_PORT=9000 -e MOBIUS_SHARED=false -v ./data:/mobius/data mobius-rtsp- Multi-format support: Works with all popular video formats
- Automatic stream discovery: Automatically detects video files in the videos directory
- Configurable streaming mode: Shared or individual streams per client
- Docker support: Ready-to-use Docker configuration
- Low latency: Optimized H.264 encoding with ultrafast presets
- Cross-platform: Works on Linux, macOS, and Windows
- Network corruption: Simulating a real camera by a stream sabotage
- More stable infinite mode: Dedicated producer pipelines are replayed internally without forwarding EOS into the RTSP path