Git Product home page Git Product logo

atm0s-media-server's Introduction

License: MIT Discord

Decentralized Ultra-Low Latency Streaming Server

A decentralized media server designed to handle media streaming on a global scale, making it suitable for large-scale applications but with minimal cost.

It is developed by 8xFF, a group of independent developers who are passionate about building a new generation of media server and network infrastructure with decentralization in mind. While we have received support from various companies and individuals, we are not affiliated with any specific company. 8xFF is a community-driven project, and we welcome anyone interested in contributing to join us.

For a deep dive into the technical aspects of network architecture, please refer to our Smart-Routing

(Above is a demo video of the version used by Bluesea Network)

Project Status: Refactoring

We are actively refactoring entiry media server and network stack with sans-io-runtime for better performance. If you are looking for older version, please check in legacy branch.

Features

  • ๐Ÿš€ Powered by Rust with memory safety and performance.
  • High availability by being fully decentralized, with no central controller.
  • ๐Ÿ›ฐ๏ธ Multi-zone support, high scalability.
  • Support encodings: H264, Vp8, Vp9, H265 (Coming soon), AV1 (Coming soon)
  • Cross-platform: Linux, macOS, Windows.
  • Decentralized WebRTC SFU (Selective Forwarding Unit)
  • Easy to deploy: single binary, Docker, or Kubernetes
  • Easy to scale: global pubsub network, similar to Cloudflare interconnected network)
Feature Description Status
Multi-zones Cluster Implement with global pubsub network RFC-0003 ๐Ÿšง
Whip Whip Protocol ๐Ÿšง
Whep Whep Protocol ๐Ÿšง
WebRTC-SDK Webrtc-SDK Protocol RFC-0005 โŒ
RTMP RTMP Protocol โŒ
RTMP-Transcode RTMP with Transcode โŒ
SIP SIP calls โŒ
MoQ Media-over-Quic โŒ
Monitoring Dashboard for monitoring โŒ
Recording Record stream โŒ
Gateway External gateway RFC-0003 โŒ
Connector External event handling โŒ

Status:

  • โŒ: Not started
  • ๐Ÿšง: In progress
  • ๐Ÿš€: In review/testing
  • โœ…: Completed

Quick Start (not ready yet)

Prebuild or build from source

  • From Docker
docker run --net=host ghcr.io/8xff/atm0s-media-server:master --help
  • Download prebuild
OS Arch Link
MacOS aarch64 Download
MacOS x86_64 Download
Linux aarch64 gnu Download
Linux x86_64 gnu Download
Linux aarch64 musl Download
Linux x86_64 musl Download
  • Build from source
cargo build --release --package atm0s-media-server
./target/release/atm0s-media-server --help

Run

Run first WebRTC node:

atm0s-media-server --http-port 3001 --zone-index=101 webrtc

After node1 started it will print out the node address like 101@/ip4/192.168.1.10/udp/10101/ip4/192.168.1.10/tcp/10101, you can use it as a seed node for other nodes.

Run second WebRTC node:

atm0s-media-server --http-port 3002 --zone-index=102 --seeds FIRST_NODE_ADDR webrtc

Now two nodes will form a cluster and can be used for media streaming.

First media-server: http://localhost:3001/samples/whip/whip.html

Second media-server: http://localhost:3002/samples/whep/whep.html

You can use Pregenerated-Token to publish and play stream.

Demo Screen

Each node also has embedded monitoring page at http://localhost:3001/dashboard/ and http://localhost:3002/dashboard/

Monitoring

Resources

Contributing

The project is continuously being improved and updated. We are always looking for ways to make it better, whether that's through optimizing performance, adding new features, or fixing bugs. We welcome contributions from the community and are always looking for new ideas and suggestions. If you find it interesting or believe it could be helpful, we welcome your contributions to the codebase or consider starring the repository to show your support and motivate our team!

For more information, you can access Contributor Guide and join our Discord channel

License

This project is licensed under the MIT License. See the LICENSE file for details.

Acknowledgments

We would like to thank all the contributors who have helped in making this project successful.

atm0s-media-server's People

Contributors

binhduong85 avatar dependabot[bot] avatar giangndm avatar giangndm-bluesea avatar github-actions[bot] avatar hieulq avatar luongngocminh avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

atm0s-media-server's Issues

Inconsistency in term naming for "token", "secret" and "key"

For example, the root "token", for generating other JWT Tokens, should be called "secret" or "keys". This appeared in multiple servers/ code.

    // in servers/media-server/src/server.rs

    /// Current Token
    #[arg(env, long, default_value = "insecure")]
    token: String,

While in the implementations of packages/cluster/, the root "token" is correctly termed "key", or "static_key" to be exact.
And in "token"_generator server, the check for token is confusing at best:

// servers/media-server/src/server/token_generate/http.rs
if !app_secret.0.eq(&data.1.token) {
            return Ok(Json(Response {
                success: false,
                error: Some("INVALID_TOKEN".to_string()),
                data: None,
            }));
        }

We should strictly normalize all the terms to avoid such confusion.

Too much log in endpoint_wrap

When running with RTMP server, it show too much log like:

[2023-11-03T02:53:33.818Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.818Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.818Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.819Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.820Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.820Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.820Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.820Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.820Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2456792 }
[2023-11-03T02:53:33.845Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.803Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.803Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.803Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.803Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.806Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.806Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.806Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.806Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.807Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.809Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }
[2023-11-03T02:53:34.810Z INFO  endpoint::endpoint_wrap::internal::local_track] [LocalTrack video_0] stats Single { bitrate: 2466384 }

How to get started?

Can you update the readme so it will be easier for people who are interested in this project to run the demo?
just following the readme sfu server can not be started

Windows Version?

Hello,

Are there any Windows 10 (x64) pre-built binaries?

Would really like to test it out.
Thanks

Create node dashboard

For monitoring performance and current status of node, we need a simple dashboard like other media-server

  • simple dashboard like
    image

  • prometheus exporter

Metric:

  • node info (cpu, memory, network)
  • live peers
  • live streams
  • live rooms
  • min, max, avg send est

Log:

  • list peers
  • list stream
  • list rooms

Does Support Real-Time DRM Encryption?

Could someone confirm whether this feature is currently supported, and if not, are there plans to implement it in the future?

Thank you for your attention to this matter. I look forward to hearing from you soon.

Roadmap

Here is list of first version roadmap, we have goal to release with all bellow features

SDK

Features

  • Room token, peer token #129
  • Auto or Manual Room (for huge room like Gather.town) #135
  • Stream Pub/Sub
  • In room chat
  • Metrics #66
  • Record / Replay / Compose
  • Audio Mix-Minus #126

Protocols

  • WebRTC
  • Whip #76
  • Whep #76
  • Webrtc Stun
  • Webrtc Turn
  • SIP UDP
  • RTMP

Cluster

  • Benchmark
  • Global scale with Overlay network
  • Inner cluster gateway #106
  • Global gateway
  • Embed monitor dashboard #106
  • Prometheus exporter endpoint #106
  • Kubernetes deploy

Integration

  • Static authentication
  • Dynamics authentication with remote config
  • External log integration #132
  • SIP hooks

Docker not working due to missing dependency

Running the script
docker run --net=host ghcr.io/8xff/atm0s-media-server:master
would resulted in an error:
/atm0s-media-server: error while loading shared libraries: libsoxr.so.0: cannot open shared object file: No such file or directory

Webrtc str0m slow in twcc::max_seq

Current implement bigO is O(n) with n is queue length, with default queue length is 1000 it take 1000 times check for finding each time a rtp package incoming.

pub fn max_seq(&self) -> SeqNo {
        self.queue
            .iter()
            .map(|r| r.seq)
            .max_by_key(|r| *r)
            .unwrap_or_else(|| 0.into())
    }

It can be optimize to near O(1) by pre-calculate max_queue each time insert to queue, each time pop from queue if max_queue is pop, we will regenerate by above function

Deploy multi zones cluster

We need a simple and cost effective way to deploy multi zones cluster for demo cluster. We have some possible way:

  • docker compose
  • use binary directly

In my opinion docker compose is better, we should create a docker compose repo which has:

  • local cluster with all nodes
  • separated docker compose for each server

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

cargo
Cargo.toml
  • convert-enum 0.1
  • num_enum 0.7
  • log 0.4
  • smallmap 1.4
  • derivative 2.2
  • derive_more 0.99
  • rand 0.8
bin/Cargo.toml
  • tracing-subscriber 0.3
  • clap 4.5
  • poem 3.0
  • poem-openapi 5.0
  • tokio 1.37
packages/media_core/Cargo.toml
packages/media_runner/Cargo.toml
packages/media_utils/Cargo.toml
packages/protocol/Cargo.toml
  • bincode 1.3.3
  • serde 1.0.198
packages/transport_webrtc/Cargo.toml
  • str0m 0.5.0
  • smallmap 1.4.2
  • stun-rs 0.1.8
dockerfile
Dockerfile
  • ubuntu 22.04
  • ubuntu 22.04
github-actions
.github/workflows/release-plz.yml
  • actions/checkout v4
  • MarcoIeni/release-plz-action v0.5
.github/workflows/release.yml
  • actions/checkout v4
  • actions-rs/toolchain v1
  • actions-rs/cargo v1
  • actions/upload-artifact v4
  • svenstaro/upload-release-action v2
  • actions/download-artifact v4
  • docker/setup-qemu-action v3
  • docker/setup-buildx-action v3
  • actions/checkout v4
  • actions/download-artifact v4
  • docker/login-action v3
  • docker/metadata-action v5
  • docker/build-push-action v5
.github/workflows/rust-clippy.yml
  • actions/checkout v4
  • actions-rs/toolchain v1@16499b5e05bf2e26879000db0c1d13f7e13fa3af
  • github/codeql-action v3
.github/workflows/rust.yml
  • actions/checkout v4
  • codecov/codecov-action v4
  • actions/checkout v4
  • EmbarkStudios/cargo-deny-action v1
.github/workflows/typos.yml
  • actions/checkout v4
  • crate-ci/typos v1.18.2

  • Check this box to trigger a request for Renovate to run again on this repository

sip server

  • Handle SIP
  • Implement in-call sip
  • Implement out-call sip
  • Implement in-call route hook

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.