Skip to content
forked from ossrs/srs

SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT/GB28181.

License

Notifications You must be signed in to change notification settings

eriklee1895/srs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRS(Simple Realtime Server)

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.

Usage

Build SRS from source, please read Wiki: Gettting Started( EN / CN ):

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 by FFmpeg or OBS as:

ffmpeg -re -i ./doc/source.flv -c copy -f flv -y rtmp://localhost/live/livestream

Note: It's also able to publish by H5 if WebRTC is enabled.

Play the following streams by players:

From here, please read wikis:

  • Getting Started, please read Wiki first.
  • 中文文档:起步,不读Wiki一定扑街,不读文档请不要提Issue,不读文档请不要提问题,任何文档中明确说过的疑问都不会解答。

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)

AUTHORS

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:

A big THANK YOU goes to:

Ports

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:

For external services to work with SRS:

APIs

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.

Features

  • 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.

Changelog

Please read CHANGELOG.

Releases

Compare

Comparing with other media servers, SRS is much better and stronger, for details please read Product(CN/EN).

Performance

Please read PERFORMANCE.

Architecture

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:

  1. Encoder: Encoder pushs RTMP stream to SRS.
  2. MediaSource: Supports any media source, ingesting by ffmpeg.
  3. Ingester: Forks a ffmpeg(or other tools) to ingest as rtmp to SRS, please read Ingest.
  4. Streamer: Remuxs other protocols to RTMP, please read Streamer.
  5. EXEC: Like NGINX-RTMP, EXEC forks external tools for events, please read [ng-exec][v4_CN_NgExec].
  6. SRTModule: A isolate module which run in hybrid model.

Mirrors

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

System Requirements

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

About

SRS is a simple, high efficiency and realtime video server, supports RTMP/WebRTC/HLS/HTTP-FLV/SRT/GB28181.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 79.3%
  • JavaScript 6.2%
  • HTML 6.1%
  • ActionScript 5.2%
  • Shell 2.4%
  • Python 0.8%