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

Simple-RTMP-Server

CircleCI Wechat Skype

SRS/2.0, ZhouGuowen

SRS定位是运营级的互联网直播服务器集群,追求更好的概念完整性和最简单实现的代码。
SRS is an industrial-strength live streaming cluster, with 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/2.0, read SRS 2.0 Chinese or English.

Why SRS?

  1. We completely rewrote HLS following m3u8/ts spec, and HLS support h.264+aac/mp3.
  2. Highly efficient RTMP streaming, supporting 7k+ clients concurrency, vhost based, both origin and edge.
  3. Embedded simplified media HTTP server for HLS, api and HTTP flv/ts/mp3/aac streaming.
  4. Variety input: RTMP, pull by ingest file or stream(HTTP/RTMP/RTSP), push by stream caster RTSP/MPEGTS-over-UDP.
  5. Popular internet delivery: RTMP/HDS for flash, HLS for mobile(IOS/IPad/MAC/Android), HTTP flv/ts/mp3/aac streaming for user prefered.
  6. Enhanced DVR and hstrs: segment/session/append plan, customer path and HTTP callback. the hstrs(http stream trigger rtmp source) enable the http-flv stream standby util encoder start publish, similar to rtmp, which will trigger edge to fetch from origin.
  7. Multiple feature: transcode, forward, ingest, http hooks, dvr, hls, rtsp, http streaming, http api, refer, log, bandwith test and srs-librtmp.
  8. Best maintainess: simple arch over state-threads(coroutine), single thread, single process and for linux/osx platform, common server x86-64/i386/arm/mips cpus, rich comments, strictly follows RTMP/HLS/RTSP spec.
  9. Easy to use: both English and Chinese wiki, typically config files in trunk/conf, traceable and session based log, linux service script and install script.
  10. MIT license, open source with product management and evolution.

Enjoy it!

About

SRS(Simple RTMP Server) over state-threads created on 2013.10.

SRS delivers rtmp/hls/http/hds live on x86/x64/arm/mips linux/osx, 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, with stream caster to push MPEGTS-over-UDP/RTSP to SRS, provides EN/CN wiki and the most simple architecture.

AUTHORS

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

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

A big THANK YOU goes to:

Mirrors

Github: https://github.com/ossrs/srs, the GIT usage(CN, EN)

git clone https://github.com/ossrs/srs.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/ossrs/srs && cd srs/trunk

Step 2: build SRS,Requires Centos6.x/Ubuntu12 32/64bits, for others OS recommend docker, 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:

SRS 2.0 wiki

Please select your language:

System Requirements

Supported operating systems and hardware:

Features

  1. Simple, also stable enough.
  2. High-performance(CN, EN): single-thread, async socket, event/st-thread driven.
  3. High-concurrency(CN, EN), 6000+ connections(500kbps), 900Mbps, CPU 90.2%, 41MB
  4. Support RTMP Origin Server(CN,EN)
  5. Support RTMP Edge Server(CN, EN) for CDN, push/pull stream from any RTMP server
  6. Support single process; no multiple processes.
  7. Support Vhost(CN, EN), support __defaultVhost__.
  8. Support RTMP(CN, EN) live streaming; no vod streaming.
  9. Support Apple HLS(m3u8)(CN, EN) live streaming.
  10. Support HLS audio-only(CN, EN) live streaming.
  11. Support Reload(CN, EN) config to enable changes.
  12. Support cache last gop(CN, EN) for flash player to fast startup.
  13. Support listen at multiple ports.
  14. Support long time(>4.6hours) publish/play.
  15. Support Forward(CN, EN) in master-slave mode.
  16. Support live stream Transcoding(CN, EN) by ffmpeg.
  17. Support ffmpeg(CN, EN) filters(logo/overlay/crop), x264 params, copy/vn/an.
  18. Support audio transcode(CN, EN) only, speex/mp3 to aac
  19. Support http callback api hooks(CN, EN)(for authentication and injection).
  20. Support bandwidth test(CN, EN) api and flash client.
  21. Player, publisher(encoder), and demo pages(jquery+bootstrap)(CN,EN).
  22. Demo(CN, EN) video meeting or chat(SRS+cherrypy+jquery+bootstrap).
  23. Full documents in wiki(CN, EN), both Chinese and English.
  24. Support RTMP(play-publish) library: srs-librtmp(CN, EN)
  25. Support ARM cpu arch(CN, EN) with rtmp/ssl/hls/librtmp.
  26. Support init.d(CN, EN) and packge script, log to file.
  27. Support RTMP ATC(CN, EN) for HLS/HDS to support backup(failover)
  28. Support HTTP RESTful management api(CN, EN).
  29. Support Ingest(CN, EN) FILE/HTTP/RTMP/RTSP(RTP, SDP) to RTMP using external tools(e.g ffmepg).
  30. Support DVR(CN, EN), record live to flv file for vod.
  31. Support tracable log, session based log(CN, EN).
  32. Support DRM token traverse(CN, EN) for fms origin authenticate.
  33. Support system full utest on gtest.
  34. Support embeded HTTP server(CN, EN) for hls(live/vod)
  35. Support vod stream(http flv/hls vod stream)(CN, EN).
  36. Stable 1.0release branch.
  37. Support publish h264 raw stream(CN, EN) by srs-librtmp.
  38. Support 6k+ clients, 3Gbps per process.
  39. Suppport English wiki.
  40. Research and simplify st, bug #182.
  41. Support compile srs-librtmp on windows, bug #213.
  42. Support 10k+ clients, 4Gbps per process.
  43. Support publish aac adts raw stream(CN, EN) by srs-librtmp.
  44. Support 0.1s+ latency, read bug #257.
  45. Support allow/deny publish/play for all or specified ip(CN, EN).
  46. Support custom dvr path and http callback, read bug #179 and bug #274.
  47. Support rtmp remux to http flv/mp3/aac/ts live stream, read bug #293(CN, EN).
  48. Support HLS(h.264+mp3) streaming, read bug #301.
  49. Rewrite HLS(h.264+aac/mp3) streaming, read bug #304.
  50. [dev] Realease 2.0release branch.
  51. [experiment] Support Adobe HDS(f4m)(CN, EN) dynamic streaming.
  52. [experiment] Support push MPEG-TS over UDP to SRS, read bug #250.
  53. [experiment] Support push RTSP to SRS, read bug #133.
  54. [experiment] Support push flv stream over HTTP POST to SRS, read [wiki](CN, EN).
  55. [experiment] Support srs-dolphin, the multiple-process SRS.
  56. [experiment] Support remote console, read srs-ngb.

Compare

Compare SRS with other media server.

Stream Delivery

Feature SRS NGINX CRTMPD FMS WOWZA
RTMP Stable Stable Stable Stable Stable
HLS Stable Stable X Stable Stable
HDS Experiment X X Stable Stable
HTTP FLV Stable X X X X
HLS(aonly) Stable X X Stable Stable
HTTP Server Stable Stable X X Stable

Cluster

Feature SRS NGINX CRTMPD FMS WOWZA
RTMP Edge Stable X X Stable X
RTMP Backup Stable X X X X
VHOST Stable X X Stable Stable
Reload Stable X X X X
Forward Stable X X X X
ATC Stable X X X X

Stream Service

Feature SRS NGINX CRTMPD FMS WOWZA
DVR Stable Stable X X Stable
Transcode Stable X X X Stable
HTTP API Stable Stable X X Stable
HTTP hooks Stable X X X X
GopCache Stable X X Stable X
Security Stable Stable X X Stable
Token Traverse Stable X X Stable X

Efficiency

Feature SRS NGINX CRTMPD FMS WOWZA
Concurrency 7.5k 3k 2k 2k 3k
MultipleProcess Experiment Stable X X X
RTMP Latency 0.1s 3s 3s 3s 3s
HLS Latency 10s 30s X 30s 30s

Stream Caster

Feature SRS NGINX CRTMPD FMS WOWZA
Ingest Stable X X X X
Push MPEGTS Experiment X X X Stable
Push RTSP Experiment X Stable X Stable
Push HTTP FLV Experiment X X X X

Debug System

Feature SRS NGINX CRTMPD FMS WOWZA
BW check Stable X X X X
Tracable Log Stable X X X X

Docs

Feature SRS NGINX CRTMPD FMS WOWZA
Demos Stable X X X X
WIKI(EN+CN) Stable EN only X X Stable

Others

Feature SRS NGINX CRTMPD FMS WOWZA
ARM/MIPS Stable Stable X X X
Client Library Stable X X X X

Remark:

  1. Concurrency: The concurrency of single process.
  2. MultipleProcess: SRS is single process, while srs-dolphin is a MultipleProcess SRS.
  3. HLS aonly: The HLS audio only streaming delivery.
  4. BW check: The bandwidth check.
  5. Security: To allow or deny stream publish or play.
  6. Reload: Nginx supports reload, but not nginx-rtmp.

Releases

History

Performance

Performance benchmark history, on virtual box.

Play RTMP benchmark

The play RTMP benchmark by SB:

Update SRS Clients Type CPU Memory Commit
2013-11-28 0.5.0 1.8k(1800) players 90% 41M -
2014-07-12 0.9.156 1.8k(1800) players 68% 38MB -
2014-07-12 0.9.156 2.7k(2700) players 89% 61MB code
2014-11-11 1.0.5 2.7k(2700) players 85% 66MB -
2014-11-11 2.0.12 2.7k(2700) players 85% 66MB -
2014-11-12 2.0.14 2.7k(2700) players 69% 59MB -
2014-11-12 2.0.14 3.5k(3500) players 95% 78MB code
2014-11-13 2.0.15 6.0k(6000) players 82% 203MB code
2014-11-22 2.0.30 7.5k(7500) players 87% 320MB code
2014-12-05 2.0.55 8.0k(8000) players 89% 360MB code
2014-12-05 2.0.57 9.0k(9000) players 90% 468MB code
2014-12-07 2.0.67 10k(10000) players 95% 656MB code

Publish RTMP benchmark

The publish RTMP benchmark by SB:

Update SRS Clients Type CPU Memory Commit
2014-12-03 1.0.10 1.2k(1200) publishers 96% 43MB -
2014-12-03 2.0.12 1.2k(1200) publishers 96% 43MB -
2014-12-03 2.0.47 1.2k(1200) publishers 84% 76MB code
2014-12-03 2.0.47 1.4k(1400) publishers 95% 140MB -
2014-12-03 2.0.48 1.4k(1400) publishers 95% 140MB code
2014-12-04 2.0.49 1.4k(1400) publishers 68% 144MB -
2014-12-04 2.0.49 2.5k(2500) publishers 95% 404MB code
2014-12-04 2.0.51 2.5k(2500) publishers 91% 259MB code
2014-12-04 2.0.52 4.0k(4000) publishers 80% 331MB code

Play HTTP FLV benchmark

The play HTTP FLV benchmark by SB:

Update SRS Clients Type CPU Memory Commit
2014-05-24 2.0.167 1.0k(1000) players 82% 86MB -
2014-05-24 2.0.168 2.3k(2300) players 92% 276MB code
2014-05-24 2.0.169 3.0k(3000) players 94% 188MB code
2014-05-24 2.0.170 3.0k(3000) players 89% 96MB code
2014-05-25 2.0.171 6.0k(6000) players 84% 297MB code

Latency benchmark

The latency between encoder and player with realtime config(CN, EN): |

Update SRS VP6 H.264 VP6+MP3 H.264+MP3
2014-12-03 1.0.10 0.4s 0.4s 0.9s 1.2s
2014-12-12 2.0.70 0.1s 0.4s 1.0s 0.9s
2014-12-16 2.0.72 0.1s 0.4s 0.8s 0.6s

2018-08-05, c45f72e, Refine HTTP-FLV latency, support realtime mode. 2.0.252

We use FMLE as encoder for benchmark. The latency of server is 0.1s+, and the bottleneck is the encoder. For more information, readbug #257.

HLS overhead

About the HLS overhead of SRS, we compare the overhead to FLV by remux the HLS to FLV by ffmpeg.

Bitrate Duration FLV(KB) HLS(KB) Overhead
275kbps 600s 11144 12756 14.46%
260kbps 1860s 59344 68004 14.59%
697kbps 60s 5116 5476 7.03%
565kbps 453s 31316 33544 7.11%
565kbps 1813s 125224 134140 7.12%
861kbps 497s 52316 54924 4.98%
857kbps 1862s 195008 204768 5.00%
1301kbps 505s 80320 83676 4.17%
1312kbps 1915s 306920 319680 4.15%
2707kbps 600s 198356 204560 3.12%
2814kbps 1800s 618456 637660 3.10%
2828kbps 60s 20716 21356 3.08%
2599kbps 307s 97580 100672 3.16%
2640kbps 1283s 413880 426912 3.14%
5254kbps 71s 45832 47056 2.67%
5147kbps 370s 195040 200280 2.68%
5158kbps 1327s 835664 858092 2.68%

The HLS overhead is calc by: (HLS - FLV) / FLV * 100%.

The overhead is larger than this benchmark(48kbps audio is best overhead), for we fix the #512.

Architecture

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

System Architecture

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

Modularity Architecture

+------------------------------------------------------+ | Main(srs/ingest-hls/librtmp) | +------------------------------------------------------+ | App(Server/Client application) | +------------------------------------------------------+ | RTMP/HTTP/RawStream(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/HDS --------+-> Flash player | | (FMLE,FFMPEG, -rtmp-+->-+-> HLS/HTTP ---------+-> M3u8 player | | Flash,XSPLIT, | +-> FLV/MP3/Aac/Ts ---+-> HTTP player | | ......) | +-> Fowarder ---------+-> RTMP server | | | +-> Transcoder -------+-> RTMP server | | | +-> DVR --------------+-> Flv file | | | +-> BandwidthTest ----+-> flash | +----------------------+ | | | MediaSource(2) | | | | (RTSP,FILE, | | | | HTTP,HLS, --pull-+->-- Ingester(3) -(rtmp)-+-> SRS | | Device, | | | | ......) | | | +----------------------+ | | | MediaSource(2) | | | | (RTSP,FILE, | | | | HTTP,HLS, --push-+->-- Streamer(4) -(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. Read Ingest. (4) Streamer: SRS will listen for some protocol and accept stream push over some protocol and remux to rtmp to SRS. Read Streamer.

Beijing, 2013.10
Winlin