diff --git a/trunk/conf/dvr.segment.conf b/trunk/conf/dvr.segment.conf new file mode 100644 index 000000000..9277671cc --- /dev/null +++ b/trunk/conf/dvr.segment.conf @@ -0,0 +1,13 @@ +# the config for srs to dvr in segment mode +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/DVR +# @see full.conf for detail config. + +listen 1935; +vhost __defaultVhost__ { + dvr { + enabled on; + dvr_path ./objs/nginx/html; + dvr_plan segment; + dvr_duration 30; + } +} diff --git a/trunk/conf/dvr.session.conf b/trunk/conf/dvr.session.conf new file mode 100644 index 000000000..59496c8c1 --- /dev/null +++ b/trunk/conf/dvr.session.conf @@ -0,0 +1,12 @@ +# the config for srs to dvr in session mode +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/DVR +# @see full.conf for detail config. + +listen 1935; +vhost __defaultVhost__ { + dvr { + enabled on; + dvr_path ./objs/nginx/html; + dvr_plan session; + } +} diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf index 7a7b580c4..cb24ec97a 100644 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -146,7 +146,7 @@ vhost dvr.srs.com { dvr { # whether enabled dvr features # default: off - enabled on; + enabled on; # the dvr output path. # the app dir is auto created under the dvr_path. # for example, for rtmp stream: @@ -158,7 +158,7 @@ vhost dvr.srs.com { # @remark, the time use system timestamp in ms, user can use http callback to rename it. # in a word, the dvr_path is for vhost. # default: ./objs/nginx/html - dvr_path ./objs/nginx/html; + dvr_path ./objs/nginx/html; # the dvr plan. canbe: # session reap flv when session end(unpublish). # segment reap flv when flv duration exceed the specified dvr_duration. @@ -228,61 +228,41 @@ vhost http.srs.com { } } -# vhost for atc. -vhost atc.srs.com { - # vhost for atc for hls/hds/rtmp backup. - # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0. - # when atc is on, server delivery rtmp stream by absolute time. - # atc is used, for instance, encoder will copy stream to master and slave server, - # server use atc to delivery stream to edge/client, where stream time from master/slave server - # is always the same, client/tools can slice RTMP stream to HLS according to the same time, - # if the time not the same, the HLS stream cannot slice to support system backup. - # - # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html - # @see http://www.baidu.com/#wd=hds%20hls%20atc - # - # default: off - atc on; - # whether enable the auto atc, - # if enabled, detect the bravo_atc="true" in onMetaData packet, - # set atc to on if matched. - # always ignore the onMetaData if atc_auto is off. - # default: on - atc_auto 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. +# 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 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; + # 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 ./objs/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; } } - -# set the chunk size of vhost. -vhost chunksize.srs.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 vhost with hls disabled. +vhost no-hls.srs.com { + hls { + # whether the hls is enabled. + # if off, donot write hls(ts and m3u8) when publish. + # default: off + enabled off; + } } # the http hook callback vhost, srs will invoke the hooks for specified events. @@ -410,6 +390,67 @@ vhost hooks.callback.srs.com { } } +# 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 enabled 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; +} + +# the vhost which forward publish streams. +vhost same.vhost.forward.srs.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.srs.com + # if vhost not specified, use the request vhost instead. + forward 127.0.0.1:1936 127.0.0.1:1937; +} +# TODO: FIXME: support extra params. +# [plan] the vhost which forward publish streams to other vhosts. +vhost change.vhost.forward.srs.com { + forward 127.0.0.1:1936 127.0.0.1:1937 { + # specify the vhost to override the vhost in client request. + vhost forward2.srs.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.srs.com; + } +} + # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction vhost mirror.transcode.srs.com { transcode { @@ -812,28 +853,61 @@ vhost stream.transcode.srs.com { } } -# the vhost which forward publish streams. -vhost same.vhost.forward.srs.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.srs.com - # if vhost not specified, use the request vhost instead. - forward 127.0.0.1:1936 127.0.0.1:1937; +# 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; + } } -# TODO: FIXME: support extra params. -# [plan] the vhost which forward publish streams to other vhosts. -vhost change.vhost.forward.srs.com { - forward 127.0.0.1:1936 127.0.0.1:1937 { - # specify the vhost to override the vhost in client request. - vhost forward2.srs.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.srs.com; - } + +# set the chunk size of vhost. +vhost chunksize.srs.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; +} + +# vhost for atc. +vhost atc.srs.com { + # vhost for atc for hls/hds/rtmp backup. + # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0. + # when atc is on, server delivery rtmp stream by absolute time. + # atc is used, for instance, encoder will copy stream to master and slave server, + # server use atc to delivery stream to edge/client, where stream time from master/slave server + # is always the same, client/tools can slice RTMP stream to HLS according to the same time, + # if the time not the same, the HLS stream cannot slice to support system backup. + # + # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html + # @see http://www.baidu.com/#wd=hds%20hls%20atc + # + # default: off + atc on; + # whether enable the auto atc, + # if enabled, detect the bravo_atc="true" in onMetaData packet, + # set atc to on if matched. + # always ignore the onMetaData if atc_auto is off. + # default: on + atc_auto on; } # the vhost disabled. @@ -844,80 +918,6 @@ vhost removed.srs.com { enabled off; } -# 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 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 ./objs/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.srs.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 enabled 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. diff --git a/trunk/conf/http.heartbeat.conf b/trunk/conf/http.heartbeat.conf new file mode 100644 index 000000000..52513e11a --- /dev/null +++ b/trunk/conf/http.heartbeat.conf @@ -0,0 +1,12 @@ +# the config for srs http heartbeat, report its info to api-server +# @see full.conf for detail config. + +listen 1935; +heartbeat { + enabled on; + interval 9.3; + url http://127.0.0.1:8085/api/v1/servers; + device_id "my-srs-device"; +} +vhost __defaultVhost__ { +}