#rtmp #video-streaming #streaming

rml_rtmp

Rust library for handling aspects of the RTMP protocol

25 releases

Uses old Rust 2015

0.8.0 Apr 29, 2023
0.7.1 Mar 27, 2023
0.7.0 Jun 24, 2022
0.6.1 Jan 12, 2022
0.2.0 Jul 19, 2018

#108 in Video

Download history 309/week @ 2024-01-08 355/week @ 2024-01-15 561/week @ 2024-01-22 232/week @ 2024-01-29 152/week @ 2024-02-05 247/week @ 2024-02-12 206/week @ 2024-02-19 166/week @ 2024-02-26 102/week @ 2024-03-04 138/week @ 2024-03-11 234/week @ 2024-03-18 68/week @ 2024-03-25 123/week @ 2024-04-01 66/week @ 2024-04-08 57/week @ 2024-04-15 64/week @ 2024-04-22

312 downloads per month
Used in 5 crates (4 directly)

MIT license

490KB
11K SLoC

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.

Documentation

https://docs.rs/rml_rtmp/

Installation

This crate works with Cargo and is on crates.io. Add it to your Cargo.toml like so:

[dependencies]
rml_rtmp = "0.1"

Performance

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.

Examples

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 ClientSessions and ServerSessions 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

Dependencies

~1.3–2MB
~39K SLoC