README_en.md 26 KB

logo

简体中文 | English

An high-performance, enterprise-level streaming media service framework based on C++11.

Project Features

  • Developed with C++11, avoiding the use of raw pointers, providing stable and reliable code with superior performance.
  • Supports multiple protocols (RTSP/RTMP/HLS/HTTP-FLV/WebSocket-FLV/GB28181/HTTP-TS/WebSocket-TS/HTTP-fMP4/WebSocket-fMP4/MP4/WebRTC), and protocol conversion.
  • Developed with multiplexing/multithreading/asynchronous network IO models, providing excellent concurrency performance and supporting massive client connections.
  • The code has undergone extensive stability and performance testing, and has been extensively used in production environments.
  • Supports all major platforms, including linux, macos, ios, android, and windows.
  • Supports multiple instruction set platforms, such as x86, arm, risc-v, mips, Loongson, and Shenwei.
  • Provides ultra-fast startup, extremely low latency (within 500 milliseconds, and can be as low as 100 milliseconds), and excellent user experience.
  • Provides a comprehensive standard C API that can be used as an SDK or called by other languages.
  • Provides a complete MediaServer server, which can be deployed directly as a commercial server without additional development.
  • Provides a complete restful api and web hook, supporting rich business logic.
  • Bridges the video surveillance protocol stack and the live streaming protocol stack, and provides comprehensive support for RTSP/RTMP.
  • Fully supports H265/H264/AAC/G711/OPUS.
  • Provides complete functions, including clustering, on-demand protocol conversion, on-demand push/pull streams, playback before publishing, and continuous publishing after disconnection.
  • Provides ultimate performance, supporting 10W-level players on a single machine and 100Gb/s-level IO bandwidth capability.
  • Provides ultimate user experience with exclusive features.
  • Who is using zlmediakit?
  • Fully supports IPv6 networks.

Project Positioning

  • Cross-platform streaming media solution for mobile and embedded systems.
  • Commercial-grade streaming media server.
  • Network programming secondary development SDK.

Feature List

Overview of Features

Overview of Features

  • RTSP[S]

    • RTSP[S] server, supports RTMP/MP4/HLS to RTSP[S] conversion, supports devices such as Amazon Echo Show
    • RTSP[S] player, supports RTSP proxy, supports generating silent audio
    • RTSP[S] push client and server
    • Supports four RTP transmission modes: rtp over udp rtp over tcp rtp over http rtp multicast
    • Server/client fully supports Basic/Digest authentication, asynchronous configurable authentication interface
    • Supports H265 encoding
    • The server supports RTSP pushing (including rtp over udp and rtp over tcp)
    • Supports H264/H265/AAC/G711/OPUS/MJPEG encoding. Other encodings can be forwarded but cannot be converted to protocol
  • RTMP[S]

    • RTMP[S] playback server, supports RTSP/MP4/HLS to RTMP conversion
    • RTMP[S] publishing server, supports recording and publishing streams
    • RTMP[S] player, supports RTMP proxy, supports generating silent audio
    • RTMP[S] push client
    • Supports http[s]-flv live streaming server
    • Supports http[s]-flv live streaming player
    • Supports websocket-flv live streaming
    • Supports H264/H265/AAC/G711/OPUS encoding. Other encodings can be forwarded but cannot be converted to protocol
    • Supports RTMP-H265
    • Supports RTMP-OPUS
    • Supports enhanced-rtmp(H265)
  • HLS

    • Supports HLS file(mpegts/fmp4) generation and comes with an HTTP file server
    • Through cookie tracking technology, it can simulate HLS playback as a long connection, which can achieve HLS on-demand pulling, playback statistics, and other businesses
    • Supports HLS player and can pull HLS to rtsp/rtmp/mp4
    • Supports H264/H265/AAC/G711/OPUS encoding
  • TS

    • Supports http[s]-ts live streaming
    • Supports ws[s]-ts live streaming
    • Supports H264/H265/AAC/G711/OPUS encoding
  • fMP4

    • Supports http[s]-fmp4 live streaming
    • Supports ws[s]-fmp4 live streaming
    • Supports H264/H265/AAC/G711/OPUS/MJPEG encoding
  • HTTP[S] and WebSocket

    • The server supports directory index generation, file download, form submission requests
    • The client provides file downloader (supports resume breakpoint), interface requestor, file uploader
    • Complete HTTP API server, which can be used as a web backend development framework
    • Supports cross-domain access
    • Supports http client/server cookie
    • Supports WebSocket server and client
    • Supports http file access authentication
  • GB28181 and RTP Streaming

    • Supports UDP/TCP RTP (PS/TS/ES) streaming server, which can be converted to RTSP/RTMP/HLS and other protocols
    • Supports RTSP/RTMP/HLS and other protocol conversion to RTP streaming client, supports TCP/UDP mode, provides corresponding RESTful API, supports active and passive modes
    • Supports H264/H265/AAC/G711/OPUS encoding
    • Supports ES/PS/TS/EHOME RTP streaming
    • Supports ES/PS RTP forwarding
    • Supports GB28181 active pull mode
    • Supports two-way voice intercom
  • MP4 VOD and Recording

    • Supports recording as FLV/HLS/MP4
    • Supports MP4 file playback for RTSP/RTMP/HTTP-FLV/WS-FLV, supports seek
    • Supports H264/H265/AAC/G711/OPUS encoding
  • WebRTC

    • Supports WebRTC streaming and conversion to other protocols
    • Supports WebRTC playback and conversion from other protocols to WebRTC
    • Supports two-way echo testing
    • Supports simulcast streaming
    • Supports uplink and downlink RTX/NACK packet loss retransmission
    • Supports single-port, multi-threaded, and client network connection migration (unique in the open source community).
    • Supports TWCC RTCP dynamic rate control
    • Supports REMB/PLI/SR/RR RTCP
    • Supports RTP extension parsing
    • Supports GOP buffer and instant WebRTC playback
    • Supports data channels
    • Supports WebRTC over TCP mode
    • Excellent NACK and jitter buffer algorithms with outstanding packet loss resistance
    • Supports WHIP/WHEP protocols
  • SRT support

  • Others

    • Supports rich RESTful APIs and webhook events
    • Supports simple Telnet debugging
    • Supports hot reloading of configuration files
    • Supports traffic statistics, stream authentication, and other events
    • Supports virtual hosts for isolating different domain names
    • Supports on-demand streaming and automatic shutdown of streams with no viewers
    • Supports pre-play before streaming to increase the rate of timely stream openings
    • Provides a complete and powerful C API SDK
    • Supports FFmpeg stream proxy for any format
    • Supports HTTP API for real-time screenshot generation and return
    • Supports on-demand demultiplexing and protocol conversion, reducing CPU usage by only enabling it when someone is watching
    • Supports cluster deployment in traceable mode, with RTSP/RTMP/HLS/HTTP-TS support for traceable mode and HLS support for edge stations and multiple sources for source stations (using round-robin tracing)
    • Can reconnect to streaming after abnormal disconnection in RTSP/RTMP/WebRTC pushing within a timeout period, with no impact on the player.

System Requirements

  • Compiler with c++11 support, such as GCC 4.8+, Clang 3.3+, or VC2015+.
  • CMake 3.1+.
  • Linux (32-bit and 64-bit).
  • Apple macOS (32-bit and 64-bit).
  • Any hardware with x86, x86_64, ARM, or MIPS CPU.
  • Windows.

How to build

It is recommended to compile on Ubuntu or macOS. Compiling on Windows is cumbersome, and some features are not compiled by default.

Before Building

  • You must use Git to clone the complete code. Do not download the source code by downloading the ZIP package. Otherwise, the submodule code will not be downloaded by default. You can do it like this:

    git clone https://github.com/ZLMediaKit/ZLMediaKit.git
    cd ZLMediaKit
    git submodule update --init
    

Building on Linux

  • My Environment
    • Ubuntu 16.04 (64-bit) with GCC 5.4.
    • CMake 3.5.1.
  • Guidance

    	# If it is on CentOS 6.x, you need to install a newer version of GCC and CMake first,
    	# and then compile manually according to the "build_for_linux.sh" script.
    	# If it is on a newer version of a system such as Ubuntu or Debian,
    	# step 4 can be manipulated directly.
    	
    	# 1. Install GCC 5.2 (this step can be skipped if the GCC version is higher than 4.7).
    	sudo yum install centos-release-scl -y
    	sudo yum install devtoolset-4-toolchain -y
    	scl enable devtoolset-4 bash
    	
    	# 2. Install CMake (this step can be skipped if the CMake version is higher than 3.1).
    	tar -xvf cmake-3.10.0-rc4.tar.gz #you need to download the CMake source file manually
    	cd cmake-3.10.0-rc4
    	./configure
    	make -j4
    	sudo make install
    	
    	# 3. Switch to a higher version of GCC.
    	scl enable devtoolset-4 bash
    	
    	# 4. Build.
    	cd ZLMediaKit
    	./build_for_linux.sh
    

Building on macOS

  • My Environment
    • macOS Sierra (10.12.1) with Xcode 8.3.1.
    • Homebrew 1.1.3.
    • CMake 3.8.0.
  • Guidance

    cd ZLMediaKit
    ./build_for_mac.sh
    

Building on iOS

  • You can generate Xcode projects and recompile them , learn more:

    cd ZLMediaKit
    mkdir -p build
    cd build
    # Generate Xcode project, project file is in build directory
    cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../cmake/ios.toolchain.cmake  -DPLATFORM=OS64COMBINED
    

Building on Android

Now you can open the Android Studio project in the Android folder. This is an AAR library and demo project.

  • My environment

    • macOS Sierra (10.12.1) + Xcode 8.3.1
    • Homebrew 1.1.3
    • CMake 3.8.0
    • Android NDK r14b
  • Guidance

    cd ZLMediaKit
    export ANDROID_NDK_ROOT=/path/to/ndk
    ./build_for_android.sh
    

Building on Windows

  • My environment

  • Guidance

    1. Enter the ZLMediaKit directory and execute `git submodule update --init` to download the code for ZLToolKit.
    2. Open the project with CMake GUI and generate the Visual Studio project file.
    3. Find the project file (ZLMediaKit.sln), double-click to open it with VS2017.
    4. Choose to compile the Release version. Find the target file and run the test cases.
    

Usage