This crate provides functions for interacting with the Adobe RTMP protocol. It contains both low-level and high-level abstractions that can be utilized to integrate RTMP support into clients (publisher and players) and servers.
This crate works with Cargo and is on crates.io. Add it to your Cargo.toml
like so:
[dependencies]
rml_rtmp = "0.1"
The intention is that this library is as high performance as possible. We use the Bytes
crate to keep allocations as
minimal as possible, and according to the video relay benchmark on my Ryzen 5 1600X (on a single
thread) I can relay 10KB video packets from one publisher to two subscribers with an average of 24 microseconds. This should
leave ample cpu cycles for custom logic and for it to run on lower end devices.
Two large examples can be found in the repository:
-
Threaded RTMP Server - This is a basic RTMP server that shows how to accept connections and route audio/video to players
-
Mio RTMP Server - This is a relatively advanced RTMP server that shows how to integrate both RTMP
ClientSession
s andServerSession
s into a mio application. It supports- Receiving video from publishers and routing that video to any subscribed players
- Pull video from a remote RTMP server and serve it to subscribed players
- Receiving video from a publisher and republish that video out to an external RTMP server