A lightweight IP camera simulator written in Rust, capable of generating a real-time RTSP stream and designed to emulate ONVIF-compatible cameras for development, testing, and validation environments.
The project dynamically generates video frames (DVD-style bouncing animation with timestamp overlay) and publishes them to an external RTSP server (such as MediaMTX) using FFmpeg.
⚠️ This project is not an RTSP server.
It acts as an RTSP publisher and requires an external RTSP server.
- Simulate an RTSP IP camera
- Provide a foundation for ONVIF (PTZ, Presets, Status) simulation
- Enable testing of:
- VMS systems
- NVRs
- Video ingestion pipelines
- Computer vision and analytics services
- Designed to run seamlessly on Docker, Docker Compose, and Kubernetes (AKS)
The repository includes a ready-to-use docker-compose.yml that starts both the RTSP server and the camera simulator.
version: "3.9"
services:
mediamtx:
image: bluenviron/mediamtx:latest
container_name: mediamtx
ports:
- "8554:8554"
- "8888:8888"
onvif-ip-camera-mock:
image: ezequielmr94/onvif-ip-camera-mock
depends_on:
- mediamtx
environment:
RTSP_URL: rtsp://mediamtx:8554/cam1
ports:
- "8000:8000"
- "80:80"
restart: alwaysAnd then just run:
docker compose upTo watch the stream run the following:
# using tcp stream can take a while to load
ffplay -rtsp_transport tcp rtsp://localhost:8554/cam1Of course you can use your favorite player to watch it, like VLC or whatever...
| RTSP_URL | Description | | RTSP endpoint where the stream will be published | ab |
Change those lines of docker-compose.yml file to:
onvif-ip-camera-mock:
build: .
container_name: onvif-ip-camera-mock
# image: ezequielmr94/onvif-ip-camera-mockOr use
docker build -t onvif-ip-camera-mock .
docker run onvif-ip-camera-mockThis section is intended for developers who want to build, run, or extend the project locally, without Docker.
The application itself is fully cross-platform and can be built and executed natively using Rust and Cargo.
The recommended way to install Rust is via rustup.
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shAfter installation, restart your terminal and verify:
rustc --version
cargo --versionThis project uses Rust edition 2024, so make sure your Rust version is 1.85+ (or newer).
The project depends on:
- Rust (edition 2024)
- FFmpeg (runtime dependency)
- An external RTSP server (e.g. MediaMTX)
You can use the following command to build or run the project:
cargo runWhen running you should see log output similar to:
Streaming to rtsp://127.0.0.1:8554/cam1
To build a release binary:
cargo build --releaseThe executable will be located at:
target/release/onvif-ip-camera-mock
You can run it directly:
RTSP_URL=rtsp://127.0.0.1:8554/cam1 ./target/release/onvif-ip-camera-mock- support other video CODECs (HVEC, AV1, etc)
- support RTMP
- generate an mock for ONVIF showing some response to the stream screen
- configure fake detections of vehicle plates
- configure fake detections of people's face
