media-server

A brpc-based server to host and proxy live streams

Github星跟蹤圖

media-server

media-server is a live streaming server based on brpc used in Live Streaming Service of Baidu Cloud.

Main features

Getting Started

Supported operating system: Linux, MacOSX.

  • Install brpc which is the main dependency of media-server
  • Compile media-server with cmake:
mkdir build && cd build && cmake .. && make -sj4
  • Run media-server as origin server with minimum configuration(the default port is 8079):
./output/bin/media_server

Then you can push/play stream from it.

Main options

Please run

./output/bin/media_server --help

to get all configurations in detail.

  • -proxy_to
    When not specified or empty, media-server runs in origin mode, which aggregates push(such as OBS, ffmpeg) and accepts play(such as cyberplayer, ffplay) requests.

  • -proxy_lb
    When -proxy_to is a naming service(such as http://...), you need to specify load balancing algorithm. The options are rr, random, la, c_murmurhash and c_md5. Read client load balancing for details.

  • -port
    Specifies the service port of media-server. Brpc is characterized by supporting all protocols on the same port, so this port can also be used for accessing the built-in service via http. Only ports in the range of 8000-9000 can be accessed by browsers, which means if the service port is external, be sure to configure -internal_port to prevent built-in service from leaking detailed service information.

  • -internal_port
    This port can be configured as a port that can only be accessed on the internal network. In this case, the -port port no longer provides built-in services, but will only be accessible through this port.

  • -retry_interval_ms
    When media-server runs in edge mode, push and pull requests to upstreams will be retried when error happens until clients no longer need. This option specifies the minimum interval for continuous retry, which is 1 second by default.

  • -share_play_connection
    When set to true, multiple streams connected to the same server will reuse the same rtmp connection in play.

  • -share_publish_connection
    When set to true, multiple streams connected to the same server will reuse the same rtmp connection in publish.

  • -timeout_ms
    Timeout period for creating a stream when media-server runs in edge mode. The default value is 1000ms.

  • -server_idle_timeout
    Connections without data transmission for so many seconds will be closed. The default value is -1(turned off).

  • -cdn_merge_to
    When this option is set, media-server starts two ports, one for external service request and the other for the aggregating request. Usually the aggregating server will be found using consistent hashing, which is used widely in cache service. This option is often used in cdn nodes.

  • -cdn_merge_lb
    The load balancing algorithm. Read the explanation written below -proxy_lb.

  • -flagfile
    media-server uses gflags options, which is specified by default in the command line and can also in file format during online deployment by using -flagfile.

Examples

Other docs

主要指標

概覽
名稱與所有者brpc/media-server
主編程語言C++
編程語言CMake (語言數: 3)
平台
許可證Apache License 2.0
所有者活动
創建於2018-08-03 11:25:33
推送於2021-04-16 19:49:56
最后一次提交2021-04-16 21:49:56
發布數0
用户参与
星數263
關注者數26
派生數74
提交數22
已啟用問題?
問題數7
打開的問題數3
拉請求數3
打開的拉請求數1
關閉的拉請求數0
项目设置
已啟用Wiki?
已存檔?
是復刻?
已鎖定?
是鏡像?
是私有?