Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MMS is a high-performance, multi-threaded, and multi-coroutine real-time streaming server implemented in C++20. It currently supports rtmp[s]/http[s]-flv/http[s]-hls/http[s]-ts/rtsp[s]/webrtc.

License

Notifications You must be signed in to change notification settings

jbl19860422/mms-server

Repository files navigation

πŸ‡¨πŸ‡³ δΈ­ζ–‡ζ–‡ζ‘£ | πŸ‡ΊπŸ‡Έ English

MMS: A high-performance, multi-threaded, and multi-coroutine real-time streaming server implemented in C++20

Introduction

MMS Server is a high-performance, real-time streaming media server built with C++20, designed specifically for live streaming and low-latency communication scenarios. It supports a wide range of mainstream streaming protocols, including:

  • RTMP / RTMPS
  • HTTP / HTTPS-FLV
  • HTTP / HTTPS-HLS
  • HTTP / HTTPS-TS
  • HTTP / HTTPS-DASH
  • RTSP / RTSPS
  • WebRTC

Leveraging the power of C++20 coroutines, MMS achieves high efficiency and maintainability, significantly reducing the complexity of asynchronous programming compared to traditional high-performance server architectures. This also enhances scalability and long-term maintainability.

MMS is released under the MIT License and is compatible with popular clients such as FFmpeg, OBS, VLC, and WebRTC. It supports media ingestion, protocol conversion, and distribution in a typical publish (push) and subscribe (play) model. For example, an incoming RTMP stream can be converted to HLS, HTTP-FLV, or WebRTC formats for playback.

Designed primarily for live streaming, MMS supports RTMP, HLS, HTTP-FLV, as well as WebRTC protocols like WHIP and WHEP, making it suitable as a core component of a real-time audio and video delivery system. It can be easily integrated with other open-source tools to build a complete streaming solution.

For system integration and operations, MMS provides a comprehensive HTTP API for status monitoring and supports HTTP callbacks to integrate features like authentication, event notifications, and custom business logic (e.g., DVR control).

MMS is developer-friendly and recommended for development and testing on Ubuntu 22.04 or Rocky Linux 9.5.

πŸ“˜ Documentation is available at: http://www.mms-server.tech/en/


Compilation with CMake

Requirements

  • Currently supports Linux platforms only.
  • Requires a GCC compiler with full C++20 support (GCC 13 or higher recommended).
  • Requires CMake version 3.25.0 or above.
  • Requires development tools: automake, autoconf, libtool.
  • Requires Go for building BoringSSL.
  • Requires NASM/YASM for building libav.

If compiling GCC (e.g., version 13.1+) from source, ensure it is configured with appropriate options. You can verify with g++ -v. A typical configuration command might look like:

../configure --enable-bootstrap --enable-languages=c,c++,lto --prefix=/root/gcc-13.1 \
--with-bugurl=https://bugs.rockylinux.org/ --enable-shared --enable-threads=posix \
--enable-checking=release --disable-multilib --with-system-zlib \
--enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object \
--enable-linker-build-id --with-gcc-major-version-only --enable-libstdcxx-backtrace \
--with-linker-hash-style=gnu --enable-plugin --enable-initfini-array \
--enable-offload-targets=nvptx-none --without-cuda-driver --enable-offload-defaulted \
--enable-gnu-indirect-function --enable-cet --with-tune=generic \
--with-arch_64=x86-64-v2 --with-build-config=bootstrap-lto --enable-link-serialization=1

Incorrect configuration may lead to linking errors. For more information, refer to this issue: #2


Building from Source

git clone https://github.com/jbl19860422/mms-server
cd mms-server
mkdir build && cd build
cmake .. && make -j4 install

⚠️ Ensure a stable internet connection during the build process, as third-party libraries (e.g., Boost, FFmpeg) will be downloaded. This may take some time.


Configuration

After compilation, the executable mms-live-server will be located in the mms-server/bin directory.

Before running, ensure proper configuration. MMS uses YAML format for its configuration files. To simplify deployment, no default domain is provided β€” you must configure at least one publishing domain; otherwise, streaming attempts will result in 403 Forbidden errors.

Configuration directory structure:

config/
β”œβ”€β”€ mms.yaml
β”œβ”€β”€ publish/
β”‚   β”œβ”€β”€ test1.publish.com.yaml
β”‚   └── test2.publish.com.yaml
β”œβ”€β”€ play/
β”‚   β”œβ”€β”€ test1.play.com.yaml
β”‚   └── test2.play.com.yaml
  • config/ β€” Main configuration directory.

    • mms.yaml: Global server settings (ports for RTMP, HTTP, RTSP, WebRTC, etc.)
  • publish/ β€” Configuration files for publishing domains (e.g., test1.publish.com.yaml).

  • play/ β€” Configuration files for playback domains (e.g., test1.play.com.yaml).

Each publishing domain can serve multiple playback domains. When a playback request is received, the system checks whether the corresponding stream exists under a valid publishing domain. If found, playback is allowed; otherwise, a 404 Not Found error is returned.

πŸ“˜ For detailed configuration examples, please refer to [xxxxx].


Running the Server

mms-live-server -c ./config -d
  • -c specifies the configuration directory.
  • -d enables log output to the console (omit this flag to write logs to files instead).

Compilation with XMake

Please refer to xmake_guide.md for more information.


Docker Compose Quick Deployment Guide

This project supports one-click deployment using Docker Compose. It is currently based on the Ubuntu 24.04 Docker image and is suitable for macOS and other non-Linux platforms to set up the environment conveniently.

1. Modify Configuration Files

In the docker-compose.yaml file, update the mount path <local mms-server path> and container name <container name> to your local directory and desired container name:

services:
  <container name>:
...
    container_name: <container name>
...
    volumes:
      - <local mms-server path>:/mnt/workspace/mms-server
...

(Optional) In the Dockerfile, you may change the default Ubuntu username myuser and password password to your custom credentials:

...
# Add a non-root user and grant sudo permissions
RUN useradd -ms /bin/bash myuser && \
    echo "myuser:password" | chpasswd && \
    usermod -aG sudo myuser

# Install xmake (as root)
RUN add-apt-repository -y ppa:xmake-io/xmake && \
    apt update && \
    apt install -y xmake

# Switch to the non-root user
USER myuser
WORKDIR /home/myuser
...

2. Build and Run the Container

Run the following commands in the project root directory:

# Start the container in the background (will build on first run)
docker compose up -d
# Enter the container shell
docker exec -it <container name> bash
# Stop the container
docker compose stop

Once inside the container, you can run xmake -j8 to automatically install project dependencies and build the project.


Single Server Console

πŸ“¦ Deploying the Web Console with mms-server

The mms-server includes a built-in static file server, allowing you to host the standalone Vue-based web console directly within the same server environment.

1. Configure mms.yaml

To enable the static file server and map the console path, update your mms.yaml as follows:

http_api:
  enabled: true
  port: 8080
  static_file_server:
    enabled: true
    path_map:
      /console/*: /data/console

This configuration maps requests to /console/* to the local directory /data/console.


2. Build and Deploy the Console

πŸ”Ή Clone the frontend project

Navigate to the console directory and initialize any submodules:

cd console
git submodule update --init --recursive

πŸ”Ή Build the project

Install dependencies and compile the Vue application:

npm install
npm run build

This will generate a console build directory inside the current folder.

πŸ”Ή Deploy the build

Copy the generated console directory to the target path configured in mms.yaml:

cp -rf console /data/

Make sure /data/console matches the path_map configuration above.


3. Access the Console

Once deployed, the console can be accessed at:

http://<your-ip>:8080/console/index.html

Replace <your-ip> and 8080 with the actual IP address and port defined in your http_api configuration.


πŸ“¦ Contact

  1. mms-server QQ Group: 1053583153
  2. Personal Contact: 13066836861
  3. Email: [email protected] or [email protected]

About

MMS is a high-performance, multi-threaded, and multi-coroutine real-time streaming server implemented in C++20. It currently supports rtmp[s]/http[s]-flv/http[s]-hls/http[s]-ts/rtsp[s]/webrtc.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages