Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2014-03-18 15:13:25 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
b36338853ae7d7a5fb6b22fd52d887d6eeeba043
b3633885
1 parent
d67edf63
refine the conf files, rename srs.conf to demo.conf
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
813 行增加
和
856 行删除
README.md
trunk/conf/srs.19350.conf → trunk/conf/demo.19350.conf
trunk/conf/demo.conf
trunk/conf/full.conf
trunk/conf/srs.conf
trunk/scripts/_step.start.srs.19350.sh
trunk/scripts/_step.start.srs.sh
trunk/scripts/stop.sh
README.md
查看文件 @
b363388
...
...
@@ -52,7 +52,7 @@ cd simple-rtmp-server/trunk
<strong>
Step 2:
</strong>
build SRS,
<strong>
Requires Centos6.x/Ubuntu12 32/64bits, others see
[
Build
](
https://github.com/winlinvip/simple-rtmp-server/wiki/Build
)
</strong><br/>
<pre>
./configure --with-ssl --without-hls --without-ffmpeg --without-http && make
./configure --with-ssl --without-hls --without-ffmpeg --without-http
-callback
&& make
</pre>
<strong>
Step 3:
</strong>
start SRS
<br/>
<pre>
...
...
trunk/conf/
srs
.19350.conf → trunk/conf/
demo
.19350.conf
查看文件 @
b363388
trunk/conf/demo.conf
0 → 100644
查看文件 @
b363388
listen
1935
;
chunk_size
60000
;
log_dir
./
objs
/
logs
;
max_connections
2000
;
vhost
__
defaultVhost__
{
enabled
on
;
gop_cache
on
;
}
vhost
bandcheck
.
srs
.
com
{
enabled
on
;
chunk_size
65000
;
bandcheck
{
enabled
on
;
key
"35c9b402c12a7246868752e2878f7e0e"
;
interval
30
;
limit_kbps
4000
;
}
}
vhost
demo
.
srs
.
com
{
chunk_size
60000
;
enabled
on
;
gop_cache
on
;
queue_length
30
;
forward
127
.
0
.
0
.
1
:
19350
;
bandcheck
{
enabled
off
;
}
hls
{
enabled
on
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
5
;
hls_window
30
;
}
http_hooks
{
enabled
on
;
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
}
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
ld
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontsize=30:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
sd
{
enabled
on
;
vfilter
{
vf
'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'
;
}
vcodec
libx264
;
vbitrate
500
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
main
;
vpreset
fast
;
vparams
{
}
acodec
libaacplus
;
abitrate
40
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
vhost
players
{
enabled
on
;
gop_cache
on
;
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
hls
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SRS(SimpleRtmpServer):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
g
100
;
}
acodec
libaacplus
;
abitrate
30
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=
players_pub
/[
stream
];
}
}
}
vhost
players_pub
{
hls
{
enabled
on
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
5
;
hls_window
30
;
}
}
vhost
players_pub_rtmp
{
gop_cache
off
;
hls
{
enabled
off
;
}
}
...
...
trunk/conf/full.conf
0 → 100644
查看文件 @
b363388
# the listen ports, split by space.
listen
1935
;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve
# performance about 10%.
# default: 60000
chunk_size
60000
;
# the logs dir.
# if enabled ffmpeg, each stracoding stream will create a log file.
# default: ./objs/logs
log_dir
./
objs
/
logs
;
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 2000
max_connections
2000
;
# vhost list, the __defaultVhost__ is the default vhost
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
# for which cannot identify the required vhost.
vhost
__
defaultVhost__
{
enabled
on
;
gop_cache
on
;
}
# vhost for bandwidth check
# generally, the bandcheck vhost must be: bandcheck.srs.com,
# or need to modify the vhost of client.
vhost
bandcheck
.
srs
.
com
{
enabled
on
;
chunk_size
65000
;
# bandwidth check config.
bandcheck
{
# whether support bandwidth check,
# default: off.
enabled
on
;
# the key for server to valid,
# if invalid key, server disconnect and abort the bandwidth check.
key
"35c9b402c12a7246868752e2878f7e0e"
;
# the interval in seconds for bandwidth check,
# server donot allow new test request.
# default: 30
interval
30
;
# the max available check bandwidth in kbps.
# to avoid attack of bandwidth check.
# default: 1000
limit_kbps
4000
;
}
}
# set the chunk size of vhost.
vhost
chunksize
.
vhost
.
com
{
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# vhost chunk size will override the global value.
# default: global chunk size.
chunk_size
128
;
}
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost
hooks
.
callback
.
vhost
.
com
{
http_hooks
{
# whether the http hooks enalbe.
# default off.
enabled
on
;
# when client connect to vhost/app, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_connect",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "pageUrl": "http://www.test.com/live.html"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
# when client close/disconnect to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_close",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
# when client(encoder) publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_publish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
# when client(encoder) stop publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_unpublish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
# when client start to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_play",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
# when client stop to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_stop",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
}
}
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
vhost
mirror
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
mirror
{
enabled
on
;
vfilter
{
vf
'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
vhost
drawtext
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
drawtext
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
vhost
crop
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
crop
{
enabled
on
;
vfilter
{
vf
'crop=in_w-20:in_h-160:10:80'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
vhost
logo
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
logo
{
enabled
on
;
vfilter
{
i
./
doc
/
ffmpeg
-
logo
.
png
;
filter_complex
'overlay=10:10'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# audio transcode only.
# for example, FMLE publish audio codec in mp3, and donot support HLS output,
# we can transcode the audio to aac and copy video to the new stream with HLS.
vhost
audio
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
acodec
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# ffmpeg-copy(forward implements by ffmpeg).
# copy the video and audio to a new stream.
vhost
copy
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
copy
{
enabled
on
;
vcodec
copy
;
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all app and stream of vhost
vhost
all
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
transcode
{
# whether the transcode enabled.
# if off, donot transcode.
# default: off.
enabled
on
;
# the ffmpeg
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
# the transcode engine for matched stream.
# all matched stream will transcoded to the following stream.
# the transcode set name(ie. hd) is optional and not used.
engine
ffsuper
{
# whether the engine is enabled
# default: off.
enabled
on
;
# ffmpeg filters, follows the main input.
vfilter
{
# the logo input file.
i
./
doc
/
ffmpeg
-
logo
.
png
;
# the ffmpeg complex filter.
# for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
filter_complex
'overlay=10:10'
;
}
# video encoder name. can be:
# libx264: use h.264(libx264) video encoder.
# copy: donot encoder the video stream, copy it.
vcodec
libx264
;
# video bitrate, in kbps
vbitrate
1500
;
# video framerate.
vfps
25
;
# video width, must be even numbers.
vwidth
768
;
# video height, must be even numbers.
vheight
320
;
# the max threads for ffmpeg to used.
vthreads
12
;
# x264 profile, @see x264 -help, can be:
# high,main,baseline
vprofile
main
;
# x264 preset, @see x264 -help, can be:
# ultrafast,superfast,veryfast,faster,fast
# medium,slow,slower,veryslow,placebo
vpreset
medium
;
# other x264 or ffmpeg video params
vparams
{
# ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
t
100
;
# 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
coder
1
;
b_strategy
2
;
bf
3
;
refs
10
;
}
# audio encoder name. can be:
# libaacplus: use aac(libaacplus) audio encoder.
# copy: donot encoder the audio stream, copy it.
acodec
libaacplus
;
# audio bitrate, in kbps. [16, 72] for libaacplus.
abitrate
70
;
# audio sample rate. for flv/rtmp, it must be:
# 44100,22050,11025,5512
asample_rate
44100
;
# audio channel, 1 for mono, 2 for stereo.
achannels
2
;
# other ffmpeg audio params
aparams
{
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
profile
:
a
aac_low
;
}
# output stream. variables:
# [vhost] the input stream vhost.
# [port] the intput stream port.
# [app] the input stream app.
# [stream] the input stream name.
# [engine] the tanscode engine name.
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
ffhd
{
enabled
on
;
vcodec
libx264
;
vbitrate
1200
;
vfps
25
;
vwidth
1382
;
vheight
576
;
vthreads
6
;
vprofile
main
;
vpreset
medium
;
vparams
{
}
acodec
libaacplus
;
abitrate
70
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
ffsd
{
enabled
on
;
vcodec
libx264
;
vbitrate
800
;
vfps
25
;
vwidth
1152
;
vheight
480
;
vthreads
4
;
vprofile
main
;
vpreset
fast
;
vparams
{
}
acodec
libaacplus
;
abitrate
60
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
fffast
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
vcopy
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
acopy
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
copy
{
enabled
on
;
vcodec
copy
;
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all stream using the empty ffmpeg demo, donothing.
vhost
ffempty
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
research
/
ffempty
;
engine
empty
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all app and stream of app
vhost
app
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
# if app specified, transcode all streams of app.
transcode
live
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
}
}
}
# transcode specified stream.
vhost
stream
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
# if stream specified, transcode the matched stream.
transcode
live
/
livestream
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
}
}
}
# the vhost which forward publish streams.
vhost
same
.
vhost
.
forward
.
vhost
.
com
{
# forward all publish stream to the specified server.
# this used to split/forward the current stream for cluster active-standby,
# active-active for cdn to build high available fault tolerance system.
# format: {ip}:{port} {ip_N}:{port_N}
# or specify the vhost by params, @see: change.vhost.forward.vhost.com
# if vhost not specified, use the request vhost instead.
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
}
# TODO: FIXME: change the forward schema with vhost.
# [plan] the vhost which forward publish streams to other vhosts.
vhost
change
.
vhost
.
forward
.
vhost
.
com
{
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
{
# specify the vhost to override the vhost in client request.
vhost
forward2
.
vhost
.
com
;
# specify the refer(pageUrl) to override the refer in client request.
refer
http
://
srs
/
index
.
html
;
}
forward
127
.
0
.
0
.
1
:
1938
{
vhost
forward3
.
vhost
.
com
;
}
}
# the vhost disabled.
vhost
removed
.
vhost
.
com
{
# whether the vhost is enabled.
# if off, all request access denied.
# default: on
enabled
off
;
}
# the vhost with hls specified.
vhost
with
-
hls
.
vhost
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled
on
;
# the hls output path.
# the app dir is auto created under the hls_path.
# for example, for rtmp stream:
# rtmp://127.0.0.1/live/livestream
# http://127.0.0.1/live/livestream.m3u8
# where hls_path is /hls, srs will create the following files:
# /hls/live the app dir for all streams.
# /hls/live/livestream.m3u8 the HLS m3u8 file.
# /hls/live/livestream-1.ts the HLS media/ts file.
# in a word, the hls_path is for vhost.
# default: ./objs/nginx/html
hls_path
/
data
/
nginx
/
html
;
# the hls fragment in seconds, the duration of a piece of ts.
# default: 10
hls_fragment
10
;
# the hls window in seconds, the number of ts in m3u8.
# default: 60
hls_window
60
;
}
}
# the vhost with hls disabled.
vhost
no
-
hls
.
vhost
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled
off
;
}
}
# the vhost for min delay, donot cache any stream.
vhost
min
.
delay
.
com
{
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
# to enable fast startup for client, client play immediately.
# if off, send the latest media data to client,
# client need to wait for the next Iframe to decode and show the video.
# set to off if requires min delay;
# set to on if requires client fast startup.
# default: on
gop_cache
off
;
# the max live queue length in seconds.
# if the messages in the queue exceed the max length,
# drop the old whole gop.
# default: 30
queue_length
10
;
}
# the vhost for antisuck.
vhost
refer
.
anti_suck
.
com
{
# the common refer for play and publish.
# if the page url of client not in the refer, access denied.
# if not specified this field, allow all.
# default: not specified.
refer
github
.
com
github
.
io
;
# refer for publish clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_publish
github
.
com
github
.
io
;
# refer for play clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_play
github
.
com
github
.
io
;
}
# config for the pithy print,
# which always print constant message specified by interval,
# whatever the clients in concurrency.
pithy_print
{
# shared print interval for all publish clients, in milliseconds.
# if not specified, set to 1100.
publish
2000
;
# shared print interval for all play clients, in milliseconds.
# if not specified, set to 1300.
play
3000
;
# shared print interval for all forwarders, in milliseconds.
# if not specified, set to 2000.
forwarder
3000
;
# shared print interval for all encoders, in milliseconds.
# if not specified, set to 2000.
encoder
3000
;
# shared print interval for all hls, in milliseconds.
# if not specified, set to 2000.
hls
3000
;
}
...
...
trunk/conf/srs.conf
查看文件 @
b363388
# the listen ports, split by space.
listen
1935
;
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve
# performance about 10%.
# default: 60000
chunk_size
60000
;
# the logs dir.
# if enabled ffmpeg, each stracoding stream will create a log file.
# default: ./objs/logs
log_dir
./
objs
/
logs
;
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 2000
max_connections
2000
;
# vhost list, the __defaultVhost__ is the default vhost
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
# for which cannot identify the required vhost.
vhost
__
defaultVhost__
{
enabled
on
;
gop_cache
on
;
}
# vhost for bandwidth check
# generally, the bandcheck vhost must be: bandcheck.srs.com,
# or need to modify the vhost of client.
vhost
bandcheck
.
srs
.
com
{
enabled
on
;
chunk_size
65000
;
# bandwidth check config.
bandcheck
{
# whether support bandwidth check,
# default: off.
enabled
on
;
# the key for server to valid,
# if invalid key, server disconnect and abort the bandwidth check.
key
"35c9b402c12a7246868752e2878f7e0e"
;
# the interval in seconds for bandwidth check,
# server donot allow new test request.
# default: 30
interval
30
;
# the max available check bandwidth in kbps.
# to avoid attack of bandwidth check.
# default: 1000
limit_kbps
4000
;
}
}
# set the chunk size of vhost.
vhost
chunksize
.
vhost
.
com
{
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# vhost chunk size will override the global value.
# default: global chunk size.
chunk_size
128
;
}
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost
hooks
.
callback
.
vhost
.
com
{
http_hooks
{
# whether the http hooks enalbe.
# default off.
enabled
on
;
# when client connect to vhost/app, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_connect",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "pageUrl": "http://www.test.com/live.html"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
# when client close/disconnect to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_close",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
http
://
localhost
:
8085
/
api
/
v1
/
clients
;
# when client(encoder) publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_publish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
# when client(encoder) stop publish to vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_unpublish",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
http
://
localhost
:
8085
/
api
/
v1
/
streams
;
# when client start to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_play",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
# when client stop to play vhost/app/stream, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_stop",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream"
# }
# if valid, the hook must return HTTP code 200(Stauts OK) and response
# an int value specifies the error code(0 corresponding to success):
# 0
# support multiple api hooks, format:
# on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
http
://
localhost
:
8085
/
api
/
v1
/
sessions
;
}
}
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
vhost
mirror
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
mirror
{
enabled
on
;
vfilter
{
vf
'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
vhost
drawtext
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
drawtext
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
vhost
crop
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
crop
{
enabled
on
;
vfilter
{
vf
'crop=in_w-20:in_h-160:10:80'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
vhost
logo
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
logo
{
enabled
on
;
vfilter
{
i
./
doc
/
ffmpeg
-
logo
.
png
;
filter_complex
'overlay=10:10'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# audio transcode only.
# for example, FMLE publish audio codec in mp3, and donot support HLS output,
# we can transcode the audio to aac and copy video to the new stream with HLS.
vhost
audio
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
acodec
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# ffmpeg-copy(forward implements by ffmpeg).
# copy the video and audio to a new stream.
vhost
copy
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
copy
{
enabled
on
;
vcodec
copy
;
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all app and stream of vhost
vhost
all
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
transcode
{
# whether the transcode enabled.
# if off, donot transcode.
# default: off.
enabled
on
;
# the ffmpeg
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
# the transcode engine for matched stream.
# all matched stream will transcoded to the following stream.
# the transcode set name(ie. hd) is optional and not used.
engine
ffsuper
{
# whether the engine is enabled
# default: off.
enabled
on
;
# ffmpeg filters, follows the main input.
vfilter
{
# the logo input file.
i
./
doc
/
ffmpeg
-
logo
.
png
;
# the ffmpeg complex filter.
# for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
filter_complex
'overlay=10:10'
;
}
# video encoder name. can be:
# libx264: use h.264(libx264) video encoder.
# copy: donot encoder the video stream, copy it.
vcodec
libx264
;
# video bitrate, in kbps
vbitrate
1500
;
# video framerate.
vfps
25
;
# video width, must be even numbers.
vwidth
768
;
# video height, must be even numbers.
vheight
320
;
# the max threads for ffmpeg to used.
vthreads
12
;
# x264 profile, @see x264 -help, can be:
# high,main,baseline
vprofile
main
;
# x264 preset, @see x264 -help, can be:
# ultrafast,superfast,veryfast,faster,fast
# medium,slow,slower,veryslow,placebo
vpreset
medium
;
# other x264 or ffmpeg video params
vparams
{
# ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
t
100
;
# 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
coder
1
;
b_strategy
2
;
bf
3
;
refs
10
;
}
# audio encoder name. can be:
# libaacplus: use aac(libaacplus) audio encoder.
# copy: donot encoder the audio stream, copy it.
acodec
libaacplus
;
# audio bitrate, in kbps. [16, 72] for libaacplus.
abitrate
70
;
# audio sample rate. for flv/rtmp, it must be:
# 44100,22050,11025,5512
asample_rate
44100
;
# audio channel, 1 for mono, 2 for stereo.
achannels
2
;
# other ffmpeg audio params
aparams
{
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
profile
:
a
aac_low
;
}
# output stream. variables:
# [vhost] the input stream vhost.
# [port] the intput stream port.
# [app] the input stream app.
# [stream] the input stream name.
# [engine] the tanscode engine name.
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
ffhd
{
enabled
on
;
vcodec
libx264
;
vbitrate
1200
;
vfps
25
;
vwidth
1382
;
vheight
576
;
vthreads
6
;
vprofile
main
;
vpreset
medium
;
vparams
{
}
acodec
libaacplus
;
abitrate
70
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
ffsd
{
enabled
on
;
vcodec
libx264
;
vbitrate
800
;
vfps
25
;
vwidth
1152
;
vheight
480
;
vthreads
4
;
vprofile
main
;
vpreset
fast
;
vparams
{
}
acodec
libaacplus
;
abitrate
60
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
fffast
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
vcopy
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
acopy
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
copy
{
enabled
on
;
vcodec
copy
;
acodec
copy
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all stream using the empty ffmpeg demo, donothing.
vhost
ffempty
.
transcode
.
vhost
.
com
{
transcode
{
enabled
on
;
ffmpeg
./
objs
/
research
/
ffempty
;
engine
empty
{
enabled
on
;
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
2
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# transcode all app and stream of app
vhost
app
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
# if app specified, transcode all streams of app.
transcode
live
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
}
}
}
# transcode specified stream.
vhost
stream
.
transcode
.
vhost
.
com
{
# the streaming transcode configs.
# if stream specified, transcode the matched stream.
transcode
live
/
livestream
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
}
}
}
# the vhost which forward publish streams.
vhost
same
.
vhost
.
forward
.
vhost
.
com
{
# forward all publish stream to the specified server.
# this used to split/forward the current stream for cluster active-standby,
# active-active for cdn to build high available fault tolerance system.
# format: {ip}:{port} {ip_N}:{port_N}
# or specify the vhost by params, @see: change.vhost.forward.vhost.com
# if vhost not specified, use the request vhost instead.
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
}
# TODO: FIXME: change the forward schema with vhost.
# [plan] the vhost which forward publish streams to other vhosts.
vhost
change
.
vhost
.
forward
.
vhost
.
com
{
forward
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
{
# specify the vhost to override the vhost in client request.
vhost
forward2
.
vhost
.
com
;
# specify the refer(pageUrl) to override the refer in client request.
refer
http
://
srs
/
index
.
html
;
}
forward
127
.
0
.
0
.
1
:
1938
{
vhost
forward3
.
vhost
.
com
;
}
}
# the vhost disabled.
vhost
removed
.
vhost
.
com
{
# whether the vhost is enabled.
# if off, all request access denied.
# default: on
enabled
off
;
}
# the vhost with hls specified.
vhost
with
-
hls
.
vhost
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled
on
;
# the hls output path.
# the app dir is auto created under the hls_path.
# for example, for rtmp stream:
# rtmp://127.0.0.1/live/livestream
# http://127.0.0.1/live/livestream.m3u8
# where hls_path is /hls, srs will create the following files:
# /hls/live the app dir for all streams.
# /hls/live/livestream.m3u8 the HLS m3u8 file.
# /hls/live/livestream-1.ts the HLS media/ts file.
# in a word, the hls_path is for vhost.
# default: ./objs/nginx/html
hls_path
/
data
/
nginx
/
html
;
# the hls fragment in seconds, the duration of a piece of ts.
# default: 10
hls_fragment
10
;
# the hls window in seconds, the number of ts in m3u8.
# default: 60
hls_window
60
;
}
}
# the vhost with hls disabled.
vhost
no
-
hls
.
vhost
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled
off
;
}
}
# the vhost for min delay, donot cache any stream.
vhost
min
.
delay
.
com
{
# whether cache the last gop.
# if on, cache the last gop and dispatch to client,
# to enable fast startup for client, client play immediately.
# if off, send the latest media data to client,
# client need to wait for the next Iframe to decode and show the video.
# set to off if requires min delay;
# set to on if requires client fast startup.
# default: on
gop_cache
off
;
# the max live queue length in seconds.
# if the messages in the queue exceed the max length,
# drop the old whole gop.
# default: 30
queue_length
10
;
}
# the vhost for antisuck.
vhost
refer
.
anti_suck
.
com
{
# the common refer for play and publish.
# if the page url of client not in the refer, access denied.
# if not specified this field, allow all.
# default: not specified.
refer
github
.
com
github
.
io
;
# refer for publish clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_publish
github
.
com
github
.
io
;
# refer for play clients specified.
# the common refer is not overrided by this.
# if not specified this field, allow all.
# default: not specified.
refer_play
github
.
com
github
.
io
;
}
# config for the pithy print,
# which always print constant message specified by interval,
# whatever the clients in concurrency.
pithy_print
{
# shared print interval for all publish clients, in milliseconds.
# if not specified, set to 1100.
publish
2000
;
# shared print interval for all play clients, in milliseconds.
# if not specified, set to 1300.
play
3000
;
# shared print interval for all forwarders, in milliseconds.
# if not specified, set to 2000.
forwarder
3000
;
# shared print interval for all encoders, in milliseconds.
# if not specified, set to 2000.
encoder
3000
;
# shared print interval for all hls, in milliseconds.
# if not specified, set to 2000.
hls
3000
;
}
# vhost list, the __defaultVhost__ is the default vhost
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
# for which cannot identify the required vhost.
# for default demo.
vhost
demo
.
srs
.
com
{
chunk_size
60000
;
enabled
on
;
gop_cache
on
;
queue_length
30
;
forward
127
.
0
.
0
.
1
:
19350
;
bandcheck
{
enabled
off
;
}
hls
{
enabled
on
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
5
;
hls_window
30
;
}
http_hooks
{
enabled
on
;
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
}
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
ld
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontsize=30:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
sd
{
enabled
on
;
vfilter
{
vf
'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'
;
}
vcodec
libx264
;
vbitrate
500
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
main
;
vpreset
fast
;
vparams
{
}
acodec
libaacplus
;
abitrate
40
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
# for the players site, to play or publish.
# the flash player publisher need to transcode to support hls,
# we add players_hls vhost to support it.
vhost
players
{
enabled
on
;
gop_cache
on
;
transcode
{
enabled
on
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
hls
{
enabled
on
;
vfilter
{
vf
'drawtext=text=SRS(SimpleRtmpServer):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf'
;
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
g
100
;
}
acodec
libaacplus
;
abitrate
30
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=
players_pub
/[
stream
];
}
}
}
vhost
players_pub
{
hls
{
enabled
on
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
5
;
hls_window
30
;
}
}
# rtmp only, no hls, for chat(low latecy)
vhost
players_pub_rtmp
{
gop_cache
off
;
hls
{
enabled
off
;
}
}
# for development
vhost
dev
{
enabled
on
;
gop_cache
on
;
queue_length
10
;
#forward 127.0.0.1:19350;
hls
{
enabled
off
;
hls_path
./
objs
/
nginx
/
html
;
hls_fragment
5
;
hls_window
30
;
}
http_hooks
{
enabled
off
;
on_connect
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_close
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
clients
;
on_publish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_unpublish
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
streams
;
on_play
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
on_stop
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
sessions
;
}
transcode
{
enabled
off
;
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
dev
{
enabled
on
;
vfilter
{
}
vcodec
libx264
;
vbitrate
300
;
vfps
20
;
vwidth
768
;
vheight
320
;
vthreads
1
;
vprofile
baseline
;
vpreset
superfast
;
vparams
{
}
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
engine
dev_acodec
{
enabled
on
;
vcodec
copy
;
acodec
libaacplus
;
abitrate
45
;
asample_rate
44100
;
achannels
2
;
aparams
{
}
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
]
_
[
engine
];
}
}
}
...
...
trunk/scripts/_step.start.srs.19350.sh
查看文件 @
b363388
...
...
@@ -2,10 +2,10 @@
src_dir
=
'src'
if
[[
! -d
$src_dir
]]
;
then
echo
"错误:必须在src同目录执行脚本"
;
exit
1;
fi
cmd
=
"nohup ./objs/srs -c conf/
srs.19350.conf > ./objs/logs/srs
.19350.log 2>&1 &"
cmd
=
"nohup ./objs/srs -c conf/
demo.19350.conf > ./objs/logs/demo
.19350.log 2>&1 &"
echo
"启动SRS转发服务器:
$cmd
"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"srs.19350.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
nohup ./objs/srs -c conf/srs.19350.conf > ./objs/logs/srs.19350.log 2>&1 &
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"demo.19350.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
nohup ./objs/srs -c conf/demo.19350.conf > ./objs/logs/demo.19350.log 2>&1 &
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"错误:启动SRS转发服务器失败"
;
exit
$ret
;
fi
echo
"启动SRS转发服务器成功"
...
...
trunk/scripts/_step.start.srs.sh
查看文件 @
b363388
...
...
@@ -2,10 +2,10 @@
src_dir
=
'src'
if
[[
! -d
$src_dir
]]
;
then
echo
"错误:必须在src同目录执行脚本"
;
exit
1;
fi
cmd
=
"nohup ./objs/srs -c conf/
srs.conf >./objs/logs/srs
.log 2>&1 &"
cmd
=
"nohup ./objs/srs -c conf/
demo.conf >./objs/logs/demo
.log 2>&1 &"
echo
"启动SRS服务器:
$cmd
"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"srs.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
nohup ./objs/srs -c conf/srs.conf >./objs/logs/srs.log 2>&1 &
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"demo.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
nohup ./objs/srs -c conf/demo.conf >./objs/logs/demo.log 2>&1 &
ret
=
$?
;
if
[[
0 -ne
$ret
]]
;
then
echo
"错误:启动SRS失败"
;
exit
$ret
;
fi
echo
"启动SRS服务器成功"
...
...
trunk/scripts/stop.sh
查看文件 @
b363388
#!/bin/bash
echo
"停止SRS服务器"
ps aux|grep srs|grep
"./objs"
|grep
"srs.conf"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"srs.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
ps aux|grep srs|grep
"./objs"
|grep
"demo.conf"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"demo.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
echo
"停止SRS转发服务器"
ps aux|grep srs|grep
"./objs"
|grep
"srs.19350.conf"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"srs.19350.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
ps aux|grep srs|grep
"./objs"
|grep
"demo.19350.conf"
pids
=
`
ps aux|grep srs|grep
"./objs"
|grep
"demo.19350.conf"
|awk
'{print $2}'
`
;
for
pid
in
$pids
;
do
echo
"结束现有进程:
$pid
"
;
kill
-s SIGKILL
$pid
;
done
# step 4(optinal): start nginx for HLS
echo
"停止NGINX(HLS服务)"
...
...
请
注册
或
登录
后发表评论