Local publishing¶
The shortest endpoint is a path name:
from easy_rtsp import Stream
stream = Stream.from_webcam(0).serve("live")
print(stream.viewer_url)
stream.wait()
"live" resolves to rtsp://127.0.0.1:8554/live by default.
What starts behind the scenes¶
When the destination is loopback and the port is free:
- easy-rtsp starts MediaMTX if it is installed.
- FFmpeg publishes encoded H.264 to MediaMTX.
- Players connect to the printed RTSP URL.
If MediaMTX is unavailable, easy-rtsp falls back to a single MPEG-TS listener and prints a tcp:// URL instead. That fallback is useful for a quick VLC preview, but it is not an RTSP server and cannot power LAN mode, recording/HLS tee outputs, or WebRTC.
Change the endpoint¶
The resulting local URL is rtsp://127.0.0.1:9554/camera/front.
Publish to an existing server¶
Pass a full destination URL:
For credentials, avoid manual string assembly:
stream.serve_rtsp(
"media-server.local",
"live",
port=8554,
username="publisher",
password="secret",
)
Credentials are safely percent-encoded and redacted from CLI diagnostics.