SRS/4.0,Leo,是一个简单高效的实时视频服务器,支持RTMP/WebRTC/HLS/HTTP-FLV/SRT。
SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT.
SRS is licenced under MIT, but some depended libraries are distributed using their own licenses.
Run SRS by docker, images is here or there, please set the CANDIDATE (CN,EN) if WebRTC enabled:
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 \
--env CANDIDATE=$(ifconfig en0 inet| grep 'inet '|awk '{print $2}') -p 8000:8000/udp \
ossrs/srs:v4.0.139 ./objs/srs -c conf/srs.conf
Or build SRS from source(or mirrors), by CentOS7(or Linux(CN,EN)):
git clone -b 4.0release https://gitee.com/ossrs/srs.git &&
cd srs/trunk && ./configure && make && ./objs/srs -c conf/srs.conf
Open http://localhost:8080/ to check it, then publish stream by FFmpeg. It's also able to publish by H5 if WebRTC is enabled:
docker run --rm -it --network=host ossrs/srs:encoder \
ffmpeg -re -i ./doc/source.flv -c copy -f flv -y rtmp://localhost/live/livestream
Play the following streams by players:
- RTMP (by VLC): rtmp://localhost/live/livestream
- H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
- H5(HLS): http://localhost:8080/live/livestream.m3u8
- H5(WebRTC): webrtc://localhost/live/livestream
From here, please read wikis:
- SRS 4.0 English Wiki, please read Wiki first.
- SRS 4.0 中文Wiki,不读Wiki一定扑街,不读文档请不要提Issue,不读文档请不要提问题,任何文档中明确说过的疑问都不会解答。
- 学习路径,如何快速学习和掌握SRS,分层次了解流媒体服务器的知识。
Fast index for Wikis:
- How to deliver RTMP streaming?(CN, EN)
- How to build RTMP Edge-Cluster?(CN, EN)
- How to build RTMP Origin-Cluster?(CN, EN)
- How to deliver HTTP-FLV streaming?(CN, EN)
- How to deliver HLS streaming?(CN, EN)
- How to deliver low-latency streaming?(CN, EN)
- How to use WebRTC? (CN, EN)
Other important wiki:
- Usage: How to delivery DASH(Experimental)?(CN, EN)
- Usage: How to transode RTMP stream by FFMPEG?(CN, EN)
- Usage: How to delivery HTTP FLV Live Streaming Cluster?(CN, EN)
- Usage: How to ingest file/stream/device to RTMP?(CN, EN)
- Usage: How to forward stream to other servers?(CN, EN)
- Usage: How to improve edge performance for multiple CPUs? (CN, EN)
- Usage: How to file a bug or contact us? (CN, EN)
There are two types of people that have contributed to the SRS project:
- Maintainers: Contribute and maintain important features. SRS always remembers and thanks you by writing your names in stream metadata.
- Contributors: Submit patches, report bugs, add translations, help answer newbie questions, and generally make SRS much better.
Maintainers of SRS project:
- Winlin: All areas of streaming server and documents.
- Wenjie: The focus of his work is on the HDS module.
- Runner365: The focus of his work is on the SRT module.
- John: Focus on WebRTC module.
- B.P.Y(Bepartofyou): Focus on WebRTC module.
- Lixin: Focus on GB28181 module.
- Mozhan: Focus on WebRTC module.
- Jinxue: Focus on WebRTC module.
A big THANK YOU goes to:
- All friends of SRS for big supports.
- Genes amd Mabbott for creating st(state-threads).
- Michael Talyanksy for introducing ST to us.
The ports used by SRS, kernel services:
tcp://1935
, for RTMP live streaming server(CN,EN).tcp://1985
, HTTP API server, for HTTP-API(CN, EN), WebRTC(CN, EN), etc.tcp://8080
, HTTP live streaming server, HTTP-FLV(CN, EN), HLS(CN, EN) as such.udp://8000
, WebRTC Media(CN, EN) server.
For optional HTTPS services, which might be provided by other web servers:
tcp://8088
, HTTPS live streaming server.tcp://1990
, HTTPS API server.
For optional stream caster services, to push streams to SRS:
udp://8935
, Stream Caster: Push MPEGTS over UDP server.tcp://554
, Stream Caster: Push RTSP server.tcp://8936
, Stream Caster: Push HTTP-FLV server.udp://10080
, Stream Caster: Push SRT Media server.
For external services to work with SRS:
udp://1989
, WebRTC Signaling server.
The API used by SRS:
/api/v1/
The HTTP API path./rtc/v1/
The HTTP API path for RTC./sig/v1/
The demo signaling API.
Other API used by ossrs.net:
/gif/v1
The statistic API./service/v1/
The latest available version API./ws-service/v1/
The latest available version API, by websocket./im-service/v1/
The latest available version API, by IM./code-service/v1/
The latest available version API, by Code verification.
- Using coroutine by ST, it's really simple and stupid enough.
- Support cluster which consists of origin (CN,EN) and edge(CN, EN) server and uses RTMP as default transport protocol.
- Origin server supports remuxing RTMP to HTTP-FLV(CN, EN) and HLS(CN, EN).
- Edge server supports remuxing RTMP to HTTP-FLV(CN, EN). As for HLS(CN, EN) edge server, recomment to use HTTP edge server, such as NGINX.
- Support HLS with audio-only(CN, EN), which need to build the timestamp from AAC samples, so we enhanced it please read #547.
- Support HLS with mp3(h.264+mp3) audio codec, please read bug #301.
- Support transmux RTMP to HTTP-FLV/MP3/AAC/TS, please read wiki(CN, EN).
- Support ingesting(CN, EN) other protocols to SRS by FFMPEG.
- Support RTMP long time(>4.6hours) publishing/playing, with the timestamp corrected.
- Support native HTTP server(CN, EN) for http api and http live streaming.
- Support HTTP CORS for js in http api and http live streaming.
- Support HTTP API(CN, EN) for system management.
- Support HTTP callback(CN, EN) for authentication and integration.
- Support DVR(CN, EN) to record live streaming to FLV file.
- Support DVR control module like NGINX-RTMP, please read #459.
- Support EXEC like NGINX-RTMP, please read bug #367.
- Support security strategy including allow/deny publish/play IP(CN, EN).
- Support low latency(0.1s+) transport model, please read bug #257.
- Support gop-cache(CN, EN) for player fast startup.
- Support Vhost(CN, EN) and __defaultVhost__.
- Support reloading(CN, EN) to apply changes of config.
- Support listening at multiple ports.
- Support forwarding(CN, EN) to other RTMP servers.
- Support transcoding(CN, EN) by FFMPEG.
- All wikis are writen in Chinese and English.
- Enhanced json, replace NXJSON(LGPL) with json-parser(BSD), read #904.
- Support valgrind and latest ARM by patching ST, read ST#1 and ST#2.
- Support traceable and session-based log(CN, EN).
- High performance(CN, EN) RTMP/HTTP-FLV, 6000+ connections.
- Enhanced complex error code with description and stack, read #913.
- Enhanced RTMP url which supports vhost in stream, read #1059.
- Support origin cluster, please read #464, RTMP 302.
- Support listen at IPv4 and IPv6, read #460.
- Improve test coverage for core/kernel/protocol/service.
- Support docker by srs-docker.
- Support multiple processes by ReusePort(CN, EN), #775.
- Support a simple mgmt console, please read srs-console.
- [Experimental] Support playing stream by WebRTC, #307.
- [Experimental] Support publishing stream by WebRTC, #307.
- [Experimental] Support mux RTP/RTCP/DTLS/SRTP on one port for WebRTC, #307.
- [Experimental] Support client address changing for WebRTC, #307.
- [Experimental] Support transcode RTMP/AAC to WebRTC/Opus, #307.
- [Experimental] Support AV1 codec for WebRTC, #2324.
- [Experimental] Enhance HTTP Stream Server for HTTP-FLV, HTTPS, HLS etc. #1657.
- Support push stream by GB28181, #1500.
- [Experimental] Support DVR in MP4 format, read #738.
- [Experimental] Support MPEG-DASH, the future live streaming protocol, read #299.
- [Experimental] Support pushing MPEG-TS over UDP, please read bug #250.
- [Experimental] Support pushing FLV over HTTP POST, please read wiki(CN, EN).
- [Experimental] Support HTTP RAW API, please read #459, #470, #319.
- [Experimental] Support SRT server, read #1147.
- [Experimental] Support transmux RTC to RTMP, #2093.
- [Deprecated] Support pushing RTSP, please read bug #2304.
- [Deprecated] Support Adobe HDS(f4m), please read wiki(CN, EN) and #1535.
- [Deprecated] Support bandwidth testing, please read #1535.
- [Deprecated] Support Adobe FMS/AMS token traverse(CN, EN) authentication, please read #1535.
- [Removed] Support RTMP client library: srs-librtmp.
- Support IETF-QUIC for WebRTC Cluster, #2091.
- Enhanced forwarding with vhost and variables, #1342.
- Support DVR to Cloud Storage, #1193.
- Support H.265 over RTMP and HLS, #465.
- Improve RTC performance to 5K by multiple threading, #2188.
- Support source cleanup for idle streams, #413.
- Support change user to run SRS, #1111.
- Support HLS variant, #463.
Remark: About the milestone and product plan, please read (CN, EN) wiki.
Please read CHANGELOG.
- 2020-07-04, Release v4.0.139, 4.0 dev0, v4.0.139, 143245 lines.
- 2020-06-27, Release v3.0-r0, 3.0 release0, 3.0.141, 122674 lines.
- 2020-03-29, Release v3.0-b3, 3.0 beta4, 3.0.139, 122674 lines.
- 2020-03-18, Release v3.0-b3, 3.0 beta3, 3.0.134, 122509 lines.
- 2020-03-05, Release v3.0-b2, 3.0 beta2, 3.0.123, 122170 lines.
- 2020-02-14, Release v3.0-b1, 3.0 beta1, 3.0.117, 121964 lines.
- 2020-02-02, Release v3.0-b0, 3.0 beta0, 3.0.112, 121709 lines.
- 2020-01-21, Release v3.0-a9, 3.0 alpha9, 3.0.105, 121577 lines.
- 2020-01-10, Release v3.0-a8, 3.0 alpha8, 3.0.97, 121555 lines.
- 2019-12-29, Release v3.0-a7, 3.0 alpha7, 3.0.90, 116356 lines.
- 2019-12-26, Release v3.0-a6, 3.0 alpha6, 3.0.85, 116056 lines.
- 2019-12-19, Release v3.0-a5, 3.0 alpha5, 3.0.75, 115362 lines.
- 2019-12-13, Release v3.0-a4, 3.0 alpha4, 3.0.71, 112928 lines.
- 2019-11-30, Release v3.0-a3, 3.0 alpha3, 3.0.67, 110864 lines.
- 2019-11-30, Release v3.0-a2, 3.0 alpha2, 3.0.66, 110831 lines.
- 2019-10-07, Release v3.0-a1, 3.0 alpha1, 3.0.60, 107962 lines.
- 2019-10-04, Release v3.0-a0, 3.0 alpha0, 3.0.56, 107946 lines.
- 2017-03-03, Release v2.0-r0, 2.0 release0, 2.0.234, 86373 lines.
- 2016-11-13, Release v2.0-b3, 2.0 beta3, 2.0.223, 86685 lines.
- 2016-11-09, Release v2.0-b2, 2.0 beta2, 2.0.221, 86691 lines.
- 2016-09-09, Release v2.0-b1, 2.0 beta1, 2.0.215, 89941 lines.
- 2016-08-06, Release v2.0-b0, 2.0 beta0, 2.0.210, 89704 lines.
- 2015-12-23, Release v2.0-a3, 2.0 alpha3, 2.0.205, 89544 lines.
- 2015-10-08, Release v2.0-a2, 2.0 alpha2, 2.0.195, 89358 lines.
- 2015-09-14, Release v2.0-a1, 2.0 alpha1, 2.0.189, 89269 lines.
- 2015-08-23, Release v2.0-a0, 2.0 alpha0, 2.0.185, 89022 lines.
- 2015-05-23, Release v1.0-r4, bug fixed, 1.0.32, 59509 lines.
- 2015-03-19, Release v1.0-r3, bug fixed, 1.0.30, 59511 lines.
- 2015-02-12, Release v1.0-r2, bug fixed, 1.0.27, 59507 lines.
- 2015-01-15, Release v1.0-r1, bug fixed, 1.0.21, 59472 lines.
- 2014-12-05, Release v1.0-r0, all bug fixed, 1.0.10, 59391 lines.
- 2014-10-09, Release v0.9.8, all bug fixed, 1.0.0, 59316 lines.
- 2014-08-03, Release v0.9.7, config utest, all bug fixed. 57432 lines.
- 2014-07-13, Release v0.9.6, core/kernel/rtmp utest, refine bandwidth(as/js/srslibrtmp library). 50029 lines.
- 2014-06-27, Release v0.9.5, refine perf 3k+ clients, edge token traverse, 30days online. 41573 lines.
- 2014-05-28, Release v0.9.4, support heartbeat, tracable log, fix mem leak and bugs. 39200 lines.
- 2014-05-18, Release v0.9.3, support mips, fms origin, json(http-api). 37594 lines.
- 2014-04-28, Release v0.9.2, support dvr, android, edge. 35255 lines.
- 2014-04-07, Release v0.9.1, support arm, init.d, http server/api, ingest. 30000 lines.
- 2013-12-25, Release v0.9.0, support bandwidth test, player/encoder/chat demos. 20926 lines.
- 2013-12-08, Release v0.8.0, support http hooks callback, update SB. 19186 lines.
- 2013-12-03, Release v0.7.0, support live stream transcoding. 17605 lines.
- 2013-11-29, Release v0.6.0, support forward stream to origin/edge. 16094 lines.
- 2013-11-26, Release v0.5.0, support HLS(m3u8), fragment and window. 14449 lines.
- 2013-11-10, Release v0.4.0, support reload config, pause, longtime publish/play. 12500 lines.
- 2013-11-04, Release v0.3.0, support vhost, refer, gop cache, listen multiple ports. 11773 lines.
- 2013-10-25, Release v0.2.0, support rtmp flash publish, h264, time jitter correct. 10125 lines.
- 2013-10-23, Release v0.1.0, support rtmp FMLE/FFMPEG publish, vp6. 8287 lines.
- 2013-10-17, Created.
Comparing with other media servers, SRS is much better and stronger, for details please read Product(CN/EN).
Please read PERFORMANCE.
The stream architecture of SRS.
+----------+ +----------+
| Upstream | | Deliver |
+---|------+ +----|-----+
+---+------------------+------+---------------------+----------------+
| Input | SRS(Simple RTMP Server) | Output |
+----------------------+----------------------------+----------------+
| | +-> DASH ----------------+-> DASH player |
| Encoder(1) | +-> RTMP/HDS -----------+-> Flash player |
| (FMLE,OBS, --RTMP-+->-+-> HLS/HTTP ------------+-> M3U8 player |
| FFmpeg,XSPLIT, | +-> FLV/MP3/Aac/Ts ------+-> HTTP player |
| ......) | +-> Fowarder ------------+-> RTMP server |
| | +-> Transcoder ----------+-> RTMP server |
| | +-> EXEC(5) -------------+-> External app |
| | +-> DVR -----------------+-> FLV file |
| | +-> BandwidthTest -------+-> Flash |
| | +-> WebRTC --------------+-> Flash |
+----------------------+ | |
| WebRTC Client | +--> RTMP | |
| (H5,Native...) --RTC-+---+---> WebRTC ------------+-> WebRTC Client|
+----------------------+ | |
| MediaSource(2) | | |
| (RTSP,FILE, | | |
| HTTP,HLS, --pull-+->-- Ingester(3) -(rtmp)----+-> SRS |
| Device, | | |
| ......) | | |
+----------------------+ | |
| MediaSource(2) | | |
| (MPEGTSoverUDP | | |
| HTTP-FLV, --push-+->- StreamCaster(4) -(rtmp)-+-> SRS |
| SRT, | | |
| ......) | | |
+----------------------+ | |
| FFMPEG --push(srt)--+->- SRTModule(5) ---(rtmp)-+-> SRS |
+----------------------+----------------------------+----------------+
Remark:
- Encoder: Encoder pushs RTMP stream to SRS.
- MediaSource: Supports any media source, ingesting by ffmpeg.
- Ingester: Forks a ffmpeg(or other tools) to ingest as rtmp to SRS, please read Ingest.
- Streamer: Remuxs other protocols to RTMP, please read Streamer.
- EXEC: Like NGINX-RTMP, EXEC forks external tools for events, please read [ng-exec][v4_CN_NgExec].
- SRTModule: A isolate module which run in hybrid model.
Gitee: https://gitee.com/ossrs/srs, the GIT usage(CN, EN)
git clone https://gitee.com/ossrs/srs.git &&
cd srs && git remote set-url origin https://github.com/ossrs/srs.git && git pull
Remark: For users in China, recomment to use mirror from CSDN or OSChina, because they are much faster.
Gitlab: https://gitlab.com/winlinvip/srs-gitlab, the GIT usage(CN, EN)
git clone https://gitlab.com/winlinvip/srs-gitlab.git srs &&
cd srs && git remote set-url origin https://github.com/ossrs/srs.git && git pull
Github: https://github.com/ossrs/srs, the GIT usage(CN, EN)
git clone https://github.com/ossrs/srs.git
Branch | Cost | Size | CMD |
---|---|---|---|
3.0release | 2m19.931s | 262MB | git clone -b 3.0release https://gitee.com/ossrs/srs.git |
3.0release | 0m56.515s | 95MB | git clone -b 3.0release --depth=1 https://gitee.com/ossrs/srs.git |
develop | 2m22.430s | 234MB | git clone -b develop https://gitee.com/ossrs/srs.git |
develop | 0m46.421s | 42MB | git clone -b develop --depth=1 https://gitee.com/ossrs/srs.git |
min | 2m22.865s | 217MB | git clone -b min https://gitee.com/ossrs/srs.git |
min | 0m36.472s | 11MB | git clone -b min --depth=1 https://gitee.com/ossrs/srs.git |
Supported operating systems and hardware:
- Linux, with x86, x86-64 or arm.
- Mac, with intel chip.
- Other OS, such as Windows, please use docker.
Beijing, 2013.10
Winlin