mirror of
https://github.com/ossrs/srs.git
synced 2025-02-12 11:21:52 +00:00
refine readme, confs
This commit is contained in:
parent
a0b747621e
commit
b52a051d80
12 changed files with 201 additions and 161 deletions
320
README.md
320
README.md
|
@ -69,166 +69,6 @@ cd simple-rtmp-server/trunk
|
||||||
[Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo)<br/>
|
[Usage: How to show the demo of SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo)<br/>
|
||||||
[Usage: Who is using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample)<br/>
|
[Usage: Who is using SRS?](https://github.com/winlinvip/simple-rtmp-server/wiki/Sample)<br/>
|
||||||
|
|
||||||
### Architecture
|
|
||||||
System Architecture:
|
|
||||||
<pre>
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| 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...) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
</pre>
|
|
||||||
Modularity Architecture:
|
|
||||||
<pre>
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| Main(srs/bandwidth/librtmp) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| App(Server/Client application) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| RTMP(Protocol stack) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| Kernel(depends on Core, provides error/log) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
| Core(depends only on system apis) |
|
|
||||||
+------------------------------------------------------+
|
|
||||||
</pre>
|
|
||||||
Stream Architecture:
|
|
||||||
<pre>
|
|
||||||
+---------+ +----------+
|
|
||||||
+ Publish + + Deliver |
|
|
||||||
+---|-----+ +----|-----+
|
|
||||||
+------------------+-------------------------+----------------+
|
|
||||||
| Input | SRS(Simple RTMP Server) | Output |
|
|
||||||
+------------------+-------------------------+----------------+
|
|
||||||
| Encoder(1) | +-> RTMP protocol ----+-> Flash Player |
|
|
||||||
| (FMLE,FFMPEG, --+->-+-> HLS/NGINX --------+-> m3u8 player |
|
|
||||||
| Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server |
|
|
||||||
| ......) | +-> Transcoder -------+-> RTMP Server |
|
|
||||||
| | +-> DVR --------------+-> FILE |
|
|
||||||
| | +-> BandwidthTest ----+-> Flash/StLoad |
|
|
||||||
+------------------+ | |
|
|
||||||
| MediaSource(2) | | |
|
|
||||||
| (RTSP,FILE, | | |
|
|
||||||
| HTTP,HLS, --+->-- Ingester -----------+-> SRS |
|
|
||||||
| Device, | | |
|
|
||||||
| ......) | | |
|
|
||||||
+------------------+-------------------------+----------------+
|
|
||||||
|
|
||||||
Remark:
|
|
||||||
(1) Encoder: encoder must push RTMP stream to SRS server.
|
|
||||||
(2) MediaSource: any media source, which can be ingest by ffmpeg.
|
|
||||||
</pre>
|
|
||||||
(plan) RTMP cluster(origin/edge) Architecture:<br/>
|
|
||||||
Remark: cluster over forward, see [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster)
|
|
||||||
<pre>
|
|
||||||
+---------+ +-----------------+ +-----------------------+
|
|
||||||
+ Encoder +--+-->-+ SRS(RTMP Edge) +--->-+ (RTMP Origin) |
|
|
||||||
+---------+ | +-----------------+ | SRS/FMS/NGINX-RTMP |
|
|
||||||
| | Red5/HELIX/CRTMP |
|
|
||||||
+-------------------------->-+ ...... |
|
|
||||||
+-----------------------+
|
|
||||||
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.
|
|
||||||
</pre>
|
|
||||||
(plan) SRS Multiple processes Architecture(design by wenjie):<br/>
|
|
||||||
<pre>
|
|
||||||
+---------------+ +--------+
|
|
||||||
| upnode server | + client +
|
|
||||||
+-------+-------+ +---+----+
|
|
||||||
-------------+------------network-------+---------
|
|
||||||
| |
|
|
||||||
+--------+ +----+-----------+ +----+----------+
|
|
||||||
| master +--fork->-+ back source(1) +-->-pull-+ stream 1-N(2) +
|
|
||||||
+---+----+ +----------------+ +-------+-------+
|
|
||||||
| |
|
|
||||||
+-------------------------------------fork--->-----+
|
|
||||||
| +-------------+
|
|
||||||
+-------------------fork-->-+ http/vod(3) |
|
|
||||||
+-------------+
|
|
||||||
Remark:
|
|
||||||
(1) back source process: create by master process, get stream from
|
|
||||||
upnode server if edge, create stream if origin, serve the stream
|
|
||||||
process.
|
|
||||||
(2) stream process: create by master process, get stream from back
|
|
||||||
source process, serve the client.
|
|
||||||
(3) the embeded mininum http server, also provides vod service. for
|
|
||||||
http server, it provides http api, hls(live/vod) delivery. for
|
|
||||||
vod server, it slice the file to hls(m3u8/ts).
|
|
||||||
Remark:
|
|
||||||
(a) This multiple processes architecture is design by wenjie, it's a
|
|
||||||
very simple and powerful multiple process architecture, for the
|
|
||||||
master no need to pass between stream process.
|
|
||||||
(b) The CLI architecture is similar to this, instead, cli process
|
|
||||||
will collect informations from all stream process, master process
|
|
||||||
only send signals to child processes.
|
|
||||||
</pre>
|
|
||||||
CLI Architecture:
|
|
||||||
<pre>
|
|
||||||
+---------+
|
|
||||||
+--+ stream1 +---------+
|
|
||||||
| +---------+ |
|
|
||||||
+--------+ | +---------+ | +-------+
|
|
||||||
| master +--fork->-+--+ streamN +---amf0--+>--+ cli +
|
|
||||||
+--------+ | +---------+ | +-------+
|
|
||||||
| +-------------+ |
|
|
||||||
+--+ back source +-----+
|
|
||||||
+-------------+
|
|
||||||
Remark:
|
|
||||||
(1) master listen the global api port, for example, 33330
|
|
||||||
(2) back source and stream processes listen at private api port,
|
|
||||||
for example, 33331, 33332, 33333
|
|
||||||
(3) work processes(stream and back-source), report private api
|
|
||||||
port to master global api port.
|
|
||||||
(4) cli connect to master global api port, get all other private
|
|
||||||
api ports
|
|
||||||
(5) cli connect to each stream/back-source process to get api data,
|
|
||||||
cli analysis and summary the data, return to user.
|
|
||||||
</pre>
|
|
||||||
Bandwidth Test Workflow:
|
|
||||||
<pre>
|
|
||||||
+------------+ +----------+
|
|
||||||
| 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)-----------------> |
|
|
||||||
| <END> |
|
|
||||||
|
|
||||||
@See: class SrsBandwidth comments.
|
|
||||||
</pre>
|
|
||||||
|
|
||||||
### System Requirements
|
### System Requirements
|
||||||
Supported operating systems and hardware:
|
Supported operating systems and hardware:
|
||||||
* All Linux , both 32 and 64 bits
|
* All Linux , both 32 and 64 bits
|
||||||
|
@ -424,6 +264,166 @@ on_connect/close/publish/unpublish/play/stop.
|
||||||
* v0.1, 2013-10-18, support rtmp message2chunk protocol(send\_message).
|
* v0.1, 2013-10-18, support rtmp message2chunk protocol(send\_message).
|
||||||
* v0.1, 2013-10-17, support rtmp chunk2message protocol(recv\_message).
|
* v0.1, 2013-10-17, support rtmp chunk2message protocol(recv\_message).
|
||||||
|
|
||||||
|
### Architecture
|
||||||
|
System Architecture:
|
||||||
|
<pre>
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| 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...) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
</pre>
|
||||||
|
Modularity Architecture:
|
||||||
|
<pre>
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| Main(srs/bandwidth/librtmp) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| App(Server/Client application) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| RTMP(Protocol stack) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| Kernel(depends on Core, provides error/log) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
| Core(depends only on system apis) |
|
||||||
|
+------------------------------------------------------+
|
||||||
|
</pre>
|
||||||
|
Stream Architecture:
|
||||||
|
<pre>
|
||||||
|
+---------+ +----------+
|
||||||
|
+ Publish + + Deliver |
|
||||||
|
+---|-----+ +----|-----+
|
||||||
|
+------------------+-------------------------+----------------+
|
||||||
|
| Input | SRS(Simple RTMP Server) | Output |
|
||||||
|
+------------------+-------------------------+----------------+
|
||||||
|
| Encoder(1) | +-> RTMP protocol ----+-> Flash Player |
|
||||||
|
| (FMLE,FFMPEG, --+->-+-> HLS/NGINX --------+-> m3u8 player |
|
||||||
|
| Flash,XSPLIT, | +-> Fowarder ---------+-> RTMP Server |
|
||||||
|
| ......) | +-> Transcoder -------+-> RTMP Server |
|
||||||
|
| | +-> DVR --------------+-> FILE |
|
||||||
|
| | +-> BandwidthTest ----+-> Flash/StLoad |
|
||||||
|
+------------------+ | |
|
||||||
|
| MediaSource(2) | | |
|
||||||
|
| (RTSP,FILE, | | |
|
||||||
|
| HTTP,HLS, --+->-- Ingester -----------+-> SRS |
|
||||||
|
| Device, | | |
|
||||||
|
| ......) | | |
|
||||||
|
+------------------+-------------------------+----------------+
|
||||||
|
|
||||||
|
Remark:
|
||||||
|
(1) Encoder: encoder must push RTMP stream to SRS server.
|
||||||
|
(2) MediaSource: any media source, which can be ingest by ffmpeg.
|
||||||
|
</pre>
|
||||||
|
(plan) RTMP cluster(origin/edge) Architecture:<br/>
|
||||||
|
Remark: cluster over forward, see [Cluster](https://github.com/winlinvip/simple-rtmp-server/wiki/Cluster)
|
||||||
|
<pre>
|
||||||
|
+---------+ +-----------------+ +-----------------------+
|
||||||
|
+ Encoder +--+-->-+ SRS(RTMP Edge) +--->-+ (RTMP Origin) |
|
||||||
|
+---------+ | +-----------------+ | SRS/FMS/NGINX-RTMP |
|
||||||
|
| | Red5/HELIX/CRTMP |
|
||||||
|
+-------------------------->-+ ...... |
|
||||||
|
+-----------------------+
|
||||||
|
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.
|
||||||
|
</pre>
|
||||||
|
(plan) SRS Multiple processes Architecture(design by wenjie):<br/>
|
||||||
|
<pre>
|
||||||
|
+---------------+ +--------+
|
||||||
|
| upnode server | + client +
|
||||||
|
+-------+-------+ +---+----+
|
||||||
|
-------------+------------network-------+---------
|
||||||
|
| |
|
||||||
|
+--------+ +----+-----------+ +----+----------+
|
||||||
|
| master +--fork->-+ back source(1) +-->-pull-+ stream 1-N(2) +
|
||||||
|
+---+----+ +----------------+ +-------+-------+
|
||||||
|
| |
|
||||||
|
+-------------------------------------fork--->-----+
|
||||||
|
| +-------------+
|
||||||
|
+-------------------fork-->-+ http/vod(3) |
|
||||||
|
+-------------+
|
||||||
|
Remark:
|
||||||
|
(1) back source process: create by master process, get stream from
|
||||||
|
upnode server if edge, create stream if origin, serve the stream
|
||||||
|
process.
|
||||||
|
(2) stream process: create by master process, get stream from back
|
||||||
|
source process, serve the client.
|
||||||
|
(3) the embeded mininum http server, also provides vod service. for
|
||||||
|
http server, it provides http api, hls(live/vod) delivery. for
|
||||||
|
vod server, it slice the file to hls(m3u8/ts).
|
||||||
|
Remark:
|
||||||
|
(a) This multiple processes architecture is design by wenjie, it's a
|
||||||
|
very simple and powerful multiple process architecture, for the
|
||||||
|
master no need to pass between stream process.
|
||||||
|
(b) The CLI architecture is similar to this, instead, cli process
|
||||||
|
will collect informations from all stream process, master process
|
||||||
|
only send signals to child processes.
|
||||||
|
</pre>
|
||||||
|
CLI Architecture:
|
||||||
|
<pre>
|
||||||
|
+---------+
|
||||||
|
+--+ stream1 +---------+
|
||||||
|
| +---------+ |
|
||||||
|
+--------+ | +---------+ | +-------+
|
||||||
|
| master +--fork->-+--+ streamN +---amf0--+>--+ cli +
|
||||||
|
+--------+ | +---------+ | +-------+
|
||||||
|
| +-------------+ |
|
||||||
|
+--+ back source +-----+
|
||||||
|
+-------------+
|
||||||
|
Remark:
|
||||||
|
(1) master listen the global api port, for example, 33330
|
||||||
|
(2) back source and stream processes listen at private api port,
|
||||||
|
for example, 33331, 33332, 33333
|
||||||
|
(3) work processes(stream and back-source), report private api
|
||||||
|
port to master global api port.
|
||||||
|
(4) cli connect to master global api port, get all other private
|
||||||
|
api ports
|
||||||
|
(5) cli connect to each stream/back-source process to get api data,
|
||||||
|
cli analysis and summary the data, return to user.
|
||||||
|
</pre>
|
||||||
|
Bandwidth Test Workflow:
|
||||||
|
<pre>
|
||||||
|
+------------+ +----------+
|
||||||
|
| 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)-----------------> |
|
||||||
|
| <END> |
|
||||||
|
|
||||||
|
@See: class SrsBandwidth comments.
|
||||||
|
</pre>
|
||||||
|
|
||||||
Beijing, 2013<br/>
|
Beijing, 2013<br/>
|
||||||
Winlin
|
Winlin
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs demo
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 19350;
|
listen 19350;
|
||||||
chunk_size 65000;
|
chunk_size 65000;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs demo
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleDemo
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
chunk_size 60000;
|
chunk_size 60000;
|
||||||
log_dir ./objs/logs;
|
log_dir ./objs/logs;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs use ffmpeg to transcode
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleFFMPEG
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
transcode {
|
transcode {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to forward
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleForward
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
forward 127.0.0.1:19350;
|
forward 127.0.0.1:19350;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to forward
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleForward
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 19350;
|
listen 19350;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
# all config for srs
|
||||||
|
|
||||||
# the listen ports, split by space.
|
# the listen ports, split by space.
|
||||||
listen 1935;
|
listen 1935;
|
||||||
# the default chunk size is 128, max is 65536,
|
# the default chunk size is 128, max is 65536,
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to delivery hls
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleHLS
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
hls {
|
hls {
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to delivery realtime RTMP stream
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRealtime
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
gop_cache off;
|
gop_cache off;
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to delivery RTMP
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleRTMP
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
|
# main config for srs.
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
# see full.conf for each config.
|
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,7 @@
|
||||||
|
# the config for srs to delivery hls
|
||||||
|
# @see https://github.com/winlinvip/simple-rtmp-server/wiki/SampleHLS
|
||||||
|
# @see full.conf for detail config.
|
||||||
|
|
||||||
listen 1935;
|
listen 1935;
|
||||||
vhost __defaultVhost__ {
|
vhost __defaultVhost__ {
|
||||||
hls {
|
hls {
|
||||||
|
|
Loading…
Reference in a new issue