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
2015-08-30 08:34:52 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
0109a74840ad3231f54d048025d4fa0322e7aed7
0109a748
1 parent
2b4fa2d7
for #319, refine the config structure.
显示空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
479 行增加
和
507 行删除
trunk/conf/full.conf
trunk/conf/full.one.vhost.conf
trunk/conf/full.conf
查看文件 @
0109a74
...
...
@@ -268,81 +268,86 @@ vhost removed.srs.com {
# @see scope.vhost.srs.com
enabled
off
;
}
# the vhost for antisuck.
vhost
refer
.
anti_suck
.
com
{
# refer hotlink-denial.
refer
{
# whether enable the refer hotlink-denial.
# default: off.
enabled
on
;
# 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.
all
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.
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.
play
github
.
com
github
.
io
;
# vhost for stream cluster for RTMP/FLV
vhost
cluster
.
srs
.
com
{
# stream RTMP/FLV cluster config.
cluster
{
# the mode of vhost, local or remote.
# local: vhost is origin vhost, which provides stream source.
# remote: vhost is edge vhost, which pull/push to origin.
# default: local
mode
remote
;
# for edge(remote mode), user must specifies the origin server
# format as: <server_name|ip>[:port]
# @remark user can specifies multiple origin for error backup, by space,
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
# for edge, whether open the token traverse mode,
# if token traverse on, all connections of edge will forward to origin to check(auth),
# it's very important for the edge to do the token auth.
# the better way is use http callback to do the token auth by the edge,
# but if user prefer origin check(auth), the token_traverse if better solution.
# default: off
token_traverse
off
;
# the vhost to transform for edge,
# to fetch from the specified vhost at origin,
# if not specified, use the current vhost of edge in origin, the variable [vhost].
# default: [vhost]
vhost
same
.
edge
.
srs
.
com
;
# when upnode(forward to, edge push to, edge pull from) is srs,
# it's strongly recommend to open the debug_srs_upnode,
# when connect to upnode, it will take the debug info,
# for example, the id, source id, pid.
# please see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLog
# default: on
debug_srs_upnode
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
;
# vhost for edge, edge and origin is the same vhost
vhost
same
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
}
}
# the publish specified configs
vhost
publish
.
srs
.
com
{
# the config for FMLE/Flash publisher, which push RTMP to SRS.
publish
{
# about MR, read https://github.com/simple-rtmp-server/srs/issues/241
# when enabled the mr, SRS will read as large as possible.
# default: off
mr
off
;
# the latency in ms for MR(merged-read),
# the performance+ when latency+, and memory+,
# memory(buffer) = latency * kbps / 8
# for example, latency=500ms, kbps=3000kbps, each publish connection will consume
# memory = 500 * 3000 / 8 = 187500B = 183KB
# when there are 2500 publisher, the total memory of SRS atleast:
# 183KB * 2500 = 446MB
# the value recomment is [300, 2000]
# default: 350
mr_latency
350
;
# vhost for edge, edge transform vhost to fetch from another vhost.
vhost
transform
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
vhost
same
.
edge
.
srs
.
com
;
}
}
# the 1st packet timeout in ms for encoder.
# default: 20000
firstpkt_timeout
20000
;
# the normal packet timeout in ms for encoder.
# default: 5000
normal_timeout
7000
;
# the vhost for srs debug info, whether send args in connect(tcUrl).
vhost
debug
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
debug_srs_upnode
on
;
}
}
# the vhost which forward publish streams.
vhost
same
.
vhost
.
forward
.
srs
.
com
{
# forward stream to other servers.
forward
{
# whether enable the forward.
# default: off
enabled
on
;
# 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}
destination
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
}
}
...
...
@@ -505,136 +510,81 @@ vhost stream.control.com {
}
}
# the vhost which forward publish streams.
vhost
same
.
vhost
.
forward
.
srs
.
com
{
# forward stream to other servers.
forward
{
# whether enable the forward.
# default: off
enabled
on
;
# 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}
destination
127
.
0
.
0
.
1
:
1936
127
.
0
.
0
.
1
:
1937
;
}
}
# vhost for stream cluster for RTMP/FLV
vhost
cluster
.
srs
.
com
{
# stream RTMP/FLV cluster config.
cluster
{
# the mode of vhost, local or remote.
# local: vhost is origin vhost, which provides stream source.
# remote: vhost is edge vhost, which pull/push to origin.
# default: local
mode
remote
;
# for edge(remote mode), user must specifies the origin server
# format as: <server_name|ip>[:port]
# @remark user can specifies multiple origin for error backup, by space,
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
# for edge, whether open the token traverse mode,
# if token traverse on, all connections of edge will forward to origin to check(auth),
# it's very important for the edge to do the token auth.
# the better way is use http callback to do the token auth by the edge,
# but if user prefer origin check(auth), the token_traverse if better solution.
# the publish specified configs
vhost
publish
.
srs
.
com
{
# the config for FMLE/Flash publisher, which push RTMP to SRS.
publish
{
# about MR, read https://github.com/simple-rtmp-server/srs/issues/241
# when enabled the mr, SRS will read as large as possible.
# default: off
token_traverse
off
;
# the vhost to transform for edge,
# to fetch from the specified vhost at origin,
# if not specified, use the current vhost of edge in origin, the variable [vhost].
# default: [vhost]
vhost
same
.
edge
.
srs
.
com
;
# when upnode(forward to, edge push to, edge pull from) is srs,
# it's strongly recommend to open the debug_srs_upnode,
# when connect to upnode, it will take the debug info,
# for example, the id, source id, pid.
# please see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLog
# default: on
debug_srs_upnode
on
;
}
}
mr
off
;
# the latency in ms for MR(merged-read),
# the performance+ when latency+, and memory+,
# memory(buffer) = latency * kbps / 8
# for example, latency=500ms, kbps=3000kbps, each publish connection will consume
# memory = 500 * 3000 / 8 = 187500B = 183KB
# when there are 2500 publisher, the total memory of SRS atleast:
# 183KB * 2500 = 446MB
# the value recomment is [300, 2000]
# default: 350
mr_latency
350
;
# vhost for edge, edge and origin is the same vhost
vhost
same
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
# the 1st packet timeout in ms for encoder.
# default: 20000
firstpkt_timeout
20000
;
# the normal packet timeout in ms for encoder.
# default: 5000
normal_timeout
7000
;
}
}
# vhost for edge, edge transform vhost to fetch from another vhost.
vhost
transform
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
vhost
same
.
edge
.
srs
.
com
;
# the vhost for antisuck.
vhost
refer
.
anti_suck
.
com
{
# refer hotlink-denial.
refer
{
# whether enable the refer hotlink-denial.
# default: off.
enabled
on
;
# 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.
all
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.
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.
play
github
.
com
github
.
io
;
}
}
# the vhost for srs debug info, whether send args in connect(tcUrl).
vhost
debug
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
debug_srs_upnode
on
;
}
}
# the vhost for exec, fork process when publish stream.
vhost
exec
.
srs
.
com
{
# the exec used to fork process when got some event.
exec
{
# whether enable the exec.
# 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
off
;
# when publish stream, exec the process with 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.
# other variables for exec only:
# [url] the rtmp url which trigger the publish.
# [tcUrl] the client request tcUrl.
# [swfUrl] the client request swfUrl.
# [pageUrl] the client request pageUrl.
# @remark empty to ignore this exec.
publish
./
objs
/
ffmpeg
/
bin
/
ffmpeg
-
f
flv
-
i
[
url
] -
c
copy
-
y
./[
stream
].
flv
;
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
;
}
}
...
...
@@ -667,173 +617,6 @@ vhost security.srs.com {
}
}
# vhost for dvr
vhost
dvr
.
srs
.
com
{
# dvr RTMP stream to file,
# start to record to file when encoder publish,
# reap flv according by specified dvr_plan.
dvr
{
# whether enabled dvr features
# default: off
enabled
on
;
# the dvr plan. canbe:
# session reap flv when session end(unpublish).
# segment reap flv when flv duration exceed the specified dvr_duration.
# append always append to flv file, never reap it.
# default: session
dvr_plan
session
;
# the dvr output path.
# we supports some variables to generate the filename.
# [vhost], the vhost of stream.
# [app], the app of stream.
# [stream], the stream name of stream.
# [2006], replace this const to current year.
# [01], replace this const to current month.
# [02], replace this const to current date.
# [15], replace this const to current hour.
# [04], repleace this const to current minute.
# [05], repleace this const to current second.
# [999], repleace this const to current millisecond.
# [timestamp],replace this const to current UNIX timestamp in ms.
# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
# for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776
# 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename):
# dvr_path ./objs/nginx/html;
# =>
# dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv;
# 2. Use stream and date as dir name, time as filename:
# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv;
# 3. Use stream and year/month as dir name, date and time as filename:
# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv;
# 4. Use vhost/app and year/month as dir name, stream/date/time as filename:
# dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv;
# @see https://github.com/simple-rtmp-server/srs/wiki/v2_CN_DVR#custom-path
# @see https://github.com/simple-rtmp-server/srs/wiki/v2_EN_DVR#custom-path
# segment,session apply it.
# default: ./objs/nginx/html/[app]/[stream].[timestamp].flv
dvr_path
./
objs
/
nginx
/
html
/[
app
]/[
stream
].[
timestamp
].
flv
;
# the duration for dvr file, reap if exeed, in seconds.
# segment apply it.
# session,append ignore.
# default: 30
dvr_duration
30
;
# whether wait keyframe to reap segment,
# if off, reap segment when duration exceed the dvr_duration,
# if on, reap segment when duration exceed and got keyframe.
# segment apply it.
# session,append ignore.
# default: on
dvr_wait_keyframe
on
;
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# apply for all dvr plan.
# default: full
time_jitter
full
;
# on_dvr, never config in here, should config in http_hooks.
# for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com
# @read https://github.com/simple-rtmp-server/srs/wiki/v2_CN_DVR#http-callback
# @read https://github.com/simple-rtmp-server/srs/wiki/v2_EN_DVR#http-callback
}
}
# vhost for ingest
vhost
ingest
.
srs
.
com
{
# ingest file/stream/device then push to SRS over RTMP.
# the name/id used to identify the ingest, must be unique in global.
# ingest id is used in reload or http api management.
ingest
livestream
{
# whether enabled ingest features
# default: off
enabled
on
;
# input file/stream/device
# @remark only support one input.
input
{
# the type of input.
# can be file/stream/device, that is,
# file: ingest file specifies by url.
# stream: ingest stream specifeis by url.
# device: not support yet.
# default: file
type
file
;
# the url of file/stream.
url
./
doc
/
source
.
200
kbps
.
768
x320
.
flv
;
}
# the ffmpeg
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
# the transcode engine, @see all.transcode.srs.com
# @remark, the output is specified following.
engine
{
# @see enabled of transcode engine.
# if disabled or vcodec/acodec not specified, use copy.
# default: off.
enabled
off
;
# output stream. variables:
# [vhost] current vhost which start the ingest.
# [port] system RTMP stream port.
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/
live
?
vhost
=[
vhost
]/
livestream
;
}
}
}
# the vhost for intest with transcode engine.
vhost
transcode
.
ingest
.
srs
.
com
{
ingest
livestream
{
enabled
on
;
input
{
type
file
;
url
./
doc
/
source
.
200
kbps
.
768
x320
.
flv
;
}
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
iformat
flv
;
vfilter
{
i
./
doc
/
ffmpeg
-
logo
.
png
;
filter_complex
'overlay=10:10'
;
}
vcodec
libx264
;
vbitrate
1500
;
vfps
25
;
vwidth
768
;
vheight
320
;
vthreads
12
;
vprofile
main
;
vpreset
medium
;
vparams
{
t
100
;
coder
1
;
b_strategy
2
;
bf
3
;
refs
10
;
}
acodec
libfdk_aac
;
abitrate
70
;
asample_rate
44100
;
achannels
2
;
aparams
{
profile
:
a
aac_low
;
}
oformat
flv
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
];
}
}
}
# vhost for http static and flv vod stream for each vhost.
vhost
http
.
static
.
srs
.
com
{
# http static vhost specified config
...
...
@@ -916,19 +699,179 @@ vhost http.remux.srs.com {
}
}
# the vhost with hls specified.
vhost
with
-
hls
.
srs
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost
hooks
.
callback
.
srs
.
com
{
http_hooks
{
# whether the http hooks enalbe.
# default off.
enabled
on
;
# the hls fragment in seconds, the duration of a piece of ts.
# default: 10
hls_fragment
10
;
# the hls m3u8 target duration ratio,
# EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
# EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
# 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",
# "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a",
# "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",
# "send_bytes": 10240, "recv_bytes": 10240
# }
# 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",
# "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_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
;
# when srs reap a dvr file, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_dvr",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream",
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
# }
# 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
on_dvr
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
dvrs
http
://
localhost
:
8085
/
api
/
v1
/
dvrs
;
# when srs reap a ts file of hls, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_hls",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream",
# "duration": 9.36, // in seconds
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
# "url": "live/livestream/2015-04-23/01/476584165.ts",
# "m3u8": "./objs/nginx/html/live/livestream/live.m3u8",
# "m3u8_url": "live/livestream/live.m3u8",
# "seq_no": 100
# }
# 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
on_hls
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
http
://
localhost
:
8085
/
api
/
v1
/
hls
;
# when srs reap a ts file of hls, call this hook,
# used to push file to cdn network, by get the ts file from cdn network.
# so we use HTTP GET and use the variable following:
# [app], replace with the app.
# [stream], replace with the stream.
# [ts_url], replace with the ts url.
# ignore any return data of server.
# @remark random select a url to report, not report all.
on_hls_notify
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
/[
app
]/[
stream
][
ts_url
];
}
}
# the vhost for exec, fork process when publish stream.
vhost
exec
.
srs
.
com
{
# the exec used to fork process when got some event.
exec
{
# whether enable the exec.
# default: off.
enabled
off
;
# when publish stream, exec the process with 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.
# other variables for exec only:
# [url] the rtmp url which trigger the publish.
# [tcUrl] the client request tcUrl.
# [swfUrl] the client request swfUrl.
# [pageUrl] the client request pageUrl.
# @remark empty to ignore this exec.
publish
./
objs
/
ffmpeg
/
bin
/
ffmpeg
-
f
flv
-
i
[
url
] -
c
copy
-
y
./[
stream
].
flv
;
}
}
# the vhost with hls specified.
vhost
with
-
hls
.
srs
.
com
{
hls
{
# whether the hls is enabled.
# if off, donot write hls(ts and m3u8) when publish.
# default: off
enabled
on
;
# the hls fragment in seconds, the duration of a piece of ts.
# default: 10
hls_fragment
10
;
# the hls m3u8 target duration ratio,
# EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
# EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
# @see https://github.com/simple-rtmp-server/srs/issues/304#issuecomment-74000081
# default: 1.5
hls_td_ratio
1
.
5
;
...
...
@@ -1085,140 +1028,170 @@ vhost hds.srs.com {
}
}
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost
hooks
.
callback
.
srs
.
com
{
http_hooks
{
# whether the http hooks enalbe.
# default off.
# vhost for dvr
vhost
dvr
.
srs
.
com
{
# dvr RTMP stream to file,
# start to record to file when encoder publish,
# reap flv according by specified dvr_plan.
dvr
{
# whether enabled dvr features
# 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",
# "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a",
# "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",
# "send_bytes": 10240, "recv_bytes": 10240
# }
# 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",
# "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_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
;
# when srs reap a dvr file, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_dvr",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream",
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
# }
# 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
on_dvr
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
dvrs
http
://
localhost
:
8085
/
api
/
v1
/
dvrs
;
# when srs reap a ts file of hls, call the hook,
# the request in the POST data string is a object encode by json:
# {
# "action": "on_hls",
# "client_id": 1985,
# "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
# "stream": "livestream",
# "duration": 9.36, // in seconds
# "cwd": "/usr/local/srs",
# "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
# "url": "live/livestream/2015-04-23/01/476584165.ts",
# "m3u8": "./objs/nginx/html/live/livestream/live.m3u8",
# "m3u8_url": "live/livestream/live.m3u8",
# "seq_no": 100
# }
# 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
on_hls
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
http
://
localhost
:
8085
/
api
/
v1
/
hls
;
# when srs reap a ts file of hls, call this hook,
# used to push file to cdn network, by get the ts file from cdn network.
# so we use HTTP GET and use the variable following:
# [app], replace with the app.
# [stream], replace with the stream.
# [ts_url], replace with the ts url.
# ignore any return data of server.
# @remark random select a url to report, not report all.
on_hls_notify
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
/[
app
]/[
stream
][
ts_url
];
# the dvr plan. canbe:
# session reap flv when session end(unpublish).
# segment reap flv when flv duration exceed the specified dvr_duration.
# append always append to flv file, never reap it.
# default: session
dvr_plan
session
;
# the dvr output path.
# we supports some variables to generate the filename.
# [vhost], the vhost of stream.
# [app], the app of stream.
# [stream], the stream name of stream.
# [2006], replace this const to current year.
# [01], replace this const to current month.
# [02], replace this const to current date.
# [15], replace this const to current hour.
# [04], repleace this const to current minute.
# [05], repleace this const to current second.
# [999], repleace this const to current millisecond.
# [timestamp],replace this const to current UNIX timestamp in ms.
# @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
# for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776
# 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename):
# dvr_path ./objs/nginx/html;
# =>
# dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv;
# 2. Use stream and date as dir name, time as filename:
# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv;
# 3. Use stream and year/month as dir name, date and time as filename:
# dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv;
# 4. Use vhost/app and year/month as dir name, stream/date/time as filename:
# dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv;
# =>
# dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv;
# @see https://github.com/simple-rtmp-server/srs/wiki/v2_CN_DVR#custom-path
# @see https://github.com/simple-rtmp-server/srs/wiki/v2_EN_DVR#custom-path
# segment,session apply it.
# default: ./objs/nginx/html/[app]/[stream].[timestamp].flv
dvr_path
./
objs
/
nginx
/
html
/[
app
]/[
stream
].[
timestamp
].
flv
;
# the duration for dvr file, reap if exeed, in seconds.
# segment apply it.
# session,append ignore.
# default: 30
dvr_duration
30
;
# whether wait keyframe to reap segment,
# if off, reap segment when duration exceed the dvr_duration,
# if on, reap segment when duration exceed and got keyframe.
# segment apply it.
# session,append ignore.
# default: on
dvr_wait_keyframe
on
;
# about the stream monotonically increasing:
# 1. video timestamp is monotonically increasing,
# 2. audio timestamp is monotonically increasing,
# 3. video and audio timestamp is interleaved monotonically increasing.
# it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
# however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
# the time jitter algorithm:
# 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
# 2. zero, only ensure sttream start at zero, ignore timestamp jitter.
# 3. off, disable the time jitter algorithm, like atc.
# apply for all dvr plan.
# default: full
time_jitter
full
;
# on_dvr, never config in here, should config in http_hooks.
# for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com
# @read https://github.com/simple-rtmp-server/srs/wiki/v2_CN_DVR#http-callback
# @read https://github.com/simple-rtmp-server/srs/wiki/v2_EN_DVR#http-callback
}
}
# vhost for ingest
vhost
ingest
.
srs
.
com
{
# ingest file/stream/device then push to SRS over RTMP.
# the name/id used to identify the ingest, must be unique in global.
# ingest id is used in reload or http api management.
ingest
livestream
{
# whether enabled ingest features
# default: off
enabled
on
;
# input file/stream/device
# @remark only support one input.
input
{
# the type of input.
# can be file/stream/device, that is,
# file: ingest file specifies by url.
# stream: ingest stream specifeis by url.
# device: not support yet.
# default: file
type
file
;
# the url of file/stream.
url
./
doc
/
source
.
200
kbps
.
768
x320
.
flv
;
}
# the ffmpeg
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
# the transcode engine, @see all.transcode.srs.com
# @remark, the output is specified following.
engine
{
# @see enabled of transcode engine.
# if disabled or vcodec/acodec not specified, use copy.
# default: off.
enabled
off
;
# output stream. variables:
# [vhost] current vhost which start the ingest.
# [port] system RTMP stream port.
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/
live
?
vhost
=[
vhost
]/
livestream
;
}
}
}
# the vhost for intest with transcode engine.
vhost
transcode
.
ingest
.
srs
.
com
{
ingest
livestream
{
enabled
on
;
input
{
type
file
;
url
./
doc
/
source
.
200
kbps
.
768
x320
.
flv
;
}
ffmpeg
./
objs
/
ffmpeg
/
bin
/
ffmpeg
;
engine
{
enabled
off
;
iformat
flv
;
vfilter
{
i
./
doc
/
ffmpeg
-
logo
.
png
;
filter_complex
'overlay=10:10'
;
}
vcodec
libx264
;
vbitrate
1500
;
vfps
25
;
vwidth
768
;
vheight
320
;
vthreads
12
;
vprofile
main
;
vpreset
medium
;
vparams
{
t
100
;
coder
1
;
b_strategy
2
;
bf
3
;
refs
10
;
}
acodec
libfdk_aac
;
abitrate
70
;
asample_rate
44100
;
achannels
2
;
aparams
{
profile
:
a
aac_low
;
}
oformat
flv
;
output
rtmp
://
127
.
0
.
0
.
1
:[
port
]/[
app
]?
vhost
=[
vhost
]/[
stream
];
}
}
}
...
...
trunk/conf/full.one.vhost.conf
查看文件 @
0109a74
...
...
@@ -51,7 +51,6 @@ vhost vhost.srs.com {
tcp_nodelay
on
;
min_latency
on
;
# TODO
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
...
...
@@ -137,6 +136,11 @@ vhost vhost.srs.com {
on_hls_notify
http
://
127
.
0
.
0
.
1
:
8085
/
api
/
v1
/
hls
/[
app
]/[
stream
][
ts_url
];
}
exec
{
enabled
off
;
publish
./
objs
/
ffmpeg
/
bin
/
ffmpeg
-
f
flv
-
i
[
url
] -
c
copy
-
y
./[
stream
].
flv
;
}
hls
{
enabled
off
;
hls_fragment
10
;
...
...
@@ -166,11 +170,6 @@ vhost vhost.srs.com {
hds_path
./
objs
/
nginx
/
html
;
}
exec
{
enabled
off
;
publish
./
objs
/
ffmpeg
/
bin
/
ffmpeg
-
f
flv
-
i
[
url
] -
c
copy
-
y
./[
stream
].
flv
;
}
dvr
{
enabled
off
;
dvr_plan
session
;
...
...
请
注册
或
登录
后发表评论