GitHub - ossrs/srs at 1.0release (original) (raw)

Simple-RTMP-Server

SRS/1.0, HuKaiqun

SRS定位是运营级的互联网直播服务器集群,追求更好的概念完整性和最简单实现的代码。
SRS is industrial-strength live streaming cluster, for the best conceptual integrity and the simplest implementation.

Download from github.io: Centos6-x86_64, more...
Download from ossrs.net: Centos6-x86_64, more...
Website for SRS/1.0, read SRS 1.0 Chinese or English.

Donation Paypal

About

SRS(SIMPLE RTMP Server) over state-threads created in 2013.10.

SRS delivers rtmp/hls live on x86/x64/arm/mips linux, supports origin/edge/vhost and transcode/ingest and dvr/forward and http-api/http-callback/reload, introduces tracable session-oriented log, exports client srs-librtmp, provides EN/CN wiki and the most simple architecture.

AUTHORS

There are three types of people that have contributed to the SRS project:

About all PRIMARY, AUTHORS and CONTRIBUTORS, readAUTHORS.txt.

A big THANK YOU goes to:

Mirrors

Github: https://github.com/simple-rtmp-server/srs, the GIT usage(CN,EN)

git clone https://github.com/simple-rtmp-server/srs.git

CSDN: https://code.csdn.net/winlinvip/srs-csdn , the GIT usage(CN,EN)

git clone https://code.csdn.net/winlinvip/srs-csdn.git

OSChina: http://git.oschina.net/winlinvip/srs.oschina , the GIT usage(CN,EN)

git clone https://git.oschina.net/winlinvip/srs.oschina.git

Gitlab: https://gitlab.com/winlinvip/srs-gitlab , the GIT usage(CN,EN)

git clone https://gitlab.com/winlinvip/srs-gitlab.git

Usage

Step 1: get SRS

git clone https://github.com/simple-rtmp-server/srs && cd srs/trunk

Step 2: build SRS,Requires Centos6.x/Ubuntu12 32/64bits, others see Build(CN,EN).

./configure && make

Step 3: start SRS

./objs/srs -c conf/srs.conf

See also:

Wiki

SRS 1.0 wiki

Please select your language:

Donation

Donation:
http://www.ossrs.net/srs.release/donation/index.html

Donations:
[https://github.com/simple-rtmp-server/srs/blob/develop/DONATIONS.txt] (https://github.com/simple-rtmp-server/srs/blob/develop/DONATIONS.txt)

System Requirements

Supported operating systems and hardware:

Summary

  1. 简洁稳定:Simple, also stable enough.
  2. 高性能:High-performance: single-thread, async socket, event/st-thread driven.
  3. 高并发:High-concurrency, 1800 connections(500kbps), 900Mbps, CPU 90.2%, 41MB
  4. RTMP源站:Support RTMP Origin Server.
  5. CDN边缘(上下行加速):Support RTMP Edge Server for CDN, push/pull stream from any RTMP server
  6. 单进程(无多进程):Support single process; no multiple processes.
  7. 支持Vhost:Support Vhost, support __defaultVhost__.
  8. 直播(无点播):Support RTMP live streaming; no vod streaming.
  9. 苹果HLS:Support Apple HLS(m3u8) live streaming.
  10. 支持纯音频HLS:Support HLS audio-only live streaming.
  11. 支持Reload:Support Reload config to enable changes.
  12. 支持GopCache:Support cache last gop for flash player to fast startup.
  13. 侦听多端口:Support listen at multiple ports.
  14. 长时间推流:Support long time(>4.6hours) publish/play.
  15. 转发流:Support Forward in master-slave mode.
  16. 流转码:Support live stream Transcoding by ffmpeg.
  17. 支持FFMPEG滤镜:Support ffmpeg filters(logo/overlay/crop), x264 params, copy/vn/an.
  18. 只转码音频:Support audio transcode only, speex/mp3 to aac
  19. 支持HTTP回调:Support http callback api hooks(for authentication and injection).
  20. 带宽测速:Support bandwidth test api and flash client.
  21. 演示页面:Player, publisher(encoder), and demo pages(jquery+bootstrap).
  22. 视频会议演示:Demo video meeting or chat(SRS+cherrypy+jquery+bootstrap).
  23. 中文Wiki:Full documents in wiki, in Chineses.
  24. 客户端库:Support RTMP(play-publish) library: srs-librtmp
  25. 支持ARM平台:Support ARM(debian armhf, v7cpu) with rtmp/ssl/hls/librtmp.
  26. 支持Init.d脚本:Support init.d and packge script, log to file.
  27. 支持ATC:Support RTMP ATC for HLS/HDS to support backup(failover)
  28. 支持HTTP-RESTful-API:Support HTTP RESTful management api.
  29. 采集流:Support Ingest FILE/HTTP/RTMP/RTSP(RTP, SDP) to RTMP using external tools(e.g ffmepg).
  30. 支持录制:Support DVR, record live to flv file for vod.
  31. 可追溯日志:Support tracable log, session based log.
  32. 支持FMS-Token穿越:Support DRM token traverse for fms origin authenticate.
  33. 全面的Utest:Support system full utest on gtest.
  34. Stable 1.0release branch and2.0dev branch.

Releases

History

Performance

Performance benchmark history, on virtual box:

Latest benchmark(2014-07-12):

  1. 300 connections, 150Mbps, 500kbps, CPU 5.7%, MEM 9208KB.
  2. 600 connections, 300Mbps, 500kbps, CPU 18.3%, MEM 13MB.
  3. 900 connections, 450Mbps, 500kbps, CPU 27.9%, MEM 20MB.
  4. 1200 connections, 600Mbps, 500kbps, CPU 43.9%, MEM 26MB.
  5. 1500 connections, 750Mbps, 500kbps, CPU 55.2%, MEM 32MB.
  6. 1800 connections, 900Mbps, 500kbps, CPU 68.8%, MEM 38MB.
  7. 2100 connections, 1050Mbps, 500kbps, CPU 75.7%, MEM 46MB.
  8. 2400 connections, 1200Mbps, 500kbps, CPU 83.7%, MEM 54MB.
  9. 2700 connections, 1350Mbps, 500kbps, CPU 89.9%, MEM 61MB.

[winlin@dev6 srs]$ dstat ----total-cpu-usage---- -dsk/total- ---net/lo-- ---paging-- ---system-- usr sys idl wai hiq siq| read writ| recv send| in out | int csw 29 17 39 0 0 15| 0 5325B| 163M 163M| 0 0 |4331 3386 30 16 38 0 0 16| 0 5325B| 160M 160M| 0 0 |4252 3332 30 15 37 0 0 17| 0 7646B| 169M 169M| 0 0 |4015 2886 30 17 36 0 0 17| 0 1638B| 197M 197M| 0 0 |4021 3037 31 17 35 0 0 17| 0 410B| 204M 204M| 0 0 |4181 3243 33 17 32 0 0 18| 0 2185B| 191M 191M| 0 0 |4305 3592 31 15 36 0 0 18| 0 1229B| 127M 127M| 0 0 |4446 3822 34 18 30 0 0 18| 0 0 | 231M 231M| 0 0 |4461 3691 32 17 33 0 0 18| 0 410B| 169M 169M| 0 0 |4518 3788

Architecture

SRS always use the most simple architecture to support complex transaction.

System Architecture

+------------------------------------------------------+ | SRS(Simple RTMP Server) | +---------------+---------------+-----------+----------+ | API/hook | Transcoder | HLS | RTMP | | http-parser | FFMPEG/x264 | NGINX/ts | protocol | +---------------+---------------+-----------+----------+ | Network(state-threads) | +------------------------------------------------------+ | All Linux(RHEL,CentOS,Ubuntu,Fedora...) | +------------------------------------------------------+

Modularity Architecture

+------------------------------------------------------+ | Main(srs/bandwidth/librtmp) | +------------------------------------------------------+ | App(Server/Client application) | +------------------------------------------------------+ | RTMP(Protocol stack) | +------------------------------------------------------+ | Kernel(depends on Core, provides error/log) | +------------------------------------------------------+ | Core(depends only on system apis) | +------------------------------------------------------+

Stream Architecture

               +---------+              +----------+
               + Publish +              +  Deliver |
               +---|-----+              +----|-----+

+----------------------+-------------------------+----------------+ | Input | SRS(Simple RTMP Server) | Output | +----------------------+-------------------------+----------------+ | Encoder(1) | +-> RTMP protocol ----+-> Flash Player | | (FMLE,FFMPEG, -rtmp-+->-+-> HLS/NGINX --------+-> m3u8 player | | Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server | | ......) | +-> Transcoder -------+-> RTMP Server | | | +-> DVR --------------+-> FILE | | | +-> BandwidthTest ----+-> Flash/StLoad | +----------------------+ | | | MediaSource(2) | | | | (RTSP,FILE, | | | | HTTP,HLS, ------+->-- Ingester ----(rtmp)-+-> SRS | | Device, | | | | ......) | | | +----------------------+-------------------------+----------------+

Remark: (1) Encoder: encoder must push RTMP stream to SRS server. (2) MediaSource: any media source, which can be ingest by ffmpeg. (3) Ingester: SRS will fork a process to run ffmpeg(or your application) to ingest any input to rtmp, push to SRS.

HDS/HLS origin backup

                    +----------+        +----------+
           +--ATC->-+  server  +--ATC->-+ packager +-+   +---------+

+----------+ | RTMP +----------+ RTMP +----------+ | | Reverse | +-------+ | encoder +->-+ +->-+ Proxy +-->-+ CDN + +----------+ | +----------+ +----------+ | | (nginx) | +-------+ +--ATC->-+ server +--ATC->-+ packager +-+ +---------+ RTMP +----------+ RTMP +----------+

RTMP cluster(origin/edge) Architecture

Remark: cluster over edge, see EdgeRemark: cluster over forward, see Forward

+---------+ +-----------------+ +-----------------------+

Schema#1: Any RTMP encoder push RTMP stream to RTMP (origin/edge)server, where SRS RTMP Edge server will forward stream to origin.

+-------------+ +-----------------+ +--------------------+ | RTMP Origin +-->-+ SRS(RTMP Edge) +--+->-+ Client(RTMP/HLS) | +-------------+ +-----------------+ | | Flash/IOS/Android | | +--------------------+ | | +-----------------+ +->-+ SRS(RTMP Edge) + +-----------------+ Schema#2: SRS RTMP Edge server pull stream from origin (or upstream SRS RTMP Edge server), then delivery to Client.

Bandwidth Test Workflow

+------------+ +----------+ | Client | | Server | +-----+------+ +-----+----+ | | | connect vhost-------------> | | <-----------result(success) | | | | <----------call(start play) | | result(playing)----------> | | <-------------data(playing) | | <-----------call(stop play) | | result(stopped)----------> | | | | <-------call(start publish) | | result(publishing)-------> | | data(publishing)---------> | | <--------call(stop publish) | | result(stopped)(1)-------> | | | | <--------------------report | | final(2)-----------------> | | |

@See: class SrsBandwidth comments.

Beijing, 2013.10
Winlin