winlin

add dvr, http heartbeat conf sample

  1 +# the config for srs to dvr in segment mode
  2 +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/DVR
  3 +# @see full.conf for detail config.
  4 +
  5 +listen 1935;
  6 +vhost __defaultVhost__ {
  7 + dvr {
  8 + enabled on;
  9 + dvr_path ./objs/nginx/html;
  10 + dvr_plan segment;
  11 + dvr_duration 30;
  12 + }
  13 +}
  1 +# the config for srs to dvr in session mode
  2 +# @see https://github.com/winlinvip/simple-rtmp-server/wiki/DVR
  3 +# @see full.conf for detail config.
  4 +
  5 +listen 1935;
  6 +vhost __defaultVhost__ {
  7 + dvr {
  8 + enabled on;
  9 + dvr_path ./objs/nginx/html;
  10 + dvr_plan session;
  11 + }
  12 +}
@@ -146,7 +146,7 @@ vhost dvr.srs.com { @@ -146,7 +146,7 @@ vhost dvr.srs.com {
146 dvr { 146 dvr {
147 # whether enabled dvr features 147 # whether enabled dvr features
148 # default: off 148 # default: off
149 - enabled on; 149 + enabled on;
150 # the dvr output path. 150 # the dvr output path.
151 # the app dir is auto created under the dvr_path. 151 # the app dir is auto created under the dvr_path.
152 # for example, for rtmp stream: 152 # for example, for rtmp stream:
@@ -158,7 +158,7 @@ vhost dvr.srs.com { @@ -158,7 +158,7 @@ vhost dvr.srs.com {
158 # @remark, the time use system timestamp in ms, user can use http callback to rename it. 158 # @remark, the time use system timestamp in ms, user can use http callback to rename it.
159 # in a word, the dvr_path is for vhost. 159 # in a word, the dvr_path is for vhost.
160 # default: ./objs/nginx/html 160 # default: ./objs/nginx/html
161 - dvr_path ./objs/nginx/html; 161 + dvr_path ./objs/nginx/html;
162 # the dvr plan. canbe: 162 # the dvr plan. canbe:
163 # session reap flv when session end(unpublish). 163 # session reap flv when session end(unpublish).
164 # segment reap flv when flv duration exceed the specified dvr_duration. 164 # segment reap flv when flv duration exceed the specified dvr_duration.
@@ -228,61 +228,41 @@ vhost http.srs.com { @@ -228,61 +228,41 @@ vhost http.srs.com {
228 } 228 }
229 } 229 }
230 230
231 -# vhost for atc.  
232 -vhost atc.srs.com {  
233 - # vhost for atc for hls/hds/rtmp backup.  
234 - # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.  
235 - # when atc is on, server delivery rtmp stream by absolute time.  
236 - # atc is used, for instance, encoder will copy stream to master and slave server,  
237 - # server use atc to delivery stream to edge/client, where stream time from master/slave server  
238 - # is always the same, client/tools can slice RTMP stream to HLS according to the same time,  
239 - # if the time not the same, the HLS stream cannot slice to support system backup.  
240 - #  
241 - # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html  
242 - # @see http://www.baidu.com/#wd=hds%20hls%20atc  
243 - #  
244 - # default: off  
245 - atc on;  
246 - # whether enable the auto atc,  
247 - # if enabled, detect the bravo_atc="true" in onMetaData packet,  
248 - # set atc to on if matched.  
249 - # always ignore the onMetaData if atc_auto is off.  
250 - # default: on  
251 - atc_auto on;  
252 -}  
253 -  
254 -# vhost for bandwidth check  
255 -# generally, the bandcheck vhost must be: bandcheck.srs.com,  
256 -# or need to modify the vhost of client.  
257 -vhost bandcheck.srs.com {  
258 - enabled on;  
259 - chunk_size 65000;  
260 - # bandwidth check config.  
261 - bandcheck {  
262 - # whether support bandwidth check,  
263 - # default: off. 231 +# the vhost with hls specified.
  232 +vhost with-hls.srs.com {
  233 + hls {
  234 + # whether the hls is enabled.
  235 + # if off, donot write hls(ts and m3u8) when publish.
  236 + # default: off
264 enabled on; 237 enabled on;
265 - # the key for server to valid,  
266 - # if invalid key, server disconnect and abort the bandwidth check.  
267 - key "35c9b402c12a7246868752e2878f7e0e";  
268 - # the interval in seconds for bandwidth check,  
269 - # server donot allow new test request.  
270 - # default: 30  
271 - interval 30;  
272 - # the max available check bandwidth in kbps.  
273 - # to avoid attack of bandwidth check.  
274 - # default: 1000  
275 - limit_kbps 4000; 238 + # the hls output path.
  239 + # the app dir is auto created under the hls_path.
  240 + # for example, for rtmp stream:
  241 + # rtmp://127.0.0.1/live/livestream
  242 + # http://127.0.0.1/live/livestream.m3u8
  243 + # where hls_path is /hls, srs will create the following files:
  244 + # /hls/live the app dir for all streams.
  245 + # /hls/live/livestream.m3u8 the HLS m3u8 file.
  246 + # /hls/live/livestream-1.ts the HLS media/ts file.
  247 + # in a word, the hls_path is for vhost.
  248 + # default: ./objs/nginx/html
  249 + hls_path ./objs/nginx/html;
  250 + # the hls fragment in seconds, the duration of a piece of ts.
  251 + # default: 10
  252 + hls_fragment 10;
  253 + # the hls window in seconds, the number of ts in m3u8.
  254 + # default: 60
  255 + hls_window 60;
276 } 256 }
277 } 257 }
278 -  
279 -# set the chunk size of vhost.  
280 -vhost chunksize.srs.com {  
281 - # the default chunk size is 128, max is 65536,  
282 - # some client does not support chunk size change,  
283 - # vhost chunk size will override the global value.  
284 - # default: global chunk size.  
285 - chunk_size 128; 258 +# the vhost with hls disabled.
  259 +vhost no-hls.srs.com {
  260 + hls {
  261 + # whether the hls is enabled.
  262 + # if off, donot write hls(ts and m3u8) when publish.
  263 + # default: off
  264 + enabled off;
  265 + }
286 } 266 }
287 267
288 # the http hook callback vhost, srs will invoke the hooks for specified events. 268 # the http hook callback vhost, srs will invoke the hooks for specified events.
@@ -410,6 +390,67 @@ vhost hooks.callback.srs.com { @@ -410,6 +390,67 @@ vhost hooks.callback.srs.com {
410 } 390 }
411 } 391 }
412 392
  393 +# the vhost for min delay, donot cache any stream.
  394 +vhost min.delay.com {
  395 + # whether cache the last gop.
  396 + # if on, cache the last gop and dispatch to client,
  397 + # to enabled fast startup for client, client play immediately.
  398 + # if off, send the latest media data to client,
  399 + # client need to wait for the next Iframe to decode and show the video.
  400 + # set to off if requires min delay;
  401 + # set to on if requires client fast startup.
  402 + # default: on
  403 + gop_cache off;
  404 + # the max live queue length in seconds.
  405 + # if the messages in the queue exceed the max length,
  406 + # drop the old whole gop.
  407 + # default: 30
  408 + queue_length 10;
  409 +}
  410 +
  411 +# the vhost for antisuck.
  412 +vhost refer.anti_suck.com {
  413 + # the common refer for play and publish.
  414 + # if the page url of client not in the refer, access denied.
  415 + # if not specified this field, allow all.
  416 + # default: not specified.
  417 + refer github.com github.io;
  418 + # refer for publish clients specified.
  419 + # the common refer is not overrided by this.
  420 + # if not specified this field, allow all.
  421 + # default: not specified.
  422 + refer_publish github.com github.io;
  423 + # refer for play clients specified.
  424 + # the common refer is not overrided by this.
  425 + # if not specified this field, allow all.
  426 + # default: not specified.
  427 + refer_play github.com github.io;
  428 +}
  429 +
  430 +# the vhost which forward publish streams.
  431 +vhost same.vhost.forward.srs.com {
  432 + # forward all publish stream to the specified server.
  433 + # this used to split/forward the current stream for cluster active-standby,
  434 + # active-active for cdn to build high available fault tolerance system.
  435 + # format: {ip}:{port} {ip_N}:{port_N}
  436 + # or specify the vhost by params, @see: change.vhost.forward.srs.com
  437 + # if vhost not specified, use the request vhost instead.
  438 + forward 127.0.0.1:1936 127.0.0.1:1937;
  439 +}
  440 +# TODO: FIXME: support extra params.
  441 +# [plan] the vhost which forward publish streams to other vhosts.
  442 +vhost change.vhost.forward.srs.com {
  443 + forward 127.0.0.1:1936 127.0.0.1:1937 {
  444 + # specify the vhost to override the vhost in client request.
  445 + vhost forward2.srs.com;
  446 + # specify the refer(pageUrl) to override the refer in client request.
  447 + refer http://srs/index.html;
  448 + }
  449 + forward 127.0.0.1:1938 {
  450 + vhost forward3.srs.com;
  451 + }
  452 +}
  453 +
413 # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction 454 # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
414 vhost mirror.transcode.srs.com { 455 vhost mirror.transcode.srs.com {
415 transcode { 456 transcode {
@@ -812,30 +853,63 @@ vhost stream.transcode.srs.com { @@ -812,30 +853,63 @@ vhost stream.transcode.srs.com {
812 } 853 }
813 } 854 }
814 855
815 -# the vhost which forward publish streams.  
816 -vhost same.vhost.forward.srs.com {  
817 - # forward all publish stream to the specified server.  
818 - # this used to split/forward the current stream for cluster active-standby,  
819 - # active-active for cdn to build high available fault tolerance system.  
820 - # format: {ip}:{port} {ip_N}:{port_N}  
821 - # or specify the vhost by params, @see: change.vhost.forward.srs.com  
822 - # if vhost not specified, use the request vhost instead.  
823 - forward 127.0.0.1:1936 127.0.0.1:1937;  
824 -}  
825 -# TODO: FIXME: support extra params.  
826 -# [plan] the vhost which forward publish streams to other vhosts.  
827 -vhost change.vhost.forward.srs.com {  
828 - forward 127.0.0.1:1936 127.0.0.1:1937 {  
829 - # specify the vhost to override the vhost in client request.  
830 - vhost forward2.srs.com;  
831 - # specify the refer(pageUrl) to override the refer in client request.  
832 - refer http://srs/index.html;  
833 - }  
834 - forward 127.0.0.1:1938 {  
835 - vhost forward3.srs.com; 856 +# vhost for bandwidth check
  857 +# generally, the bandcheck vhost must be: bandcheck.srs.com,
  858 +# or need to modify the vhost of client.
  859 +vhost bandcheck.srs.com {
  860 + enabled on;
  861 + chunk_size 65000;
  862 + # bandwidth check config.
  863 + bandcheck {
  864 + # whether support bandwidth check,
  865 + # default: off.
  866 + enabled on;
  867 + # the key for server to valid,
  868 + # if invalid key, server disconnect and abort the bandwidth check.
  869 + key "35c9b402c12a7246868752e2878f7e0e";
  870 + # the interval in seconds for bandwidth check,
  871 + # server donot allow new test request.
  872 + # default: 30
  873 + interval 30;
  874 + # the max available check bandwidth in kbps.
  875 + # to avoid attack of bandwidth check.
  876 + # default: 1000
  877 + limit_kbps 4000;
836 } 878 }
837 } 879 }
838 880
  881 +# set the chunk size of vhost.
  882 +vhost chunksize.srs.com {
  883 + # the default chunk size is 128, max is 65536,
  884 + # some client does not support chunk size change,
  885 + # vhost chunk size will override the global value.
  886 + # default: global chunk size.
  887 + chunk_size 128;
  888 +}
  889 +
  890 +# vhost for atc.
  891 +vhost atc.srs.com {
  892 + # vhost for atc for hls/hds/rtmp backup.
  893 + # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
  894 + # when atc is on, server delivery rtmp stream by absolute time.
  895 + # atc is used, for instance, encoder will copy stream to master and slave server,
  896 + # server use atc to delivery stream to edge/client, where stream time from master/slave server
  897 + # is always the same, client/tools can slice RTMP stream to HLS according to the same time,
  898 + # if the time not the same, the HLS stream cannot slice to support system backup.
  899 + #
  900 + # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
  901 + # @see http://www.baidu.com/#wd=hds%20hls%20atc
  902 + #
  903 + # default: off
  904 + atc on;
  905 + # whether enable the auto atc,
  906 + # if enabled, detect the bravo_atc="true" in onMetaData packet,
  907 + # set atc to on if matched.
  908 + # always ignore the onMetaData if atc_auto is off.
  909 + # default: on
  910 + atc_auto on;
  911 +}
  912 +
839 # the vhost disabled. 913 # the vhost disabled.
840 vhost removed.srs.com { 914 vhost removed.srs.com {
841 # whether the vhost is enabled. 915 # whether the vhost is enabled.
@@ -844,80 +918,6 @@ vhost removed.srs.com { @@ -844,80 +918,6 @@ vhost removed.srs.com {
844 enabled off; 918 enabled off;
845 } 919 }
846 920
847 -# the vhost with hls specified.  
848 -vhost with-hls.srs.com {  
849 - hls {  
850 - # whether the hls is enabled.  
851 - # if off, donot write hls(ts and m3u8) when publish.  
852 - # default: off  
853 - enabled on;  
854 - # the hls output path.  
855 - # the app dir is auto created under the hls_path.  
856 - # for example, for rtmp stream:  
857 - # rtmp://127.0.0.1/live/livestream  
858 - # http://127.0.0.1/live/livestream.m3u8  
859 - # where hls_path is /hls, srs will create the following files:  
860 - # /hls/live the app dir for all streams.  
861 - # /hls/live/livestream.m3u8 the HLS m3u8 file.  
862 - # /hls/live/livestream-1.ts the HLS media/ts file.  
863 - # in a word, the hls_path is for vhost.  
864 - # default: ./objs/nginx/html  
865 - hls_path ./objs/nginx/html;  
866 - # the hls fragment in seconds, the duration of a piece of ts.  
867 - # default: 10  
868 - hls_fragment 10;  
869 - # the hls window in seconds, the number of ts in m3u8.  
870 - # default: 60  
871 - hls_window 60;  
872 - }  
873 -}  
874 -# the vhost with hls disabled.  
875 -vhost no-hls.srs.com {  
876 - hls {  
877 - # whether the hls is enabled.  
878 - # if off, donot write hls(ts and m3u8) when publish.  
879 - # default: off  
880 - enabled off;  
881 - }  
882 -}  
883 -  
884 -# the vhost for min delay, donot cache any stream.  
885 -vhost min.delay.com {  
886 - # whether cache the last gop.  
887 - # if on, cache the last gop and dispatch to client,  
888 - # to enabled fast startup for client, client play immediately.  
889 - # if off, send the latest media data to client,  
890 - # client need to wait for the next Iframe to decode and show the video.  
891 - # set to off if requires min delay;  
892 - # set to on if requires client fast startup.  
893 - # default: on  
894 - gop_cache off;  
895 - # the max live queue length in seconds.  
896 - # if the messages in the queue exceed the max length,  
897 - # drop the old whole gop.  
898 - # default: 30  
899 - queue_length 10;  
900 -}  
901 -  
902 -# the vhost for antisuck.  
903 -vhost refer.anti_suck.com {  
904 - # the common refer for play and publish.  
905 - # if the page url of client not in the refer, access denied.  
906 - # if not specified this field, allow all.  
907 - # default: not specified.  
908 - refer github.com github.io;  
909 - # refer for publish clients specified.  
910 - # the common refer is not overrided by this.  
911 - # if not specified this field, allow all.  
912 - # default: not specified.  
913 - refer_publish github.com github.io;  
914 - # refer for play clients specified.  
915 - # the common refer is not overrided by this.  
916 - # if not specified this field, allow all.  
917 - # default: not specified.  
918 - refer_play github.com github.io;  
919 -}  
920 -  
921 # config for the pithy print, 921 # config for the pithy print,
922 # which always print constant message specified by interval, 922 # which always print constant message specified by interval,
923 # whatever the clients in concurrency. 923 # whatever the clients in concurrency.
  1 +# the config for srs http heartbeat, report its info to api-server
  2 +# @see full.conf for detail config.
  3 +
  4 +listen 1935;
  5 +heartbeat {
  6 + enabled on;
  7 + interval 9.3;
  8 + url http://127.0.0.1:8085/api/v1/servers;
  9 + device_id "my-srs-device";
  10 +}
  11 +vhost __defaultVhost__ {
  12 +}