ver:2.0+ r3529 44530717 2017-04-27 18:46:34
update srs2.0release to commit: ff87318b95ec8282ed17e2782724c5fa51f1b61f
正在显示
42 个修改的文件
包含
2604 行增加
和
0 行删除
conf/bandwidth.conf
0 → 100644
| 1 | +# bandwidth test tool config for srs. | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +vhost __defaultVhost__ { | ||
| 9 | +} | ||
| 10 | + | ||
| 11 | +vhost bandcheck.srs.com { | ||
| 12 | + enabled on; | ||
| 13 | + chunk_size 65000; | ||
| 14 | + bandcheck { | ||
| 15 | + enabled on; | ||
| 16 | + key "35c9b402c12a7246868752e2878f7e0e"; | ||
| 17 | + interval 30; | ||
| 18 | + limit_kbps 4000; | ||
| 19 | + } | ||
| 20 | +} |
conf/console.conf
0 → 100644
| 1 | +# no-daemon and write log to console config for srs. | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +http_api { | ||
| 9 | + enabled on; | ||
| 10 | + listen 1985; | ||
| 11 | +} | ||
| 12 | +http_server { | ||
| 13 | + enabled on; | ||
| 14 | + listen 8080; | ||
| 15 | +} | ||
| 16 | +vhost __defaultVhost__ { | ||
| 17 | +} |
conf/demo.19350.conf
0 → 100644
| 1 | +# the config for srs demo | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 19350; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon on; | ||
| 8 | +srs_log_tank file; | ||
| 9 | +srs_log_file ./objs/srs.demo.19350.log; | ||
| 10 | +pid ./objs/srs.demo.19350.pid; | ||
| 11 | + | ||
| 12 | +vhost __defaultVhost__ { | ||
| 13 | + enabled on; | ||
| 14 | + gop_cache on; | ||
| 15 | + hls { | ||
| 16 | + enabled on; | ||
| 17 | + hls_path ./objs/nginx/html/forward; | ||
| 18 | + hls_fragment 5; | ||
| 19 | + hls_window 30; | ||
| 20 | + } | ||
| 21 | +} | ||
| 22 | + |
conf/demo.conf
0 → 100644
| 1 | +# the config for srs demo | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleDemo | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon on; | ||
| 8 | +srs_log_tank file; | ||
| 9 | +srs_log_file ./objs/srs.demo.log; | ||
| 10 | +pid ./objs/srs.demo.pid; | ||
| 11 | + | ||
| 12 | +chunk_size 60000; | ||
| 13 | +max_connections 2000; | ||
| 14 | + | ||
| 15 | +http_api { | ||
| 16 | + enabled on; | ||
| 17 | + listen 1985; | ||
| 18 | +} | ||
| 19 | + | ||
| 20 | +http_server { | ||
| 21 | + enabled on; | ||
| 22 | + listen 8080; | ||
| 23 | + dir ./objs/nginx/html; | ||
| 24 | +} | ||
| 25 | + | ||
| 26 | +vhost __defaultVhost__ { | ||
| 27 | + enabled on; | ||
| 28 | + gop_cache on; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +vhost bandcheck.srs.com { | ||
| 32 | + enabled on; | ||
| 33 | + chunk_size 65000; | ||
| 34 | + bandcheck { | ||
| 35 | + enabled on; | ||
| 36 | + key "35c9b402c12a7246868752e2878f7e0e"; | ||
| 37 | + interval 30; | ||
| 38 | + limit_kbps 4000; | ||
| 39 | + } | ||
| 40 | +} | ||
| 41 | + | ||
| 42 | +vhost demo.srs.com { | ||
| 43 | + chunk_size 60000; | ||
| 44 | + enabled on; | ||
| 45 | + gop_cache on; | ||
| 46 | + queue_length 30; | ||
| 47 | + forward 127.0.0.1:19350; | ||
| 48 | + bandcheck { | ||
| 49 | + enabled off; | ||
| 50 | + } | ||
| 51 | + hls { | ||
| 52 | + enabled on; | ||
| 53 | + hls_path ./objs/nginx/html; | ||
| 54 | + hls_fragment 5; | ||
| 55 | + hls_window 30; | ||
| 56 | + } | ||
| 57 | + http_hooks { | ||
| 58 | + enabled on; | ||
| 59 | + on_connect http://127.0.0.1:8085/api/v1/clients; | ||
| 60 | + on_close http://127.0.0.1:8085/api/v1/clients; | ||
| 61 | + on_publish http://127.0.0.1:8085/api/v1/streams; | ||
| 62 | + on_unpublish http://127.0.0.1:8085/api/v1/streams; | ||
| 63 | + on_play http://127.0.0.1:8085/api/v1/sessions; | ||
| 64 | + on_stop http://127.0.0.1:8085/api/v1/sessions; | ||
| 65 | + } | ||
| 66 | + transcode { | ||
| 67 | + enabled on; | ||
| 68 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 69 | + engine ld { | ||
| 70 | + enabled on; | ||
| 71 | + vfilter { | ||
| 72 | + i ./doc/srs-logo.png; | ||
| 73 | + filter_complex 'overlay=10:10'; | ||
| 74 | + } | ||
| 75 | + vcodec libx264; | ||
| 76 | + vbitrate 300; | ||
| 77 | + vfps 20; | ||
| 78 | + vwidth 768; | ||
| 79 | + vheight 320; | ||
| 80 | + vthreads 1; | ||
| 81 | + vprofile baseline; | ||
| 82 | + vpreset superfast; | ||
| 83 | + vparams { | ||
| 84 | + } | ||
| 85 | + acodec libfdk_aac; | ||
| 86 | + abitrate 45; | ||
| 87 | + asample_rate 44100; | ||
| 88 | + achannels 2; | ||
| 89 | + aparams { | ||
| 90 | + } | ||
| 91 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 92 | + } | ||
| 93 | + engine sd { | ||
| 94 | + enabled on; | ||
| 95 | + vfilter { | ||
| 96 | + vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'; | ||
| 97 | + } | ||
| 98 | + vcodec libx264; | ||
| 99 | + vbitrate 500; | ||
| 100 | + vfps 20; | ||
| 101 | + vwidth 768; | ||
| 102 | + vheight 320; | ||
| 103 | + vthreads 1; | ||
| 104 | + vprofile main; | ||
| 105 | + vpreset fast; | ||
| 106 | + vparams { | ||
| 107 | + } | ||
| 108 | + acodec libfdk_aac; | ||
| 109 | + abitrate 40; | ||
| 110 | + asample_rate 44100; | ||
| 111 | + achannels 2; | ||
| 112 | + aparams { | ||
| 113 | + } | ||
| 114 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + ingest { | ||
| 118 | + enabled on; | ||
| 119 | + input { | ||
| 120 | + type file; | ||
| 121 | + url ./doc/source.200kbps.768x320.flv; | ||
| 122 | + } | ||
| 123 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 124 | + engine { | ||
| 125 | + enabled off; | ||
| 126 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; | ||
| 127 | + } | ||
| 128 | + } | ||
| 129 | +} | ||
| 130 | + | ||
| 131 | +vhost players { | ||
| 132 | + enabled on; | ||
| 133 | + gop_cache on; | ||
| 134 | + transcode { | ||
| 135 | + enabled on; | ||
| 136 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 137 | + engine hls { | ||
| 138 | + enabled on; | ||
| 139 | + vfilter { | ||
| 140 | + i ./doc/srs-logo.png; | ||
| 141 | + filter_complex 'overlay=10:10'; | ||
| 142 | + } | ||
| 143 | + vcodec libx264; | ||
| 144 | + vbitrate 300; | ||
| 145 | + vfps 20; | ||
| 146 | + vwidth 768; | ||
| 147 | + vheight 320; | ||
| 148 | + vthreads 1; | ||
| 149 | + vprofile baseline; | ||
| 150 | + vpreset superfast; | ||
| 151 | + vparams { | ||
| 152 | + g 100; | ||
| 153 | + } | ||
| 154 | + acodec libfdk_aac; | ||
| 155 | + abitrate 30; | ||
| 156 | + asample_rate 44100; | ||
| 157 | + achannels 2; | ||
| 158 | + aparams { | ||
| 159 | + } | ||
| 160 | + output rtmp://127.0.0.1:[port]/[app]?vhost=players_pub/[stream]; | ||
| 161 | + } | ||
| 162 | + } | ||
| 163 | + ingest { | ||
| 164 | + enabled on; | ||
| 165 | + input { | ||
| 166 | + type file; | ||
| 167 | + url ./doc/source.200kbps.768x320.flv; | ||
| 168 | + } | ||
| 169 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 170 | + engine { | ||
| 171 | + enabled off; | ||
| 172 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/demo; | ||
| 173 | + } | ||
| 174 | + } | ||
| 175 | +} | ||
| 176 | +vhost players_pub { | ||
| 177 | + hls { | ||
| 178 | + enabled on; | ||
| 179 | + hls_path ./objs/nginx/html; | ||
| 180 | + hls_fragment 5; | ||
| 181 | + hls_window 30; | ||
| 182 | + } | ||
| 183 | +} | ||
| 184 | + | ||
| 185 | +vhost players_chat { | ||
| 186 | + gop_cache off; | ||
| 187 | + hls { | ||
| 188 | + enabled off; | ||
| 189 | + } | ||
| 190 | + transcode { | ||
| 191 | + enabled on; | ||
| 192 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 193 | + engine chat_hls { | ||
| 194 | + enabled on; | ||
| 195 | + vfilter { | ||
| 196 | + } | ||
| 197 | + vcodec libx264; | ||
| 198 | + vbitrate 150; | ||
| 199 | + vfps 15; | ||
| 200 | + vwidth 576; | ||
| 201 | + vheight 240; | ||
| 202 | + vthreads 1; | ||
| 203 | + vprofile baseline; | ||
| 204 | + vpreset ultrafast; | ||
| 205 | + vparams { | ||
| 206 | + g 30; | ||
| 207 | + } | ||
| 208 | + acodec an; | ||
| 209 | + output rtmp://127.0.0.1:[port]/[app]?vhost=chat_hls/[stream]; | ||
| 210 | + } | ||
| 211 | + } | ||
| 212 | +} | ||
| 213 | +vhost chat_hls { | ||
| 214 | + hls { | ||
| 215 | + enabled on; | ||
| 216 | + hls_path ./objs/nginx/html; | ||
| 217 | + hls_fragment 2; | ||
| 218 | + hls_window 10; | ||
| 219 | + } | ||
| 220 | +} |
conf/dvr.path.conf
0 → 100644
| 1 | +# the config for srs to dvr in custom path. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path | ||
| 3 | +# @see https://github.com/ossrs/srs/wiki/v2_EN_DVR#custom-path | ||
| 4 | +# @see full.conf for detail config. | ||
| 5 | + | ||
| 6 | +listen 1935; | ||
| 7 | +max_connections 1000; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +vhost __defaultVhost__ { | ||
| 11 | + dvr { | ||
| 12 | + enabled on; | ||
| 13 | + dvr_path ./objs/nginx/html/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv; | ||
| 14 | + dvr_plan segment; | ||
| 15 | + dvr_duration 30; | ||
| 16 | + dvr_wait_keyframe on; | ||
| 17 | + } | ||
| 18 | +} |
conf/dvr.segment.conf
0 → 100644
| 1 | +# the config for srs to dvr in segment mode | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DVR | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + dvr { | ||
| 11 | + enabled on; | ||
| 12 | + dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv; | ||
| 13 | + dvr_plan segment; | ||
| 14 | + dvr_duration 30; | ||
| 15 | + dvr_wait_keyframe on; | ||
| 16 | + } | ||
| 17 | +} |
conf/dvr.session.conf
0 → 100644
| 1 | +# the config for srs to dvr in session mode | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DVR | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + dvr { | ||
| 11 | + enabled on; | ||
| 12 | + dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv; | ||
| 13 | + dvr_plan session; | ||
| 14 | + } | ||
| 15 | +} |
conf/edge.conf
0 → 100644
| 1 | +# the config for srs origin-edge cluster | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_Edge | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +pid objs/edge.pid; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +vhost __defaultVhost__ { | ||
| 11 | + mode remote; | ||
| 12 | + origin 127.0.0.1:19350; | ||
| 13 | +} |
conf/edge.token.traverse.conf
0 → 100644
| 1 | +# the config for srs for token traverse authentication | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_DRM | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935 | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + mode remote; | ||
| 11 | + origin 127.0.0.1:19350; | ||
| 12 | + token_traverse on; | ||
| 13 | +} |
conf/ffmpeg.transcode.conf
0 → 100644
| 1 | +# the config for srs use ffmpeg to transcode | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleFFMPEG | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + transcode { | ||
| 11 | + enabled on; | ||
| 12 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 13 | + engine ff { | ||
| 14 | + enabled on; | ||
| 15 | + vfilter { | ||
| 16 | + } | ||
| 17 | + vcodec libx264; | ||
| 18 | + vthreads 4; | ||
| 19 | + vprofile main; | ||
| 20 | + vpreset medium; | ||
| 21 | + vparams { | ||
| 22 | + } | ||
| 23 | + acodec libfdk_aac; | ||
| 24 | + aparams { | ||
| 25 | + } | ||
| 26 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 27 | + } | ||
| 28 | + } | ||
| 29 | +} |
conf/forward.master.conf
0 → 100644
| 1 | +# the config for srs to forward | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleForward | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +pid ./objs/srs.master.pid; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +vhost __defaultVhost__ { | ||
| 11 | + forward 127.0.0.1:19350; | ||
| 12 | +#the forward destination server type,default true. if the server is not srs server,connect app maybe fail,try config as false | ||
| 13 | + forward_server_srs true; | ||
| 14 | +} |
conf/forward.slave.conf
0 → 100644
conf/full.conf
0 → 100644
| 1 | +# all config for srs | ||
| 2 | + | ||
| 3 | +############################################################################################# | ||
| 4 | +# RTMP sections | ||
| 5 | +############################################################################################# | ||
| 6 | +# the rtmp listen ports, split by space, each listen entry is <[ip:]port> | ||
| 7 | +# for example, 192.168.1.100:1935 10.10.10.100:1935 | ||
| 8 | +# where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935 | ||
| 9 | +listen 1935; | ||
| 10 | +# the pid file | ||
| 11 | +# to ensure only one process can use a pid file | ||
| 12 | +# and provides the current running process id, for script, | ||
| 13 | +# for example, init.d script to manage the server. | ||
| 14 | +# default: ./objs/srs.pid | ||
| 15 | +pid ./objs/srs.pid; | ||
| 16 | +# the default chunk size is 128, max is 65536, | ||
| 17 | +# some client does not support chunk size change, | ||
| 18 | +# however, most clients supports it and it can improve | ||
| 19 | +# performance about 10%. | ||
| 20 | +# default: 60000 | ||
| 21 | +chunk_size 60000; | ||
| 22 | +# the logs dir. | ||
| 23 | +# if enabled ffmpeg, each stracoding stream will create a log file. | ||
| 24 | +# /dev/null to disable the log. | ||
| 25 | +# default: ./objs | ||
| 26 | +ff_log_dir ./objs; | ||
| 27 | +# the log tank, console or file. | ||
| 28 | +# if console, print log to console. | ||
| 29 | +# if file, write log to file. requires srs_log_file if log to file. | ||
| 30 | +# default: file. | ||
| 31 | +srs_log_tank file; | ||
| 32 | +# the log level, for all log tanks. | ||
| 33 | +# can be: verbose, info, trace, warn, error | ||
| 34 | +# default: trace | ||
| 35 | +srs_log_level trace; | ||
| 36 | +# when srs_log_tank is file, specifies the log file. | ||
| 37 | +# default: ./objs/srs.log | ||
| 38 | +srs_log_file ./objs/srs.log; | ||
| 39 | +# the max connections. | ||
| 40 | +# if exceed the max connections, server will drop the new connection. | ||
| 41 | +# default: 1000 | ||
| 42 | +max_connections 1000; | ||
| 43 | +# whether start as daemon | ||
| 44 | +# @remark: donot support reload. | ||
| 45 | +# default: on | ||
| 46 | +daemon on; | ||
| 47 | +# whether use utc_time to generate the time struct, | ||
| 48 | +# if off, use localtime() to generate it, | ||
| 49 | +# if on, use gmtime() instead, which use UTC time. | ||
| 50 | +# default: off | ||
| 51 | +utc_time off; | ||
| 52 | + | ||
| 53 | +# the work dir for server, to chdir(work_dir) when not empty or "./" | ||
| 54 | +# user can config this directory to change the dir. | ||
| 55 | +# @reamrk do not support reload. | ||
| 56 | +# default: ./ | ||
| 57 | +work_dir ./; | ||
| 58 | +# whether quit when parent process changed, | ||
| 59 | +# used for supervisor mode(not daemon), srs should always quit when | ||
| 60 | +# supervisor process exited. | ||
| 61 | +# @remark conflict with daemon, error when both daemon and asprocess are on. | ||
| 62 | +# @reamrk do not support reload. | ||
| 63 | +# default: off | ||
| 64 | +asprocess off; | ||
| 65 | + | ||
| 66 | +############################################################################################# | ||
| 67 | +# heartbeat/stats sections | ||
| 68 | +############################################################################################# | ||
| 69 | +# heartbeat to api server | ||
| 70 | +# @remark, the ip report to server, is retrieve from system stat, | ||
| 71 | +# which need the config item stats.network. | ||
| 72 | +heartbeat { | ||
| 73 | + # whether heartbeat is enalbed. | ||
| 74 | + # default: off | ||
| 75 | + enabled off; | ||
| 76 | + # the interval seconds for heartbeat, | ||
| 77 | + # recommend 0.3,0.6,0.9,1.2,1.5,1.8,2.1,2.4,2.7,3,...,6,9,12,.... | ||
| 78 | + # default: 9.9 | ||
| 79 | + interval 9.3; | ||
| 80 | + # when startup, srs will heartbeat to this api. | ||
| 81 | + # @remark: must be a restful http api url, where SRS will POST with following data: | ||
| 82 | + # { | ||
| 83 | + # "device_id": "my-srs-device", | ||
| 84 | + # "ip": "192.168.1.100" | ||
| 85 | + # } | ||
| 86 | + # default: http://127.0.0.1:8085/api/v1/servers | ||
| 87 | + url http://127.0.0.1:8085/api/v1/servers; | ||
| 88 | + # the id of devide. | ||
| 89 | + device_id "my-srs-device"; | ||
| 90 | + # whether report with summaries | ||
| 91 | + # if on, put /api/v1/summaries to the request data: | ||
| 92 | + # { | ||
| 93 | + # "summaries": summaries object. | ||
| 94 | + # } | ||
| 95 | + # @remark: optional config. | ||
| 96 | + # default: off | ||
| 97 | + summaries off; | ||
| 98 | +} | ||
| 99 | + | ||
| 100 | +# system statistics section. | ||
| 101 | +# the main cycle will retrieve the system stat, | ||
| 102 | +# for example, the cpu/mem/network/disk-io data, | ||
| 103 | +# the http api, for instance, /api/v1/summaries will show these data. | ||
| 104 | +# @remark the heartbeat depends on the network, | ||
| 105 | +# for example, the eth0 maybe the device which index is 0. | ||
| 106 | +stats { | ||
| 107 | + # the index of device ip. | ||
| 108 | + # we may retrieve more than one network device. | ||
| 109 | + # default: 0 | ||
| 110 | + network 0; | ||
| 111 | + # the device name to stat the disk iops. | ||
| 112 | + # ignore the device of /proc/diskstats if not configed. | ||
| 113 | + disk sda sdb xvda xvdb; | ||
| 114 | +} | ||
| 115 | + | ||
| 116 | +############################################################################################# | ||
| 117 | +# HTTP sections | ||
| 118 | +############################################################################################# | ||
| 119 | +# api of srs. | ||
| 120 | +# the http api config, export for external program to manage srs. | ||
| 121 | +# user can access http api of srs in browser directly, for instance, to access by: | ||
| 122 | +# curl http://192.168.1.170:1985/api/v1/reload | ||
| 123 | +# which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api, | ||
| 124 | +# where the cli can only be used in shell/terminate. | ||
| 125 | +http_api { | ||
| 126 | + # whether http api is enabled. | ||
| 127 | + # default: off | ||
| 128 | + enabled on; | ||
| 129 | + # the http api listen entry is <[ip:]port> | ||
| 130 | + # for example, 192.168.1.100:1985 | ||
| 131 | + # where the ip is optional, default to 0.0.0.0, that is 1985 equals to 0.0.0.0:1985 | ||
| 132 | + # default: 1985 | ||
| 133 | + listen 1985; | ||
| 134 | + # whether enable crossdomain request. | ||
| 135 | + # default: on | ||
| 136 | + crossdomain on; | ||
| 137 | +} | ||
| 138 | +# embeded http server in srs. | ||
| 139 | +# the http streaming config, for HLS/HDS/DASH/HTTPProgressive | ||
| 140 | +# global config for http streaming, user must config the http section for each vhost. | ||
| 141 | +# the embed http server used to substitute nginx in ./objs/nginx, | ||
| 142 | +# for example, srs runing in arm, can provides RTMP and HTTP service, only with srs installed. | ||
| 143 | +# user can access the http server pages, generally: | ||
| 144 | +# curl http://192.168.1.170:80/srs.html | ||
| 145 | +# which will show srs version and welcome to srs. | ||
| 146 | +# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__ | ||
| 147 | +# need to open the feature http of vhost. | ||
| 148 | +http_server { | ||
| 149 | + # whether http streaming service is enabled. | ||
| 150 | + # default: off | ||
| 151 | + enabled on; | ||
| 152 | + # the http streaming listen entry is <[ip:]port> | ||
| 153 | + # for example, 192.168.1.100:8080 | ||
| 154 | + # where the ip is optional, default to 0.0.0.0, that is 8080 equals to 0.0.0.0:8080 | ||
| 155 | + # @remark, if use lower port, for instance 80, user must start srs by root. | ||
| 156 | + # default: 8080 | ||
| 157 | + listen 8080; | ||
| 158 | + # the default dir for http root. | ||
| 159 | + # default: ./objs/nginx/html | ||
| 160 | + dir ./objs/nginx/html; | ||
| 161 | +} | ||
| 162 | + | ||
| 163 | +############################################################################################# | ||
| 164 | +# Streamer sections | ||
| 165 | +############################################################################################# | ||
| 166 | +# the streamer cast stream from other protocol to SRS over RTMP. | ||
| 167 | +# @see https://github.com/ossrs/srs/tree/develop#stream-architecture | ||
| 168 | +stream_caster { | ||
| 169 | + # whether stream caster is enabled. | ||
| 170 | + # default: off | ||
| 171 | + enabled off; | ||
| 172 | + # the caster type of stream, the casters: | ||
| 173 | + # mpegts_over_udp, MPEG-TS over UDP caster. | ||
| 174 | + # rtsp, Real Time Streaming Protocol (RTSP). | ||
| 175 | + # flv, FLV over HTTP POST. | ||
| 176 | + caster mpegts_over_udp; | ||
| 177 | + # the output rtmp url. | ||
| 178 | + # for mpegts_over_udp caster, the typically output url: | ||
| 179 | + # rtmp://127.0.0.1/live/livestream | ||
| 180 | + # for rtsp caster, the typically output url: | ||
| 181 | + # rtmp://127.0.0.1/[app]/[stream] | ||
| 182 | + # for example, the rtsp url: | ||
| 183 | + # rtsp://192.168.1.173:8544/live/livestream.sdp | ||
| 184 | + # where the [app] is "live" and [stream] is "livestream", output is: | ||
| 185 | + # rtmp://127.0.0.1/live/livestream | ||
| 186 | + output rtmp://127.0.0.1/live/livestream; | ||
| 187 | + # the listen port for stream caster. | ||
| 188 | + # for mpegts_over_udp caster, listen at udp port. for example, 8935. | ||
| 189 | + # for rtsp caster, listen at tcp port. for example, 554. | ||
| 190 | + # for flv caster, listen at tcp port. for example, 8936. | ||
| 191 | + # TODO: support listen at <[ip:]port> | ||
| 192 | + listen 8935; | ||
| 193 | + # for the rtsp caster, the rtp server local port over udp, | ||
| 194 | + # which reply the rtsp setup request message, the port will be used: | ||
| 195 | + # [rtp_port_min, rtp_port_max) | ||
| 196 | + rtp_port_min 57200; | ||
| 197 | + rtp_port_max 57300; | ||
| 198 | +} | ||
| 199 | +stream_caster { | ||
| 200 | + enabled off; | ||
| 201 | + caster mpegts_over_udp; | ||
| 202 | + output rtmp://127.0.0.1/live/livestream; | ||
| 203 | + listen 8935; | ||
| 204 | +} | ||
| 205 | +stream_caster { | ||
| 206 | + enabled off; | ||
| 207 | + caster rtsp; | ||
| 208 | + output rtmp://127.0.0.1/[app]/[stream]; | ||
| 209 | + listen 554; | ||
| 210 | + rtp_port_min 57200; | ||
| 211 | + rtp_port_max 57300; | ||
| 212 | +} | ||
| 213 | +stream_caster { | ||
| 214 | + enabled off; | ||
| 215 | + caster flv; | ||
| 216 | + output rtmp://127.0.0.1/[app]/[stream]; | ||
| 217 | + listen 8936; | ||
| 218 | +} | ||
| 219 | + | ||
| 220 | +############################################################################################# | ||
| 221 | +# RTMP/HTTP VHOST sections | ||
| 222 | +############################################################################################# | ||
| 223 | +# vhost list, the __defaultVhost__ is the default vhost | ||
| 224 | +# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream. | ||
| 225 | +# for which cannot identify the required vhost. | ||
| 226 | +vhost __defaultVhost__ { | ||
| 227 | +} | ||
| 228 | + | ||
| 229 | +# the security to allow or deny clients. | ||
| 230 | +vhost security.srs.com { | ||
| 231 | + # security for host to allow or deny clients. | ||
| 232 | + # @see https://github.com/ossrs/srs/issues/211 | ||
| 233 | + security { | ||
| 234 | + # whether enable the security for vhost. | ||
| 235 | + # default: off | ||
| 236 | + enabled on; | ||
| 237 | + # the security list, each item format as: | ||
| 238 | + # allow|deny publish|play all|<ip> | ||
| 239 | + # for example: | ||
| 240 | + # allow publish all; | ||
| 241 | + # deny publish all; | ||
| 242 | + # allow publish 127.0.0.1; | ||
| 243 | + # deny publish 127.0.0.1; | ||
| 244 | + # allow play all; | ||
| 245 | + # deny play all; | ||
| 246 | + # allow play 127.0.0.1; | ||
| 247 | + # deny play 127.0.0.1; | ||
| 248 | + # SRS apply the following simple strategies one by one: | ||
| 249 | + # 1. allow all if security disabled. | ||
| 250 | + # 2. default to deny all when security enabled. | ||
| 251 | + # 3. allow if matches allow strategy. | ||
| 252 | + # 4. deny if matches deny strategy. | ||
| 253 | + allow play all; | ||
| 254 | + allow publish all; | ||
| 255 | + } | ||
| 256 | +} | ||
| 257 | + | ||
| 258 | +# the MR(merged-read) setting for publisher. | ||
| 259 | +# the MW(merged-write) settings for player. | ||
| 260 | +vhost mrw.srs.com { | ||
| 261 | + # whether enable min delay mode for vhost. | ||
| 262 | + # for min latence mode: | ||
| 263 | + # 1. disable the mr for vhost. | ||
| 264 | + # 2. use timeout for cond wait for consumer queue. | ||
| 265 | + # @see https://github.com/ossrs/srs/issues/257 | ||
| 266 | + # default: off | ||
| 267 | + min_latency off; | ||
| 268 | + # about MR, read https://github.com/ossrs/srs/issues/241 | ||
| 269 | + mr { | ||
| 270 | + # whether enable the MR(merged-read) | ||
| 271 | + # default: off | ||
| 272 | + enabled on; | ||
| 273 | + # the latency in ms for MR(merged-read), | ||
| 274 | + # the performance+ when latency+, and memory+, | ||
| 275 | + # memory(buffer) = latency * kbps / 8 | ||
| 276 | + # for example, latency=500ms, kbps=3000kbps, each publish connection will consume | ||
| 277 | + # memory = 500 * 3000 / 8 = 187500B = 183KB | ||
| 278 | + # when there are 2500 publisher, the total memory of SRS atleast: | ||
| 279 | + # 183KB * 2500 = 446MB | ||
| 280 | + # the value recomment is [300, 2000] | ||
| 281 | + # default: 350 | ||
| 282 | + latency 350; | ||
| 283 | + } | ||
| 284 | + # set the MW(merged-write) latency in ms. | ||
| 285 | + # SRS always set mw on, so we just set the latency value. | ||
| 286 | + # the latency of stream >= mw_latency + mr_latency | ||
| 287 | + # the value recomment is [300, 1800] | ||
| 288 | + # default: 350 | ||
| 289 | + mw_latency 350; | ||
| 290 | +} | ||
| 291 | + | ||
| 292 | +# vhost for edge, edge and origin is the same vhost | ||
| 293 | +vhost same.edge.srs.com { | ||
| 294 | + # the mode of vhost, local or remote. | ||
| 295 | + # local: vhost is origin vhost, which provides stream source. | ||
| 296 | + # remote: vhost is edge vhost, which pull/push to origin. | ||
| 297 | + # default: local | ||
| 298 | + mode remote; | ||
| 299 | + # for edge(remote mode), user must specifies the origin server | ||
| 300 | + # format as: <server_name|ip>[:port] | ||
| 301 | + # @remark user can specifies multiple origin for error backup, by space, | ||
| 302 | + # for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935 | ||
| 303 | + origin 127.0.0.1:1935 localhost:1935; | ||
| 304 | + # for edge, whether open the token traverse mode, | ||
| 305 | + # if token traverse on, all connections of edge will forward to origin to check(auth), | ||
| 306 | + # it's very important for the edge to do the token auth. | ||
| 307 | + # the better way is use http callback to do the token auth by the edge, | ||
| 308 | + # but if user prefer origin check(auth), the token_traverse if better solution. | ||
| 309 | + # default: off | ||
| 310 | + token_traverse off; | ||
| 311 | +} | ||
| 312 | + | ||
| 313 | +# vhost for edge, edge transform vhost to fetch from another vhost. | ||
| 314 | +vhost transform.edge.srs.com { | ||
| 315 | + mode remote; | ||
| 316 | + origin 127.0.0.1:1935; | ||
| 317 | + # the vhost to transform for edge, | ||
| 318 | + # to fetch from the specified vhost at origin, | ||
| 319 | + # if not specified, use the current vhost of edge in origin, the variable [vhost]. | ||
| 320 | + # default: [vhost] | ||
| 321 | + vhost same.edge.srs.com; | ||
| 322 | +} | ||
| 323 | + | ||
| 324 | +# vhost for dvr | ||
| 325 | +vhost dvr.srs.com { | ||
| 326 | + # dvr RTMP stream to file, | ||
| 327 | + # start to record to file when encoder publish, | ||
| 328 | + # reap flv according by specified dvr_plan. | ||
| 329 | + dvr { | ||
| 330 | + # whether enabled dvr features | ||
| 331 | + # default: off | ||
| 332 | + enabled on; | ||
| 333 | + # the dvr plan. canbe: | ||
| 334 | + # session reap flv when session end(unpublish). | ||
| 335 | + # segment reap flv when flv duration exceed the specified dvr_duration. | ||
| 336 | + # append always append to flv file, never reap it. | ||
| 337 | + # default: session | ||
| 338 | + dvr_plan session; | ||
| 339 | + # the dvr output path. | ||
| 340 | + # we supports some variables to generate the filename. | ||
| 341 | + # [vhost], the vhost of stream. | ||
| 342 | + # [app], the app of stream. | ||
| 343 | + # [stream], the stream name of stream. | ||
| 344 | + # [2006], replace this const to current year. | ||
| 345 | + # [01], replace this const to current month. | ||
| 346 | + # [02], replace this const to current date. | ||
| 347 | + # [15], replace this const to current hour. | ||
| 348 | + # [04], repleace this const to current minute. | ||
| 349 | + # [05], repleace this const to current second. | ||
| 350 | + # [999], repleace this const to current millisecond. | ||
| 351 | + # [timestamp],replace this const to current UNIX timestamp in ms. | ||
| 352 | + # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]" | ||
| 353 | + # for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776 | ||
| 354 | + # 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename): | ||
| 355 | + # dvr_path ./objs/nginx/html; | ||
| 356 | + # => | ||
| 357 | + # dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv; | ||
| 358 | + # 2. Use stream and date as dir name, time as filename: | ||
| 359 | + # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv; | ||
| 360 | + # => | ||
| 361 | + # dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv; | ||
| 362 | + # 3. Use stream and year/month as dir name, date and time as filename: | ||
| 363 | + # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv; | ||
| 364 | + # => | ||
| 365 | + # dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv; | ||
| 366 | + # 4. Use vhost/app and year/month as dir name, stream/date/time as filename: | ||
| 367 | + # dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv; | ||
| 368 | + # => | ||
| 369 | + # dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv; | ||
| 370 | + # @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path | ||
| 371 | + # @see https://github.com/ossrs/srs/wiki/v2_EN_DVR#custom-path | ||
| 372 | + # segment,session apply it. | ||
| 373 | + # default: ./objs/nginx/html/[app]/[stream].[timestamp].flv | ||
| 374 | + dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv; | ||
| 375 | + # the duration for dvr file, reap if exeed, in seconds. | ||
| 376 | + # segment apply it. | ||
| 377 | + # session,append ignore. | ||
| 378 | + # default: 30 | ||
| 379 | + dvr_duration 30; | ||
| 380 | + # whether wait keyframe to reap segment, | ||
| 381 | + # if off, reap segment when duration exceed the dvr_duration, | ||
| 382 | + # if on, reap segment when duration exceed and got keyframe. | ||
| 383 | + # segment apply it. | ||
| 384 | + # session,append ignore. | ||
| 385 | + # default: on | ||
| 386 | + dvr_wait_keyframe on; | ||
| 387 | + # about the stream monotonically increasing: | ||
| 388 | + # 1. video timestamp is monotonically increasing, | ||
| 389 | + # 2. audio timestamp is monotonically increasing, | ||
| 390 | + # 3. video and audio timestamp is interleaved monotonically increasing. | ||
| 391 | + # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format | ||
| 392 | + # however, some encoder cannot provides this feature, please set this to off to ignore time jitter. | ||
| 393 | + # the time jitter algorithm: | ||
| 394 | + # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing. | ||
| 395 | + # 2. zero, only ensure sttream start at zero, ignore timestamp jitter. | ||
| 396 | + # 3. off, disable the time jitter algorithm, like atc. | ||
| 397 | + # apply for all dvr plan. | ||
| 398 | + # default: full | ||
| 399 | + time_jitter full; | ||
| 400 | + | ||
| 401 | + # on_dvr, never config in here, should config in http_hooks. | ||
| 402 | + # for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com | ||
| 403 | + # @read https://github.com/ossrs/srs/wiki/v2_CN_DVR#http-callback | ||
| 404 | + # @read https://github.com/ossrs/srs/wiki/v2_EN_DVR#http-callback | ||
| 405 | + } | ||
| 406 | +} | ||
| 407 | + | ||
| 408 | +# vhost for ingest | ||
| 409 | +vhost ingest.srs.com { | ||
| 410 | + # ingest file/stream/device then push to SRS over RTMP. | ||
| 411 | + # the name/id used to identify the ingest, must be unique in global. | ||
| 412 | + # ingest id is used in reload or http api management. | ||
| 413 | + ingest livestream { | ||
| 414 | + # whether enabled ingest features | ||
| 415 | + # default: off | ||
| 416 | + enabled on; | ||
| 417 | + # input file/stream/device | ||
| 418 | + # @remark only support one input. | ||
| 419 | + input { | ||
| 420 | + # the type of input. | ||
| 421 | + # can be file/stream/device, that is, | ||
| 422 | + # file: ingest file specifies by url. | ||
| 423 | + # stream: ingest stream specifeis by url. | ||
| 424 | + # device: not support yet. | ||
| 425 | + # default: file | ||
| 426 | + type file; | ||
| 427 | + # the url of file/stream. | ||
| 428 | + url ./doc/source.200kbps.768x320.flv; | ||
| 429 | + } | ||
| 430 | + # the ffmpeg | ||
| 431 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 432 | + # the transcode engine, @see all.transcode.srs.com | ||
| 433 | + # @remark, the output is specified following. | ||
| 434 | + engine { | ||
| 435 | + # @see enabled of transcode engine. | ||
| 436 | + # if disabled or vcodec/acodec not specified, use copy. | ||
| 437 | + # default: off. | ||
| 438 | + enabled off; | ||
| 439 | + # output stream. variables: | ||
| 440 | + # [vhost] current vhost which start the ingest. | ||
| 441 | + # [port] system RTMP stream port. | ||
| 442 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; | ||
| 443 | + } | ||
| 444 | + } | ||
| 445 | +} | ||
| 446 | + | ||
| 447 | +# vhost for http static and flv vod stream for each vhost. | ||
| 448 | +vhost http.static.srs.com { | ||
| 449 | + # http static vhost specified config | ||
| 450 | + http_static { | ||
| 451 | + # whether enabled the http static service for vhost. | ||
| 452 | + # default: off | ||
| 453 | + enabled on; | ||
| 454 | + # the url to mount to, | ||
| 455 | + # typical mount to [vhost]/ | ||
| 456 | + # the variables: | ||
| 457 | + # [vhost] current vhost for http server. | ||
| 458 | + # @remark the [vhost] is optional, used to mount at specified vhost. | ||
| 459 | + # @remark the http of __defaultVhost__ will override the http_server section. | ||
| 460 | + # for example: | ||
| 461 | + # mount to [vhost]/ | ||
| 462 | + # access by http://ossrs.net:8080/xxx.html | ||
| 463 | + # mount to [vhost]/hls | ||
| 464 | + # access by http://ossrs.net:8080/hls/xxx.html | ||
| 465 | + # mount to / | ||
| 466 | + # access by http://ossrs.net:8080/xxx.html | ||
| 467 | + # or by http://192.168.1.173:8080/xxx.html | ||
| 468 | + # mount to /hls | ||
| 469 | + # access by http://ossrs.net:8080/hls/xxx.html | ||
| 470 | + # or by http://192.168.1.173:8080/hls/xxx.html | ||
| 471 | + # @remark the port of http is specified by http_server section. | ||
| 472 | + # default: [vhost]/ | ||
| 473 | + mount [vhost]/hls; | ||
| 474 | + # main dir of vhost, | ||
| 475 | + # to delivery HTTP stream of this vhost. | ||
| 476 | + # default: ./objs/nginx/html | ||
| 477 | + dir ./objs/nginx/html/hls; | ||
| 478 | + } | ||
| 479 | +} | ||
| 480 | + | ||
| 481 | +# vhost for http flv/aac/mp3 live stream for each vhost. | ||
| 482 | +vhost http.remux.srs.com { | ||
| 483 | + # http flv/mp3/aac/ts stream vhost specified config | ||
| 484 | + http_remux { | ||
| 485 | + # whether enable the http live streaming service for vhost. | ||
| 486 | + # default: off | ||
| 487 | + enabled on; | ||
| 488 | + # the fast cache for audio stream(mp3/aac), | ||
| 489 | + # to cache more audio and send to client in a time to make android(weixin) happy. | ||
| 490 | + # @remark the flv/ts stream ignore it | ||
| 491 | + # @remark 0 to disable fast cache for http audio stream. | ||
| 492 | + # default: 0 | ||
| 493 | + fast_cache 30; | ||
| 494 | + # the stream mout for rtmp to remux to live streaming. | ||
| 495 | + # typical mount to [vhost]/[app]/[stream].flv | ||
| 496 | + # the variables: | ||
| 497 | + # [vhost] current vhost for http live stream. | ||
| 498 | + # [app] current app for http live stream. | ||
| 499 | + # [stream] current stream for http live stream. | ||
| 500 | + # @remark the [vhost] is optional, used to mount at specified vhost. | ||
| 501 | + # the extension: | ||
| 502 | + # .flv mount http live flv stream, use default gop cache. | ||
| 503 | + # .ts mount http live ts stream, use default gop cache. | ||
| 504 | + # .mp3 mount http live mp3 stream, ignore video and audio mp3 codec required. | ||
| 505 | + # .aac mount http live aac stream, ignore video and audio aac codec required. | ||
| 506 | + # for example: | ||
| 507 | + # mount to [vhost]/[app]/[stream].flv | ||
| 508 | + # access by http://ossrs.net:8080/live/livestream.flv | ||
| 509 | + # mount to /[app]/[stream].flv | ||
| 510 | + # access by http://ossrs.net:8080/live/livestream.flv | ||
| 511 | + # or by http://192.168.1.173:8080/live/livestream.flv | ||
| 512 | + # mount to [vhost]/[app]/[stream].mp3 | ||
| 513 | + # access by http://ossrs.net:8080/live/livestream.mp3 | ||
| 514 | + # mount to [vhost]/[app]/[stream].aac | ||
| 515 | + # access by http://ossrs.net:8080/live/livestream.aac | ||
| 516 | + # mount to [vhost]/[app]/[stream].ts | ||
| 517 | + # access by http://ossrs.net:8080/live/livestream.ts | ||
| 518 | + # @remark the port of http is specified by http_server section. | ||
| 519 | + # default: [vhost]/[app]/[stream].flv | ||
| 520 | + mount [vhost]/[app]/[stream].flv; | ||
| 521 | + # whether http stream trigger rtmp stream source when no stream available, | ||
| 522 | + # for example, when encoder has not publish stream yet, | ||
| 523 | + # user can play the http flv stream and wait for stream. | ||
| 524 | + # default: on | ||
| 525 | + hstrs on; | ||
| 526 | + } | ||
| 527 | +} | ||
| 528 | + | ||
| 529 | +# the vhost with hls specified. | ||
| 530 | +vhost with-hls.srs.com { | ||
| 531 | + hls { | ||
| 532 | + # whether the hls is enabled. | ||
| 533 | + # if off, donot write hls(ts and m3u8) when publish. | ||
| 534 | + # default: off | ||
| 535 | + enabled on; | ||
| 536 | + # the hls fragment in seconds, the duration of a piece of ts. | ||
| 537 | + # default: 10 | ||
| 538 | + hls_fragment 10; | ||
| 539 | + # the hls m3u8 target duration ratio, | ||
| 540 | + # EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init | ||
| 541 | + # EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts | ||
| 542 | + # @see https://github.com/ossrs/srs/issues/304#issuecomment-74000081 | ||
| 543 | + # default: 1.5 | ||
| 544 | + hls_td_ratio 1.5; | ||
| 545 | + # the audio overflow ratio. | ||
| 546 | + # for pure audio, the duration to reap the segment. | ||
| 547 | + # for example, the hls_fragment is 10s, hsl_aof_ratio is 2.0, | ||
| 548 | + # the segemnt will reap to 20s for pure audio. | ||
| 549 | + # default: 2.0 | ||
| 550 | + hls_aof_ratio 2.0; | ||
| 551 | + # the hls window in seconds, the number of ts in m3u8. | ||
| 552 | + # default: 60 | ||
| 553 | + hls_window 60; | ||
| 554 | + # the error strategy. canbe: | ||
| 555 | + # ignore, disable the hls. | ||
| 556 | + # disconnect, require encoder republish. | ||
| 557 | + # continue, ignore failed try to continue output hls. | ||
| 558 | + # @see https://github.com/ossrs/srs/issues/264 | ||
| 559 | + # default: continue | ||
| 560 | + hls_on_error continue; | ||
| 561 | + # the hls output path. | ||
| 562 | + # the m3u8 file is configed by hls_path/hls_m3u8_file, the default is: | ||
| 563 | + # ./objs/nginx/html/[app]/[stream].m3u8 | ||
| 564 | + # the ts file is configed by hls_path/hls_ts_file, the default is: | ||
| 565 | + # ./objs/nginx/html/[app]/[stream]-[seq].ts | ||
| 566 | + # @remark the hls_path is compatible with srs v1 config. | ||
| 567 | + # default: ./objs/nginx/html | ||
| 568 | + hls_path ./objs/nginx/html; | ||
| 569 | + # the hls m3u8 file name. | ||
| 570 | + # we supports some variables to generate the filename. | ||
| 571 | + # [vhost], the vhost of stream. | ||
| 572 | + # [app], the app of stream. | ||
| 573 | + # [stream], the stream name of stream. | ||
| 574 | + # default: [app]/[stream].m3u8 | ||
| 575 | + hls_m3u8_file [app]/[stream].m3u8; | ||
| 576 | + # the hls ts file name. | ||
| 577 | + # we supports some variables to generate the filename. | ||
| 578 | + # [vhost], the vhost of stream. | ||
| 579 | + # [app], the app of stream. | ||
| 580 | + # [stream], the stream name of stream. | ||
| 581 | + # [2006], replace this const to current year. | ||
| 582 | + # [01], replace this const to current month. | ||
| 583 | + # [02], replace this const to current date. | ||
| 584 | + # [15], replace this const to current hour. | ||
| 585 | + # [04], repleace this const to current minute. | ||
| 586 | + # [05], repleace this const to current second. | ||
| 587 | + # [999], repleace this const to current millisecond. | ||
| 588 | + # [timestamp],replace this const to current UNIX timestamp in ms. | ||
| 589 | + # [seq], the sequence number of ts. | ||
| 590 | + # @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path | ||
| 591 | + # @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#hls-config | ||
| 592 | + # default: [app]/[stream]-[seq].ts | ||
| 593 | + hls_ts_file [app]/[stream]-[seq].ts; | ||
| 594 | + # whether use floor for the hls_ts_file path generation. | ||
| 595 | + # if on, use floor(timestamp/hls_fragment) as the variable [timestamp], | ||
| 596 | + # and use enahanced algorithm to calc deviation for segment. | ||
| 597 | + # @remark when floor on, recommend the hls_segment>=2*gop. | ||
| 598 | + # default: off | ||
| 599 | + hls_ts_floor off; | ||
| 600 | + # the hls entry prefix, which is base url of ts url. | ||
| 601 | + # if specified, the ts path in m3u8 will be like: | ||
| 602 | + # http://your-server/live/livestream-0.ts | ||
| 603 | + # http://your-server/live/livestream-1.ts | ||
| 604 | + # ... | ||
| 605 | + # optional, default to empty string. | ||
| 606 | + hls_entry_prefix http://your-server; | ||
| 607 | + # the default audio codec of hls. | ||
| 608 | + # when codec changed, write the PAT/PMT table, but maybe ok util next ts. | ||
| 609 | + # so user can set the default codec for mp3. | ||
| 610 | + # the available audio codec: | ||
| 611 | + # aac, mp3, an | ||
| 612 | + # default: aac | ||
| 613 | + hls_acodec aac; | ||
| 614 | + # the default video codec of hls. | ||
| 615 | + # when codec changed, write the PAT/PMT table, but maybe ok util next ts. | ||
| 616 | + # so user can set the default codec for pure audio(without video) to vn. | ||
| 617 | + # the available video codec: | ||
| 618 | + # h264, vn | ||
| 619 | + # default: h264 | ||
| 620 | + hls_vcodec h264; | ||
| 621 | + # whether cleanup the old expired ts files. | ||
| 622 | + # default: on | ||
| 623 | + hls_cleanup on; | ||
| 624 | + # the timeout in seconds to dispose the hls, | ||
| 625 | + # dispose is to remove all hls files, m3u8 and ts files. | ||
| 626 | + # when publisher timeout dispose hls. | ||
| 627 | + # @remark 0 to disable dispose for publisher. | ||
| 628 | + # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose hls. | ||
| 629 | + # default: 0 | ||
| 630 | + hls_dispose 0; | ||
| 631 | + # the max size to notify hls, | ||
| 632 | + # to read max bytes from ts of specified cdn network, | ||
| 633 | + # @remark only used when on_hls_notify is config. | ||
| 634 | + # default: 64 | ||
| 635 | + hls_nb_notify 64; | ||
| 636 | + # whether wait keyframe to reap segment, | ||
| 637 | + # if off, reap segment when duration exceed the fragment, | ||
| 638 | + # if on, reap segment when duration exceed and got keyframe. | ||
| 639 | + # default: on | ||
| 640 | + hls_wait_keyframe on; | ||
| 641 | + | ||
| 642 | + # on_hls, never config in here, should config in http_hooks. | ||
| 643 | + # for the hls http callback, @see http_hooks.on_hls of vhost hooks.callback.srs.com | ||
| 644 | + # @read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#http-callback | ||
| 645 | + # @read https://github.com/ossrs/srs/wiki/v2_EN_DeliveryHLS#http-callback | ||
| 646 | + | ||
| 647 | + # on_hls_notify, never config in here, should config in http_hooks. | ||
| 648 | + # we support the variables to generate the notify url: | ||
| 649 | + # [app], replace with the app. | ||
| 650 | + # [stream], replace with the stream. | ||
| 651 | + # [ts_url], replace with the ts url. | ||
| 652 | + # for the hls http callback, @see http_hooks.on_hls_notify of vhost hooks.callback.srs.com | ||
| 653 | + # @read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#on-hls-notify | ||
| 654 | + # @read https://github.com/ossrs/srs/wiki/v2_EN_DeliveryHLS#on-hls-notify | ||
| 655 | + } | ||
| 656 | +} | ||
| 657 | +# the vhost with hls disabled. | ||
| 658 | +vhost no-hls.srs.com { | ||
| 659 | + hls { | ||
| 660 | + # whether the hls is enabled. | ||
| 661 | + # if off, donot write hls(ts and m3u8) when publish. | ||
| 662 | + # default: off | ||
| 663 | + enabled off; | ||
| 664 | + } | ||
| 665 | +} | ||
| 666 | + | ||
| 667 | +# the vhost with adobe hds | ||
| 668 | +vhost hds.srs.com { | ||
| 669 | + hds { | ||
| 670 | + # whether hds enabled | ||
| 671 | + # default: off | ||
| 672 | + enabled on; | ||
| 673 | + # the hds fragment in seconds. | ||
| 674 | + # default: 10 | ||
| 675 | + hds_fragment 10; | ||
| 676 | + # the hds window in seconds, erase the segment when exceed the window. | ||
| 677 | + # default: 60 | ||
| 678 | + hds_window 60; | ||
| 679 | + # the path to store the hds files. | ||
| 680 | + # default: ./objs/nginx/html | ||
| 681 | + hds_path ./objs/nginx/html; | ||
| 682 | + } | ||
| 683 | +} | ||
| 684 | + | ||
| 685 | +# the http hook callback vhost, srs will invoke the hooks for specified events. | ||
| 686 | +vhost hooks.callback.srs.com { | ||
| 687 | + http_hooks { | ||
| 688 | + # whether the http hooks enalbe. | ||
| 689 | + # default off. | ||
| 690 | + enabled on; | ||
| 691 | + # when client connect to vhost/app, call the hook, | ||
| 692 | + # the request in the POST data string is a object encode by json: | ||
| 693 | + # { | ||
| 694 | + # "action": "on_connect", | ||
| 695 | + # "client_id": 1985, | ||
| 696 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 697 | + # "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a", | ||
| 698 | + # "pageUrl": "http://www.test.com/live.html" | ||
| 699 | + # } | ||
| 700 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 701 | + # an int value specifies the error code(0 corresponding to success): | ||
| 702 | + # 0 | ||
| 703 | + # support multiple api hooks, format: | ||
| 704 | + # on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 705 | + on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients; | ||
| 706 | + # when client close/disconnect to vhost/app/stream, call the hook, | ||
| 707 | + # the request in the POST data string is a object encode by json: | ||
| 708 | + # { | ||
| 709 | + # "action": "on_close", | ||
| 710 | + # "client_id": 1985, | ||
| 711 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 712 | + # "send_bytes": 10240, "recv_bytes": 10240 | ||
| 713 | + # } | ||
| 714 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 715 | + # an int value specifies the error code(0 corresponding to success): | ||
| 716 | + # 0 | ||
| 717 | + # support multiple api hooks, format: | ||
| 718 | + # on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 719 | + on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients; | ||
| 720 | + # when client(encoder) publish to vhost/app/stream, call the hook, | ||
| 721 | + # the request in the POST data string is a object encode by json: | ||
| 722 | + # { | ||
| 723 | + # "action": "on_publish", | ||
| 724 | + # "client_id": 1985, | ||
| 725 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 726 | + # "stream": "livestream" | ||
| 727 | + # } | ||
| 728 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 729 | + # an int value specifies the error code(0 corresponding to success): | ||
| 730 | + # 0 | ||
| 731 | + # support multiple api hooks, format: | ||
| 732 | + # on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 733 | + on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams; | ||
| 734 | + # when client(encoder) stop publish to vhost/app/stream, call the hook, | ||
| 735 | + # the request in the POST data string is a object encode by json: | ||
| 736 | + # { | ||
| 737 | + # "action": "on_unpublish", | ||
| 738 | + # "client_id": 1985, | ||
| 739 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 740 | + # "stream": "livestream" | ||
| 741 | + # } | ||
| 742 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 743 | + # an int value specifies the error code(0 corresponding to success): | ||
| 744 | + # 0 | ||
| 745 | + # support multiple api hooks, format: | ||
| 746 | + # on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 747 | + on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams; | ||
| 748 | + # when client start to play vhost/app/stream, call the hook, | ||
| 749 | + # the request in the POST data string is a object encode by json: | ||
| 750 | + # { | ||
| 751 | + # "action": "on_play", | ||
| 752 | + # "client_id": 1985, | ||
| 753 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 754 | + # "stream": "livestream", | ||
| 755 | + # "pageUrl": "http://www.test.com/live.html" | ||
| 756 | + # } | ||
| 757 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 758 | + # an int value specifies the error code(0 corresponding to success): | ||
| 759 | + # 0 | ||
| 760 | + # support multiple api hooks, format: | ||
| 761 | + # on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 762 | + on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; | ||
| 763 | + # when client stop to play vhost/app/stream, call the hook, | ||
| 764 | + # the request in the POST data string is a object encode by json: | ||
| 765 | + # { | ||
| 766 | + # "action": "on_stop", | ||
| 767 | + # "client_id": 1985, | ||
| 768 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 769 | + # "stream": "livestream" | ||
| 770 | + # } | ||
| 771 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 772 | + # an int value specifies the error code(0 corresponding to success): | ||
| 773 | + # 0 | ||
| 774 | + # support multiple api hooks, format: | ||
| 775 | + # on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN | ||
| 776 | + on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; | ||
| 777 | + # when srs reap a dvr file, call the hook, | ||
| 778 | + # the request in the POST data string is a object encode by json: | ||
| 779 | + # { | ||
| 780 | + # "action": "on_dvr", | ||
| 781 | + # "client_id": 1985, | ||
| 782 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 783 | + # "stream": "livestream", | ||
| 784 | + # "cwd": "/usr/local/srs", | ||
| 785 | + # "file": "./objs/nginx/html/live/livestream.1420254068776.flv" | ||
| 786 | + # } | ||
| 787 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 788 | + # an int value specifies the error code(0 corresponding to success): | ||
| 789 | + # 0 | ||
| 790 | + on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs; | ||
| 791 | + # when srs reap a ts file of hls, call the hook, | ||
| 792 | + # the request in the POST data string is a object encode by json: | ||
| 793 | + # { | ||
| 794 | + # "action": "on_hls", | ||
| 795 | + # "client_id": 1985, | ||
| 796 | + # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live", | ||
| 797 | + # "stream": "livestream", | ||
| 798 | + # "duration": 9.36, // in seconds | ||
| 799 | + # "cwd": "/usr/local/srs", | ||
| 800 | + # "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts", | ||
| 801 | + # "url": "live/livestream/2015-04-23/01/476584165.ts", | ||
| 802 | + # "m3u8": "./objs/nginx/html/live/livestream/live.m3u8", | ||
| 803 | + # "m3u8_url": "live/livestream/live.m3u8", | ||
| 804 | + # "seq_no": 100 | ||
| 805 | + # } | ||
| 806 | + # if valid, the hook must return HTTP code 200(Stauts OK) and response | ||
| 807 | + # an int value specifies the error code(0 corresponding to success): | ||
| 808 | + # 0 | ||
| 809 | + on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls; | ||
| 810 | + # when srs reap a ts file of hls, call this hook, | ||
| 811 | + # used to push file to cdn network, by get the ts file from cdn network. | ||
| 812 | + # so we use HTTP GET and use the variable following: | ||
| 813 | + # [app], replace with the app. | ||
| 814 | + # [stream], replace with the stream. | ||
| 815 | + # [ts_url], replace with the ts url. | ||
| 816 | + # ignore any return data of server. | ||
| 817 | + # @remark random select a url to report, not report all. | ||
| 818 | + on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream][ts_url]; | ||
| 819 | + } | ||
| 820 | +} | ||
| 821 | + | ||
| 822 | +# the vhost for srs debug info, whether send args in connect(tcUrl). | ||
| 823 | +vhost debug.srs.com { | ||
| 824 | + # when upnode(forward to, edge push to, edge pull from) is srs, | ||
| 825 | + # it's strongly recommend to open the debug_srs_upnode, | ||
| 826 | + # when connect to upnode, it will take the debug info, | ||
| 827 | + # for example, the id, source id, pid. | ||
| 828 | + # please see: https://github.com/ossrs/srs/wiki/v1_CN_SrsLog | ||
| 829 | + # default: on | ||
| 830 | + debug_srs_upnode on; | ||
| 831 | +} | ||
| 832 | + | ||
| 833 | +# the vhost for min delay, donot cache any stream. | ||
| 834 | +vhost min.delay.com { | ||
| 835 | + # @see vhost mrw.srs.com for detail. | ||
| 836 | + min_latency on; | ||
| 837 | + mr { | ||
| 838 | + enabled off; | ||
| 839 | + } | ||
| 840 | + mw_latency 100; | ||
| 841 | + # whether cache the last gop. | ||
| 842 | + # if on, cache the last gop and dispatch to client, | ||
| 843 | + # to enabled fast startup for client, client play immediately. | ||
| 844 | + # if off, send the latest media data to client, | ||
| 845 | + # client need to wait for the next Iframe to decode and show the video. | ||
| 846 | + # set to off if requires min delay; | ||
| 847 | + # set to on if requires client fast startup. | ||
| 848 | + # default: on | ||
| 849 | + gop_cache off; | ||
| 850 | + # the max live queue length in seconds. | ||
| 851 | + # if the messages in the queue exceed the max length, | ||
| 852 | + # drop the old whole gop. | ||
| 853 | + # default: 30 | ||
| 854 | + queue_length 10; | ||
| 855 | + # whether enable the TCP_NODELAY | ||
| 856 | + # if on, set the nodelay of fd by setsockopt | ||
| 857 | + # default: off | ||
| 858 | + tcp_nodelay on; | ||
| 859 | +} | ||
| 860 | + | ||
| 861 | +# whether disable the sps parse, for the resolution of video. | ||
| 862 | +vhost no.parse.sps.com { | ||
| 863 | + publish { | ||
| 864 | + # whether parse the sps when publish stream. | ||
| 865 | + # we can got the resolution of video for stat api. | ||
| 866 | + # but we may failed to cause publish failed. | ||
| 867 | + # default: on | ||
| 868 | + parse_sps on; | ||
| 869 | + } | ||
| 870 | +} | ||
| 871 | + | ||
| 872 | +# the vhost to control the stream delivery feature | ||
| 873 | +vhost stream.control.com { | ||
| 874 | + # @see vhost mrw.srs.com for detail. | ||
| 875 | + min_latency on; | ||
| 876 | + mr { | ||
| 877 | + enabled off; | ||
| 878 | + } | ||
| 879 | + mw_latency 100; | ||
| 880 | + # @see vhost min.delay.com | ||
| 881 | + queue_length 10; | ||
| 882 | + tcp_nodelay on; | ||
| 883 | + # the minimal packets send interval in ms, | ||
| 884 | + # used to control the ndiff of stream by srs_rtmp_dump, | ||
| 885 | + # for example, some device can only accept some stream which | ||
| 886 | + # delivery packets in constant interval(not cbr). | ||
| 887 | + # @remark 0 to disable the minimal interval. | ||
| 888 | + # @remark >0 to make the srs to send message one by one. | ||
| 889 | + # @remark user can get the right packets interval in ms by srs_rtmp_dump. | ||
| 890 | + # default: 0 | ||
| 891 | + send_min_interval 10.0; | ||
| 892 | + # whether reduce the sequence header, | ||
| 893 | + # for some client which cannot got duplicated sequence header, | ||
| 894 | + # while the sequence header is not changed yet. | ||
| 895 | + # default: off | ||
| 896 | + reduce_sequence_header on; | ||
| 897 | + # the 1st packet timeout in ms for encoder. | ||
| 898 | + # default: 20000 | ||
| 899 | + publish_1stpkt_timeout 20000; | ||
| 900 | + # the normal packet timeout in ms for encoder. | ||
| 901 | + # default: 5000 | ||
| 902 | + publish_normal_timeout 7000; | ||
| 903 | +} | ||
| 904 | + | ||
| 905 | +# the vhost for antisuck. | ||
| 906 | +vhost refer.anti_suck.com { | ||
| 907 | + # the common refer for play and publish. | ||
| 908 | + # if the page url of client not in the refer, access denied. | ||
| 909 | + # if not specified this field, allow all. | ||
| 910 | + # default: not specified. | ||
| 911 | + refer github.com github.io; | ||
| 912 | + # refer for publish clients specified. | ||
| 913 | + # the common refer is not overrided by this. | ||
| 914 | + # if not specified this field, allow all. | ||
| 915 | + # default: not specified. | ||
| 916 | + refer_publish github.com github.io; | ||
| 917 | + # refer for play clients specified. | ||
| 918 | + # the common refer is not overrided by this. | ||
| 919 | + # if not specified this field, allow all. | ||
| 920 | + # default: not specified. | ||
| 921 | + refer_play github.com github.io; | ||
| 922 | +} | ||
| 923 | + | ||
| 924 | +# the vhost which forward publish streams. | ||
| 925 | +vhost same.vhost.forward.srs.com { | ||
| 926 | + # forward all publish stream to the specified server. | ||
| 927 | + # this used to split/forward the current stream for cluster active-standby, | ||
| 928 | + # active-active for cdn to build high available fault tolerance system. | ||
| 929 | + # format: {ip}:{port} {ip_N}:{port_N} | ||
| 930 | + forward 127.0.0.1:1936 127.0.0.1:1937; | ||
| 931 | +} | ||
| 932 | + | ||
| 933 | +# the main comments for transcode | ||
| 934 | +vhost example.transcode.srs.com { | ||
| 935 | + # the streaming transcode configs. | ||
| 936 | + transcode { | ||
| 937 | + # whether the transcode enabled. | ||
| 938 | + # if off, donot transcode. | ||
| 939 | + # default: off. | ||
| 940 | + enabled on; | ||
| 941 | + # the ffmpeg | ||
| 942 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 943 | + # the transcode engine for matched stream. | ||
| 944 | + # all matched stream will transcoded to the following stream. | ||
| 945 | + # the transcode set name(ie. hd) is optional and not used. | ||
| 946 | + engine example { | ||
| 947 | + # whether the engine is enabled | ||
| 948 | + # default: off. | ||
| 949 | + enabled on; | ||
| 950 | + # input format, can be: | ||
| 951 | + # off, do not specifies the format, ffmpeg will guess it. | ||
| 952 | + # flv, for flv or RTMP stream. | ||
| 953 | + # other format, for example, mp4/aac whatever. | ||
| 954 | + # default: flv | ||
| 955 | + iformat flv; | ||
| 956 | + # ffmpeg filters, follows the main input. | ||
| 957 | + vfilter { | ||
| 958 | + # the logo input file. | ||
| 959 | + i ./doc/ffmpeg-logo.png; | ||
| 960 | + # the ffmpeg complex filter. | ||
| 961 | + # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html | ||
| 962 | + filter_complex 'overlay=10:10'; | ||
| 963 | + } | ||
| 964 | + # video encoder name. can be: | ||
| 965 | + # libx264: use h.264(libx264) video encoder. | ||
| 966 | + # copy: donot encoder the video stream, copy it. | ||
| 967 | + # vn: disable video output. | ||
| 968 | + vcodec libx264; | ||
| 969 | + # video bitrate, in kbps | ||
| 970 | + # @remark 0 to use source video bitrate. | ||
| 971 | + # default: 0 | ||
| 972 | + vbitrate 1500; | ||
| 973 | + # video framerate. | ||
| 974 | + # @remark 0 to use source video fps. | ||
| 975 | + # default: 0 | ||
| 976 | + vfps 25; | ||
| 977 | + # video width, must be even numbers. | ||
| 978 | + # @remark 0 to use source video width. | ||
| 979 | + # default: 0 | ||
| 980 | + vwidth 768; | ||
| 981 | + # video height, must be even numbers. | ||
| 982 | + # @remark 0 to use source video height. | ||
| 983 | + # default: 0 | ||
| 984 | + vheight 320; | ||
| 985 | + # the max threads for ffmpeg to used. | ||
| 986 | + # default: 1 | ||
| 987 | + vthreads 12; | ||
| 988 | + # x264 profile, @see x264 -help, can be: | ||
| 989 | + # high,main,baseline | ||
| 990 | + vprofile main; | ||
| 991 | + # x264 preset, @see x264 -help, can be: | ||
| 992 | + # ultrafast,superfast,veryfast,faster,fast | ||
| 993 | + # medium,slow,slower,veryslow,placebo | ||
| 994 | + vpreset medium; | ||
| 995 | + # other x264 or ffmpeg video params | ||
| 996 | + vparams { | ||
| 997 | + # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html | ||
| 998 | + t 100; | ||
| 999 | + # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264 | ||
| 1000 | + coder 1; | ||
| 1001 | + b_strategy 2; | ||
| 1002 | + bf 3; | ||
| 1003 | + refs 10; | ||
| 1004 | + } | ||
| 1005 | + # audio encoder name. can be: | ||
| 1006 | + # libfdk_aac: use aac(libfdk_aac) audio encoder. | ||
| 1007 | + # copy: donot encoder the audio stream, copy it. | ||
| 1008 | + # an: disable audio output. | ||
| 1009 | + acodec libfdk_aac; | ||
| 1010 | + # audio bitrate, in kbps. [16, 72] for libfdk_aac. | ||
| 1011 | + # @remark 0 to use source audio bitrate. | ||
| 1012 | + # default: 0 | ||
| 1013 | + abitrate 70; | ||
| 1014 | + # audio sample rate. for flv/rtmp, it must be: | ||
| 1015 | + # 44100,22050,11025,5512 | ||
| 1016 | + # @remark 0 to use source audio sample rate. | ||
| 1017 | + # default: 0 | ||
| 1018 | + asample_rate 44100; | ||
| 1019 | + # audio channel, 1 for mono, 2 for stereo. | ||
| 1020 | + # @remark 0 to use source audio channels. | ||
| 1021 | + # default: 0 | ||
| 1022 | + achannels 2; | ||
| 1023 | + # other ffmpeg audio params | ||
| 1024 | + aparams { | ||
| 1025 | + # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders | ||
| 1026 | + # @remark SRS supported aac profile for HLS is: aac_low, aac_he, aac_he_v2 | ||
| 1027 | + profile:a aac_low; | ||
| 1028 | + bsf:a aac_adtstoasc; | ||
| 1029 | + } | ||
| 1030 | + # output format, can be: | ||
| 1031 | + # off, do not specifies the format, ffmpeg will guess it. | ||
| 1032 | + # flv, for flv or RTMP stream. | ||
| 1033 | + # other format, for example, mp4/aac whatever. | ||
| 1034 | + # default: flv | ||
| 1035 | + oformat flv; | ||
| 1036 | + # output stream. variables: | ||
| 1037 | + # [vhost] the input stream vhost. | ||
| 1038 | + # [port] the intput stream port. | ||
| 1039 | + # [app] the input stream app. | ||
| 1040 | + # [stream] the input stream name. | ||
| 1041 | + # [engine] the tanscode engine name. | ||
| 1042 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1043 | + } | ||
| 1044 | + } | ||
| 1045 | +} | ||
| 1046 | +# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction | ||
| 1047 | +vhost mirror.transcode.srs.com { | ||
| 1048 | + transcode { | ||
| 1049 | + enabled on; | ||
| 1050 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1051 | + engine mirror { | ||
| 1052 | + enabled on; | ||
| 1053 | + vfilter { | ||
| 1054 | + vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2'; | ||
| 1055 | + } | ||
| 1056 | + vcodec libx264; | ||
| 1057 | + vbitrate 300; | ||
| 1058 | + vfps 20; | ||
| 1059 | + vwidth 768; | ||
| 1060 | + vheight 320; | ||
| 1061 | + vthreads 2; | ||
| 1062 | + vprofile baseline; | ||
| 1063 | + vpreset superfast; | ||
| 1064 | + vparams { | ||
| 1065 | + } | ||
| 1066 | + acodec libfdk_aac; | ||
| 1067 | + abitrate 45; | ||
| 1068 | + asample_rate 44100; | ||
| 1069 | + achannels 2; | ||
| 1070 | + aparams { | ||
| 1071 | + } | ||
| 1072 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1073 | + } | ||
| 1074 | + } | ||
| 1075 | +} | ||
| 1076 | +# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1 | ||
| 1077 | +# remark: we remove the libfreetype which always cause build failed, you must add it manual if needed. | ||
| 1078 | +####################################################################################################### | ||
| 1079 | +# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop | ||
| 1080 | +vhost crop.transcode.srs.com { | ||
| 1081 | + transcode { | ||
| 1082 | + enabled on; | ||
| 1083 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1084 | + engine crop { | ||
| 1085 | + enabled on; | ||
| 1086 | + vfilter { | ||
| 1087 | + vf 'crop=in_w-20:in_h-160:10:80'; | ||
| 1088 | + } | ||
| 1089 | + vcodec libx264; | ||
| 1090 | + vbitrate 300; | ||
| 1091 | + vfps 20; | ||
| 1092 | + vwidth 768; | ||
| 1093 | + vheight 320; | ||
| 1094 | + vthreads 2; | ||
| 1095 | + vprofile baseline; | ||
| 1096 | + vpreset superfast; | ||
| 1097 | + vparams { | ||
| 1098 | + } | ||
| 1099 | + acodec libfdk_aac; | ||
| 1100 | + abitrate 45; | ||
| 1101 | + asample_rate 44100; | ||
| 1102 | + achannels 2; | ||
| 1103 | + aparams { | ||
| 1104 | + } | ||
| 1105 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1106 | + } | ||
| 1107 | + } | ||
| 1108 | +} | ||
| 1109 | +# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay | ||
| 1110 | +vhost logo.transcode.srs.com { | ||
| 1111 | + transcode { | ||
| 1112 | + enabled on; | ||
| 1113 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1114 | + engine logo { | ||
| 1115 | + enabled on; | ||
| 1116 | + vfilter { | ||
| 1117 | + i ./doc/ffmpeg-logo.png; | ||
| 1118 | + filter_complex 'overlay=10:10'; | ||
| 1119 | + } | ||
| 1120 | + vcodec libx264; | ||
| 1121 | + vbitrate 300; | ||
| 1122 | + vfps 20; | ||
| 1123 | + vwidth 768; | ||
| 1124 | + vheight 320; | ||
| 1125 | + vthreads 2; | ||
| 1126 | + vprofile baseline; | ||
| 1127 | + vpreset superfast; | ||
| 1128 | + vparams { | ||
| 1129 | + } | ||
| 1130 | + acodec libfdk_aac; | ||
| 1131 | + abitrate 45; | ||
| 1132 | + asample_rate 44100; | ||
| 1133 | + achannels 2; | ||
| 1134 | + aparams { | ||
| 1135 | + } | ||
| 1136 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1137 | + } | ||
| 1138 | + } | ||
| 1139 | +} | ||
| 1140 | +# audio transcode only. | ||
| 1141 | +# for example, FMLE publish audio codec in mp3, and donot support HLS output, | ||
| 1142 | +# we can transcode the audio to aac and copy video to the new stream with HLS. | ||
| 1143 | +vhost audio.transcode.srs.com { | ||
| 1144 | + transcode { | ||
| 1145 | + enabled on; | ||
| 1146 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1147 | + engine acodec { | ||
| 1148 | + enabled on; | ||
| 1149 | + vcodec copy; | ||
| 1150 | + acodec libfdk_aac; | ||
| 1151 | + abitrate 45; | ||
| 1152 | + asample_rate 44100; | ||
| 1153 | + achannels 2; | ||
| 1154 | + aparams { | ||
| 1155 | + } | ||
| 1156 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1157 | + } | ||
| 1158 | + } | ||
| 1159 | +} | ||
| 1160 | +# disable video, transcode/copy audio. | ||
| 1161 | +# for example, publish pure audio stream. | ||
| 1162 | +vhost vn.transcode.srs.com { | ||
| 1163 | + transcode { | ||
| 1164 | + enabled on; | ||
| 1165 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1166 | + engine vn { | ||
| 1167 | + enabled on; | ||
| 1168 | + vcodec vn; | ||
| 1169 | + acodec libfdk_aac; | ||
| 1170 | + abitrate 45; | ||
| 1171 | + asample_rate 44100; | ||
| 1172 | + achannels 2; | ||
| 1173 | + aparams { | ||
| 1174 | + } | ||
| 1175 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1176 | + } | ||
| 1177 | + } | ||
| 1178 | +} | ||
| 1179 | +# ffmpeg-copy(forward implements by ffmpeg). | ||
| 1180 | +# copy the video and audio to a new stream. | ||
| 1181 | +vhost copy.transcode.srs.com { | ||
| 1182 | + transcode { | ||
| 1183 | + enabled on; | ||
| 1184 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1185 | + engine copy { | ||
| 1186 | + enabled on; | ||
| 1187 | + vcodec copy; | ||
| 1188 | + acodec copy; | ||
| 1189 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1190 | + } | ||
| 1191 | + } | ||
| 1192 | +} | ||
| 1193 | +# transcode all app and stream of vhost | ||
| 1194 | +# the comments, read example.transcode.srs.com | ||
| 1195 | +vhost all.transcode.srs.com { | ||
| 1196 | + transcode { | ||
| 1197 | + enabled on; | ||
| 1198 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1199 | + engine ffsuper { | ||
| 1200 | + enabled on; | ||
| 1201 | + iformat flv; | ||
| 1202 | + vfilter { | ||
| 1203 | + i ./doc/ffmpeg-logo.png; | ||
| 1204 | + filter_complex 'overlay=10:10'; | ||
| 1205 | + } | ||
| 1206 | + vcodec libx264; | ||
| 1207 | + vbitrate 1500; | ||
| 1208 | + vfps 25; | ||
| 1209 | + vwidth 768; | ||
| 1210 | + vheight 320; | ||
| 1211 | + vthreads 12; | ||
| 1212 | + vprofile main; | ||
| 1213 | + vpreset medium; | ||
| 1214 | + vparams { | ||
| 1215 | + t 100; | ||
| 1216 | + coder 1; | ||
| 1217 | + b_strategy 2; | ||
| 1218 | + bf 3; | ||
| 1219 | + refs 10; | ||
| 1220 | + } | ||
| 1221 | + acodec libfdk_aac; | ||
| 1222 | + abitrate 70; | ||
| 1223 | + asample_rate 44100; | ||
| 1224 | + achannels 2; | ||
| 1225 | + aparams { | ||
| 1226 | + profile:a aac_low; | ||
| 1227 | + } | ||
| 1228 | + oformat flv; | ||
| 1229 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1230 | + } | ||
| 1231 | + engine ffhd { | ||
| 1232 | + enabled on; | ||
| 1233 | + vcodec libx264; | ||
| 1234 | + vbitrate 1200; | ||
| 1235 | + vfps 25; | ||
| 1236 | + vwidth 1382; | ||
| 1237 | + vheight 576; | ||
| 1238 | + vthreads 6; | ||
| 1239 | + vprofile main; | ||
| 1240 | + vpreset medium; | ||
| 1241 | + vparams { | ||
| 1242 | + } | ||
| 1243 | + acodec libfdk_aac; | ||
| 1244 | + abitrate 70; | ||
| 1245 | + asample_rate 44100; | ||
| 1246 | + achannels 2; | ||
| 1247 | + aparams { | ||
| 1248 | + } | ||
| 1249 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1250 | + } | ||
| 1251 | + engine ffsd { | ||
| 1252 | + enabled on; | ||
| 1253 | + vcodec libx264; | ||
| 1254 | + vbitrate 800; | ||
| 1255 | + vfps 25; | ||
| 1256 | + vwidth 1152; | ||
| 1257 | + vheight 480; | ||
| 1258 | + vthreads 4; | ||
| 1259 | + vprofile main; | ||
| 1260 | + vpreset fast; | ||
| 1261 | + vparams { | ||
| 1262 | + } | ||
| 1263 | + acodec libfdk_aac; | ||
| 1264 | + abitrate 60; | ||
| 1265 | + asample_rate 44100; | ||
| 1266 | + achannels 2; | ||
| 1267 | + aparams { | ||
| 1268 | + } | ||
| 1269 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1270 | + } | ||
| 1271 | + engine fffast { | ||
| 1272 | + enabled on; | ||
| 1273 | + vcodec libx264; | ||
| 1274 | + vbitrate 300; | ||
| 1275 | + vfps 20; | ||
| 1276 | + vwidth 768; | ||
| 1277 | + vheight 320; | ||
| 1278 | + vthreads 2; | ||
| 1279 | + vprofile baseline; | ||
| 1280 | + vpreset superfast; | ||
| 1281 | + vparams { | ||
| 1282 | + } | ||
| 1283 | + acodec libfdk_aac; | ||
| 1284 | + abitrate 45; | ||
| 1285 | + asample_rate 44100; | ||
| 1286 | + achannels 2; | ||
| 1287 | + aparams { | ||
| 1288 | + } | ||
| 1289 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1290 | + } | ||
| 1291 | + engine vcopy { | ||
| 1292 | + enabled on; | ||
| 1293 | + vcodec copy; | ||
| 1294 | + acodec libfdk_aac; | ||
| 1295 | + abitrate 45; | ||
| 1296 | + asample_rate 44100; | ||
| 1297 | + achannels 2; | ||
| 1298 | + aparams { | ||
| 1299 | + } | ||
| 1300 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1301 | + } | ||
| 1302 | + engine acopy { | ||
| 1303 | + enabled on; | ||
| 1304 | + vcodec libx264; | ||
| 1305 | + vbitrate 300; | ||
| 1306 | + vfps 20; | ||
| 1307 | + vwidth 768; | ||
| 1308 | + vheight 320; | ||
| 1309 | + vthreads 2; | ||
| 1310 | + vprofile baseline; | ||
| 1311 | + vpreset superfast; | ||
| 1312 | + vparams { | ||
| 1313 | + } | ||
| 1314 | + acodec copy; | ||
| 1315 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1316 | + } | ||
| 1317 | + engine copy { | ||
| 1318 | + enabled on; | ||
| 1319 | + vcodec copy; | ||
| 1320 | + acodec copy; | ||
| 1321 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1322 | + } | ||
| 1323 | + } | ||
| 1324 | +} | ||
| 1325 | +# transcode all stream using the empty ffmpeg demo, donothing. | ||
| 1326 | +vhost ffempty.transcode.srs.com { | ||
| 1327 | + transcode { | ||
| 1328 | + enabled on; | ||
| 1329 | + ffmpeg ./objs/research/ffempty; | ||
| 1330 | + engine empty { | ||
| 1331 | + enabled on; | ||
| 1332 | + vcodec libx264; | ||
| 1333 | + vbitrate 300; | ||
| 1334 | + vfps 20; | ||
| 1335 | + vwidth 768; | ||
| 1336 | + vheight 320; | ||
| 1337 | + vthreads 2; | ||
| 1338 | + vprofile baseline; | ||
| 1339 | + vpreset superfast; | ||
| 1340 | + vparams { | ||
| 1341 | + } | ||
| 1342 | + acodec libfdk_aac; | ||
| 1343 | + abitrate 45; | ||
| 1344 | + asample_rate 44100; | ||
| 1345 | + achannels 2; | ||
| 1346 | + aparams { | ||
| 1347 | + } | ||
| 1348 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 1349 | + } | ||
| 1350 | + } | ||
| 1351 | +} | ||
| 1352 | +# transcode all app and stream of app | ||
| 1353 | +vhost app.transcode.srs.com { | ||
| 1354 | + # the streaming transcode configs. | ||
| 1355 | + # if app specified, transcode all streams of app. | ||
| 1356 | + transcode live { | ||
| 1357 | + enabled on; | ||
| 1358 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1359 | + engine { | ||
| 1360 | + enabled off; | ||
| 1361 | + } | ||
| 1362 | + } | ||
| 1363 | +} | ||
| 1364 | +# transcode specified stream. | ||
| 1365 | +vhost stream.transcode.srs.com { | ||
| 1366 | + # the streaming transcode configs. | ||
| 1367 | + # if stream specified, transcode the matched stream. | ||
| 1368 | + transcode live/livestream { | ||
| 1369 | + enabled on; | ||
| 1370 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 1371 | + engine { | ||
| 1372 | + enabled off; | ||
| 1373 | + } | ||
| 1374 | + } | ||
| 1375 | +} | ||
| 1376 | + | ||
| 1377 | +# vhost for bandwidth check | ||
| 1378 | +# generally, the bandcheck vhost must be: bandcheck.srs.com, | ||
| 1379 | +# or need to modify the vhost of client. | ||
| 1380 | +vhost bandcheck.srs.com { | ||
| 1381 | + enabled on; | ||
| 1382 | + chunk_size 65000; | ||
| 1383 | + # bandwidth check config. | ||
| 1384 | + bandcheck { | ||
| 1385 | + # whether support bandwidth check, | ||
| 1386 | + # default: off. | ||
| 1387 | + enabled on; | ||
| 1388 | + # the key for server to valid, | ||
| 1389 | + # if invalid key, server disconnect and abort the bandwidth check. | ||
| 1390 | + key "35c9b402c12a7246868752e2878f7e0e"; | ||
| 1391 | + # the interval in seconds for bandwidth check, | ||
| 1392 | + # server donot allow new test request. | ||
| 1393 | + # default: 30 | ||
| 1394 | + interval 30; | ||
| 1395 | + # the max available check bandwidth in kbps. | ||
| 1396 | + # to avoid attack of bandwidth check. | ||
| 1397 | + # default: 1000 | ||
| 1398 | + limit_kbps 4000; | ||
| 1399 | + } | ||
| 1400 | +} | ||
| 1401 | + | ||
| 1402 | +# set the chunk size of vhost. | ||
| 1403 | +vhost chunksize.srs.com { | ||
| 1404 | + # the default chunk size is 128, max is 65536, | ||
| 1405 | + # some client does not support chunk size change, | ||
| 1406 | + # vhost chunk size will override the global value. | ||
| 1407 | + # default: global chunk size. | ||
| 1408 | + chunk_size 128; | ||
| 1409 | +} | ||
| 1410 | + | ||
| 1411 | +# vhost for time jitter | ||
| 1412 | +vhost jitter.srs.com { | ||
| 1413 | + # about the stream monotonically increasing: | ||
| 1414 | + # 1. video timestamp is monotonically increasing, | ||
| 1415 | + # 2. audio timestamp is monotonically increasing, | ||
| 1416 | + # 3. video and audio timestamp is interleaved/mixed monotonically increasing. | ||
| 1417 | + # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format | ||
| 1418 | + # however, some encoder cannot provides this feature, please set this to off to ignore time jitter. | ||
| 1419 | + # the time jitter algorithm: | ||
| 1420 | + # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing. | ||
| 1421 | + # 2. zero, only ensure sttream start at zero, ignore timestamp jitter. | ||
| 1422 | + # 3. off, disable the time jitter algorithm, like atc. | ||
| 1423 | + # default: full | ||
| 1424 | + time_jitter full; | ||
| 1425 | + # whether use the interleaved/mixed algorithm to correct the timestamp. | ||
| 1426 | + # if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase. | ||
| 1427 | + # if off, use time_jitter to correct the timestamp if required. | ||
| 1428 | + # default: off | ||
| 1429 | + mix_correct off; | ||
| 1430 | +} | ||
| 1431 | + | ||
| 1432 | +# vhost for atc. | ||
| 1433 | +vhost atc.srs.com { | ||
| 1434 | + # vhost for atc for hls/hds/rtmp backup. | ||
| 1435 | + # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0. | ||
| 1436 | + # when atc is on, server delivery rtmp stream by absolute time. | ||
| 1437 | + # atc is used, for instance, encoder will copy stream to master and slave server, | ||
| 1438 | + # server use atc to delivery stream to edge/client, where stream time from master/slave server | ||
| 1439 | + # is always the same, client/tools can slice RTMP stream to HLS according to the same time, | ||
| 1440 | + # if the time not the same, the HLS stream cannot slice to support system backup. | ||
| 1441 | + # | ||
| 1442 | + # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html | ||
| 1443 | + # @see http://www.baidu.com/#wd=hds%20hls%20atc | ||
| 1444 | + # | ||
| 1445 | + # default: off | ||
| 1446 | + atc on; | ||
| 1447 | + # whether enable the auto atc, | ||
| 1448 | + # if enabled, detect the bravo_atc="true" in onMetaData packet, | ||
| 1449 | + # set atc to on if matched. | ||
| 1450 | + # always ignore the onMetaData if atc_auto is off. | ||
| 1451 | + # default: on | ||
| 1452 | + atc_auto on; | ||
| 1453 | +} | ||
| 1454 | + | ||
| 1455 | +# the vhost disabled. | ||
| 1456 | +vhost removed.srs.com { | ||
| 1457 | + # whether the vhost is enabled. | ||
| 1458 | + # if off, all request access denied. | ||
| 1459 | + # default: on | ||
| 1460 | + enabled off; | ||
| 1461 | +} | ||
| 1462 | + | ||
| 1463 | +# config for the pithy print, | ||
| 1464 | +# which always print constant message specified by interval, | ||
| 1465 | +# whatever the clients in concurrency. | ||
| 1466 | +# default: 10000 | ||
| 1467 | +pithy_print_ms 10000; |
conf/hds.conf
0 → 100644
| 1 | +# the config for srs to delivery hds | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHDS | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | + | ||
| 10 | +vhost __defaultVhost__ { | ||
| 11 | + hds { | ||
| 12 | + enabled on; | ||
| 13 | + hds_fragment 10; | ||
| 14 | + hds_window 60; | ||
| 15 | + hds_path ./objs/nginx/html; | ||
| 16 | + } | ||
| 17 | +} |
conf/hls.conf
0 → 100644
| 1 | +# the config for srs to delivery hls | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHLS | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + hls { | ||
| 11 | + enabled on; | ||
| 12 | + hls_fragment 10; | ||
| 13 | + hls_window 60; | ||
| 14 | + hls_path ./objs/nginx/html; | ||
| 15 | + hls_m3u8_file [app]/[stream].m3u8; | ||
| 16 | + hls_ts_file [app]/[stream]-[seq].ts; | ||
| 17 | + } | ||
| 18 | +} |
conf/hls_total.conf
0 → 100644
| 1 | +# the config for srs to delivery hls | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHLS | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +vhost __defaultVhost__ { | ||
| 8 | + hls { | ||
| 9 | + enabled on; | ||
| 10 | + hls_fragment 10; | ||
| 11 | + hls_window 60; | ||
| 12 | + hls_path ./objs/nginx/html; | ||
| 13 | + hls_m3u8_file [app]/[stream]/index.m3u8; | ||
| 14 | + hls_ts_file [app]/[stream]/[seq].ts; | ||
| 15 | +#if not configured,don't save total m3u8 file,and keep the ts cleaned | ||
| 16 | + hls_total_m3u8_file [app]/[stream]/total.m3u8; | ||
| 17 | +#if not configured,don't save total duration file | ||
| 18 | + hls_total_file [app]/[stream]/total; | ||
| 19 | + } | ||
| 20 | +} |
conf/http.aac.live.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to aac live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +vhost __defaultVhost__ { | ||
| 15 | + http_remux { | ||
| 16 | + enabled on; | ||
| 17 | + fast_cache 30; | ||
| 18 | + mount [vhost]/[app]/[stream].aac; | ||
| 19 | + hstrs on; | ||
| 20 | + | ||
| 21 | + } | ||
| 22 | +} |
conf/http.flv.live.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to flv live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +vhost __defaultVhost__ { | ||
| 15 | + http_remux { | ||
| 16 | + enabled on; | ||
| 17 | + mount [vhost]/[app]/[stream].flv; | ||
| 18 | + hstrs on; | ||
| 19 | + } | ||
| 20 | +} |
conf/http.flv.live.edge1.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to flv live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 19351; | ||
| 6 | +max_connections 1000; | ||
| 7 | +pid objs/srs.flv.19351.pid; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +http_server { | ||
| 11 | + enabled on; | ||
| 12 | + listen 8081; | ||
| 13 | + dir ./objs/nginx/html; | ||
| 14 | +} | ||
| 15 | +vhost __defaultVhost__ { | ||
| 16 | + mode remote; | ||
| 17 | + origin 127.0.0.1; | ||
| 18 | + http_remux { | ||
| 19 | + enabled on; | ||
| 20 | + mount [vhost]/[app]/[stream].flv; | ||
| 21 | + hstrs on; | ||
| 22 | + } | ||
| 23 | +} |
conf/http.flv.live.edge2.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to flv live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 19352; | ||
| 6 | +max_connections 1000; | ||
| 7 | +pid objs/srs.flv.19352.pid; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +http_server { | ||
| 11 | + enabled on; | ||
| 12 | + listen 8082; | ||
| 13 | + dir ./objs/nginx/html; | ||
| 14 | +} | ||
| 15 | +vhost __defaultVhost__ { | ||
| 16 | + mode remote; | ||
| 17 | + origin 127.0.0.1; | ||
| 18 | + http_remux { | ||
| 19 | + enabled on; | ||
| 20 | + mount [vhost]/[app]/[stream].flv; | ||
| 21 | + hstrs on; | ||
| 22 | + } | ||
| 23 | +} |
conf/http.heartbeat.conf
0 → 100644
| 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 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +heartbeat { | ||
| 9 | + enabled on; | ||
| 10 | + interval 9.3; | ||
| 11 | + # for python api-server | ||
| 12 | + url http://127.0.0.1:8085/api/v1/servers; | ||
| 13 | + device_id "my-srs-device"; | ||
| 14 | + # for ossrs.net monitor, device_id is the key genereated by bsm. | ||
| 15 | + #url http://www.ossrs.net:1977/api/v1/robots/servers; | ||
| 16 | + #device_id "35c9b402c12a7246868752e2878f7e0e"; | ||
| 17 | + # with detail summaries | ||
| 18 | + summaries on; | ||
| 19 | +} | ||
| 20 | +stats { | ||
| 21 | + network 0; | ||
| 22 | + disk sda sdb xvda xvdb; | ||
| 23 | +} | ||
| 24 | +vhost __defaultVhost__ { | ||
| 25 | +} |
conf/http.hls.conf
0 → 100644
| 1 | +# the config for srs to delivery hls | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHLS | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +vhost __defaultVhost__ { | ||
| 15 | + hls { | ||
| 16 | + enabled on; | ||
| 17 | + hls_fragment 10; | ||
| 18 | + hls_window 60; | ||
| 19 | + hls_path ./objs/nginx/html; | ||
| 20 | + hls_m3u8_file [app]/[stream].m3u8; | ||
| 21 | + hls_ts_file [app]/[stream]-[seq].ts; | ||
| 22 | + } | ||
| 23 | +} |
conf/http.hooks.callback.conf
0 → 100644
| 1 | +# http-hooks or http-callbacks config for srs. | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +vhost __defaultVhost__ { | ||
| 9 | + http_hooks { | ||
| 10 | + enabled on; | ||
| 11 | + on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients; | ||
| 12 | + on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients; | ||
| 13 | + on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams; | ||
| 14 | + on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams; | ||
| 15 | + on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; | ||
| 16 | + on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions; | ||
| 17 | + } | ||
| 18 | +} |
conf/http.mp3.live.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to mp3 live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +vhost __defaultVhost__ { | ||
| 15 | + http_remux { | ||
| 16 | + enabled on; | ||
| 17 | + fast_cache 30; | ||
| 18 | + mount [vhost]/[app]/[stream].mp3; | ||
| 19 | + hstrs on; | ||
| 20 | + | ||
| 21 | + } | ||
| 22 | +} |
conf/http.server.conf
0 → 100644
| 1 | +# the config for srs to serve as http server | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +http_server { | ||
| 9 | + enabled on; | ||
| 10 | + listen 8080; | ||
| 11 | + dir ./objs/nginx/html; | ||
| 12 | +} | ||
| 13 | +vhost ossrs.net { | ||
| 14 | + http { | ||
| 15 | + enabled on; | ||
| 16 | + mount [vhost]/; | ||
| 17 | + dir ./objs/nginx/html; | ||
| 18 | + } | ||
| 19 | +} |
conf/http.ts.live.conf
0 → 100644
| 1 | +# the config for srs to remux rtmp to ts live stream. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHttpStream | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +vhost __defaultVhost__ { | ||
| 15 | + http_remux { | ||
| 16 | + enabled on; | ||
| 17 | + mount [vhost]/[app]/[stream].ts; | ||
| 18 | + hstrs on; | ||
| 19 | + } | ||
| 20 | +} |
conf/ingest.conf
0 → 100644
| 1 | +# use ffmpeg to ingest file/stream/device to SRS | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleIngest | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + ingest livestream { | ||
| 11 | + enabled on; | ||
| 12 | + input { | ||
| 13 | + type file; | ||
| 14 | + url ./doc/source.200kbps.768x320.flv; | ||
| 15 | + } | ||
| 16 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 17 | + engine { | ||
| 18 | + enabled off; | ||
| 19 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; | ||
| 20 | + } | ||
| 21 | + } | ||
| 22 | +} |
conf/mac.dev.conf
0 → 100644
| 1 | +# no-daemon and write log to console config for srs. | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +daemon off; | ||
| 7 | +srs_log_tank console; | ||
| 8 | +http_api { | ||
| 9 | + enabled on; | ||
| 10 | + listen 1985; | ||
| 11 | +} | ||
| 12 | +http_server { | ||
| 13 | + enabled on; | ||
| 14 | + listen 8080; | ||
| 15 | +} | ||
| 16 | +vhost __defaultVhost__ { | ||
| 17 | + hls { | ||
| 18 | + enabled on; | ||
| 19 | + hls_fragment 10; | ||
| 20 | + hls_window 60; | ||
| 21 | + hls_path ./objs/nginx/html; | ||
| 22 | + } | ||
| 23 | + ingest livestream { | ||
| 24 | + enabled on; | ||
| 25 | + input { | ||
| 26 | + type file; | ||
| 27 | + url ./doc/source.200kbps.768x320.flv; | ||
| 28 | + } | ||
| 29 | + #ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 30 | + ffmpeg ./objs/research/librtmp/srs_ingest_flv; | ||
| 31 | + engine { | ||
| 32 | + enabled off; | ||
| 33 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; | ||
| 34 | + } | ||
| 35 | + } | ||
| 36 | +} |
conf/origin.conf
0 → 100644
conf/push.flv.conf
0 → 100644
| 1 | +# push HTTP FLV to SRS. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_Streamer#push-http-flv-to-srs | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +http_server { | ||
| 10 | + enabled on; | ||
| 11 | + listen 8080; | ||
| 12 | + dir ./objs/nginx/html; | ||
| 13 | +} | ||
| 14 | +stream_caster { | ||
| 15 | + enabled on; | ||
| 16 | + caster flv; | ||
| 17 | + output rtmp://127.0.0.1/[app]/[stream]; | ||
| 18 | + listen 8936; | ||
| 19 | +} | ||
| 20 | +vhost __defaultVhost__ { | ||
| 21 | + hls { | ||
| 22 | + enabled on; | ||
| 23 | + hls_fragment 10; | ||
| 24 | + hls_window 60; | ||
| 25 | + hls_path ./objs/nginx/html; | ||
| 26 | + hls_m3u8_file [app]/[stream].m3u8; | ||
| 27 | + hls_ts_file [app]/[stream]-[seq].ts; | ||
| 28 | + } | ||
| 29 | +} |
conf/push.mpegts.over.udp.conf
0 → 100644
| 1 | +# push MPEG-TS over UDP to SRS. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_Streamer#push-mpeg-ts-over-udp | ||
| 3 | +# @see https://github.com/ossrs/srs/issues/250#issuecomment-72321769 | ||
| 4 | +# @see full.conf for detail config. | ||
| 5 | + | ||
| 6 | +listen 1935; | ||
| 7 | +max_connections 1000; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +stream_caster { | ||
| 11 | + enabled on; | ||
| 12 | + caster mpegts_over_udp; | ||
| 13 | + output rtmp://127.0.0.1/live/livestream; | ||
| 14 | + listen 1935; | ||
| 15 | +} | ||
| 16 | +vhost __defaultVhost__ { | ||
| 17 | +} |
conf/push.rtsp.conf
0 → 100644
| 1 | +# push MPEG-TS over UDP to SRS. | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_Streamer#push-mpeg-ts-over-udp | ||
| 3 | +# @see https://github.com/ossrs/srs/issues/250#issuecomment-72321769 | ||
| 4 | +# @see full.conf for detail config. | ||
| 5 | + | ||
| 6 | +listen 1935; | ||
| 7 | +max_connections 1000; | ||
| 8 | +daemon off; | ||
| 9 | +srs_log_tank console; | ||
| 10 | +stream_caster { | ||
| 11 | + enabled on; | ||
| 12 | + caster rtsp; | ||
| 13 | + output rtmp://127.0.0.1/[app]/[stream]; | ||
| 14 | + listen 554; | ||
| 15 | + rtp_port_min 57200; | ||
| 16 | + rtp_port_max 57300; | ||
| 17 | +} | ||
| 18 | +vhost __defaultVhost__ { | ||
| 19 | +} |
conf/realtime.conf
0 → 100644
| 1 | +# the config for srs to delivery realtime RTMP stream | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_SampleRealtime | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + gop_cache off; | ||
| 11 | + queue_length 10; | ||
| 12 | + min_latency on; | ||
| 13 | + mr { | ||
| 14 | + enabled off; | ||
| 15 | + } | ||
| 16 | + mw_latency 100; | ||
| 17 | + tcp_nodelay on; | ||
| 18 | +} |
conf/rtmp.conf
0 → 100644
conf/security.deny.publish.conf
0 → 100644
| 1 | +# security config for srs, allow play and deny publish. | ||
| 2 | +# @see https://github.com/ossrs/srs/issues/211#issuecomment-68507035 | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + security { | ||
| 11 | + enabled on; | ||
| 12 | + deny publish all; | ||
| 13 | + allow play all; | ||
| 14 | + } | ||
| 15 | +} |
conf/srs.conf
0 → 100644
| 1 | +# main config for srs. | ||
| 2 | +# @see full.conf for detail config. | ||
| 3 | + | ||
| 4 | +listen 1935; | ||
| 5 | +max_connections 1000; | ||
| 6 | +srs_log_tank file; | ||
| 7 | +srs_log_file ./objs/srs.log; | ||
| 8 | +http_api { | ||
| 9 | + enabled on; | ||
| 10 | + listen 1985; | ||
| 11 | +} | ||
| 12 | +http_server { | ||
| 13 | + enabled on; | ||
| 14 | + listen 8080; | ||
| 15 | + dir ./objs/nginx/html; | ||
| 16 | +} | ||
| 17 | +stats { | ||
| 18 | + network 0; | ||
| 19 | + disk sda sdb xvda xvdb; | ||
| 20 | +} | ||
| 21 | +vhost __defaultVhost__ { | ||
| 22 | +} |
conf/transcode2hls.audio.only.conf
0 → 100644
| 1 | +# the config for srs to delivery hls | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v1_CN_SampleHLS | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | + hls { | ||
| 11 | + enabled on; | ||
| 12 | + hls_fragment 10; | ||
| 13 | + hls_window 60; | ||
| 14 | + hls_path ./objs/nginx/html; | ||
| 15 | + hls_m3u8_file [app]/[stream].m3u8; | ||
| 16 | + hls_ts_file [app]/[stream]-[seq].ts; | ||
| 17 | + } | ||
| 18 | + transcode { | ||
| 19 | + enabled on; | ||
| 20 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 21 | + engine ff { | ||
| 22 | + enabled on; | ||
| 23 | + vcodec copy; | ||
| 24 | + acodec libfdk_aac; | ||
| 25 | + aparams { | ||
| 26 | + } | ||
| 27 | + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; | ||
| 28 | + } | ||
| 29 | + } | ||
| 30 | +} |
conf/transform.edge.conf
0 → 100644
| 1 | +# the config for srs origin-edge cluster | ||
| 2 | +# @see https://github.com/ossrs/srs/wiki/v2_CN_Edge#transform-vhost | ||
| 3 | +# @see full.conf for detail config. | ||
| 4 | + | ||
| 5 | +listen 1935; | ||
| 6 | +max_connections 1000; | ||
| 7 | +daemon off; | ||
| 8 | +srs_log_tank console; | ||
| 9 | +vhost __defaultVhost__ { | ||
| 10 | +} | ||
| 11 | +vhost source.srs.com { | ||
| 12 | + ingest livestream { | ||
| 13 | + enabled on; | ||
| 14 | + input { | ||
| 15 | + type file; | ||
| 16 | + url ./doc/source.200kbps.768x320.flv; | ||
| 17 | + } | ||
| 18 | + ffmpeg ./objs/ffmpeg/bin/ffmpeg; | ||
| 19 | + engine { | ||
| 20 | + enabled off; | ||
| 21 | + output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream; | ||
| 22 | + } | ||
| 23 | + } | ||
| 24 | +} | ||
| 25 | +vhost transform.srs.edge.com { | ||
| 26 | + mode remote; | ||
| 27 | + origin 127.0.0.1:1935; | ||
| 28 | + vhost source.srs.com; | ||
| 29 | +} |
etc/init.d/srs
0 → 100755
| 1 | +#!/bin/bash | ||
| 2 | + | ||
| 3 | +### BEGIN INIT INFO | ||
| 4 | +# Provides: ossrs(srs) | ||
| 5 | +# RequiRED-Start: $all | ||
| 6 | +# RequiRED-Stop: $all | ||
| 7 | +# Default-Start: 2 3 4 5 | ||
| 8 | +# Default-Stop: 0 1 6 | ||
| 9 | +# Short-Description: ossrs(srs) | ||
| 10 | +# Description: https://github.com/ossrs/srs | ||
| 11 | +### END INIT INFO | ||
| 12 | + | ||
| 13 | +# the config of ROOT, user must modify it when start srs from other directory, | ||
| 14 | +# it's ok to use the script by command ./etc/init.d/ossrs | ||
| 15 | +ROOT="/usr/local/srs" | ||
| 16 | +APP="./objs/srs" | ||
| 17 | +CONFIG="./conf/srs.conf" | ||
| 18 | +DEFAULT_PID_FILE='./objs/srs.pid' | ||
| 19 | +DEFAULT_LOG_FILE='./objs/srs.log' | ||
| 20 | + | ||
| 21 | +######################################################################## | ||
| 22 | +# utility functions | ||
| 23 | +######################################################################## | ||
| 24 | +RED="\\033[31m" | ||
| 25 | +GREEN="\\033[32m" | ||
| 26 | +YELLOW="\\033[33m" | ||
| 27 | +BLACK="\\033[0m" | ||
| 28 | +POS="\\033[60G" | ||
| 29 | + | ||
| 30 | +ok_msg() { | ||
| 31 | + echo -e "${1}${POS}${BLACK}[${GREEN} OK ${BLACK}]" | ||
| 32 | +} | ||
| 33 | + | ||
| 34 | +failed_msg() { | ||
| 35 | + echo -e "${1}${POS}${BLACK}[${RED}FAILED${BLACK}]" | ||
| 36 | +} | ||
| 37 | + | ||
| 38 | +# load process info of srs | ||
| 39 | +# @set variable $srs_pid to the process id in srs.pid file. | ||
| 40 | +# @return 0, if process exists; otherwise: | ||
| 41 | +# 1, for pid file not exists. | ||
| 42 | +# 2, for get proecess info by pid failed. | ||
| 43 | +# @set variable $error_msg if error. | ||
| 44 | +# @set variable $pid_file to pid file. | ||
| 45 | +load_process_info() { | ||
| 46 | + # get pid file | ||
| 47 | + pid_file=`cd ${ROOT} && cat ${CONFIG} |grep ^pid|awk '{print $2}'|awk -F ';' '{print $1}'` | ||
| 48 | + if [[ -z $pid_file ]]; then pid_file=${DEFAULT_PID_FILE}; fi | ||
| 49 | + # get abs path | ||
| 50 | + pid_dir=`dirname $pid_file` | ||
| 51 | + pid_file=`(cd ${ROOT}; cd $pid_dir; pwd)`/`basename $pid_file` | ||
| 52 | + | ||
| 53 | + srs_pid=`cat $pid_file 2>/dev/null` | ||
| 54 | + ret=$?; if [[ 0 -ne $ret ]]; then error_msg="file $pid_file does not exists"; return 1; fi | ||
| 55 | + | ||
| 56 | + ps -p ${srs_pid} >/dev/null 2>/dev/null | ||
| 57 | + ret=$?; if [[ 0 -ne $ret ]]; then error_msg="process $srs_pid does not exists"; return 2; fi | ||
| 58 | + | ||
| 59 | + return 0; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +start() { | ||
| 63 | + # if exists, exit. | ||
| 64 | + load_process_info | ||
| 65 | + if [[ 0 -eq $? ]]; then failed_msg "SRS started(pid ${srs_pid}), should not start it again."; return 0; fi | ||
| 66 | + | ||
| 67 | + # not exists, start server | ||
| 68 | + ok_msg "Starting SRS..." | ||
| 69 | + | ||
| 70 | + # get log file | ||
| 71 | + log_file=`cd ${ROOT} && cat ${CONFIG} |grep '^log_file'| awk '{print $2}'| awk -F ';' '{print $1}'` | ||
| 72 | + if [[ -z $log_file ]]; then log_file=${DEFAULT_LOG_FILE}; fi | ||
| 73 | + # get abs path | ||
| 74 | + log_dir=`dirname $log_file` | ||
| 75 | + log_file=`(cd ${ROOT} && cd $log_dir && pwd)`/`basename $log_file` | ||
| 76 | + | ||
| 77 | + # TODO: FIXME: set limit by, for instance, "ulimit -HSn 10000" | ||
| 78 | + if [[ -z $log_file ]]; then | ||
| 79 | + (ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >/dev/null 2>&1) | ||
| 80 | + else | ||
| 81 | + (ulimit -c unlimited && cd ${ROOT}; ${APP} -c ${CONFIG} >> $log_file 2>&1) | ||
| 82 | + fi | ||
| 83 | + | ||
| 84 | + # check again after start server | ||
| 85 | + for ((i = 0; i < 5; i++)); do | ||
| 86 | + # sleep a little while, for srs may start then crash. | ||
| 87 | + sleep 0.1 | ||
| 88 | + load_process_info | ||
| 89 | + ret=$?; if [[ 0 -ne $ret ]]; then | ||
| 90 | + failed_msg "SRS start failed"; | ||
| 91 | + failed_msg "see $log_file"; | ||
| 92 | + return $ret; | ||
| 93 | + fi | ||
| 94 | + done | ||
| 95 | + | ||
| 96 | + # check whether started. | ||
| 97 | + load_process_info | ||
| 98 | + ret=$?; if [[ 0 -eq $? ]]; then ok_msg "SRS started(pid ${srs_pid})"; return 0; fi | ||
| 99 | + | ||
| 100 | + failed_msg "SRS not started" | ||
| 101 | + return $ret | ||
| 102 | +} | ||
| 103 | + | ||
| 104 | +stop() { | ||
| 105 | + # not start, exit | ||
| 106 | + load_process_info | ||
| 107 | + if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi | ||
| 108 | + | ||
| 109 | + ok_msg "Stopping SRS(pid ${srs_pid})..." | ||
| 110 | + | ||
| 111 | + # process exists, try to kill to stop normally | ||
| 112 | + for((i=0;i<100;i++)); do | ||
| 113 | + load_process_info | ||
| 114 | + if [[ 0 -eq $? ]]; then | ||
| 115 | + kill -s SIGTERM ${srs_pid} 2>/dev/null | ||
| 116 | + ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGTERM failed ret=$ret"; return $ret; fi | ||
| 117 | + sleep 0.3 | ||
| 118 | + else | ||
| 119 | + ok_msg "SRS stopped by SIGTERM" | ||
| 120 | + # delete the pid file when stop success. | ||
| 121 | + rm -f ${pid_file} | ||
| 122 | + break; | ||
| 123 | + fi | ||
| 124 | + done | ||
| 125 | + | ||
| 126 | + # process exists, use kill -9 to force to exit | ||
| 127 | + load_process_info | ||
| 128 | + if [[ 0 -eq $? ]]; then | ||
| 129 | + kill -s SIGKILL ${srs_pid} 2>/dev/null | ||
| 130 | + ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "send signal SIGKILL failed ret=$ret"; return $ret; fi | ||
| 131 | + ok_msg "SRS stopped by SIGKILL" | ||
| 132 | + else | ||
| 133 | + # delete the pid file when stop success. | ||
| 134 | + rm -f ${pid_file} | ||
| 135 | + fi | ||
| 136 | + | ||
| 137 | + sleep 0.1 | ||
| 138 | + return 0 | ||
| 139 | +} | ||
| 140 | + | ||
| 141 | +# get the status of srs process | ||
| 142 | +# @return 0 if srs is running; otherwise, 1 for stopped. | ||
| 143 | +status() { | ||
| 144 | + load_process_info | ||
| 145 | + ret=$?; if [[ 0 -eq $ret ]]; then echo "SRS(pid ${srs_pid}) is running."; return 0; fi | ||
| 146 | + | ||
| 147 | + echo "SRS is stopped, $error_msg" | ||
| 148 | + return 1 | ||
| 149 | +} | ||
| 150 | + | ||
| 151 | +reload() { | ||
| 152 | + # not start, exit | ||
| 153 | + load_process_info | ||
| 154 | + if [[ 0 -ne $? ]]; then failed_msg "SRS not start."; return 0; fi | ||
| 155 | + | ||
| 156 | + ok_msg "Reload SRS(pid ${srs_pid})..." | ||
| 157 | + | ||
| 158 | + # process exists, reload it | ||
| 159 | + kill -s SIGHUP ${srs_pid} 2>/dev/null | ||
| 160 | + ret=$?; if [[ 0 -ne $ret ]]; then failed_msg "Reload SRS failed ret=$ret"; return $ret; fi | ||
| 161 | + | ||
| 162 | + load_process_info | ||
| 163 | + if [[ 0 -ne $? ]]; then failed_msg "SRS reload failed."; return $ret; fi | ||
| 164 | + | ||
| 165 | + ok_msg "SRS reloaded" | ||
| 166 | + return 0 | ||
| 167 | +} | ||
| 168 | + | ||
| 169 | +menu() { | ||
| 170 | + case "$1" in | ||
| 171 | + start) | ||
| 172 | + start | ||
| 173 | + ;; | ||
| 174 | + stop) | ||
| 175 | + stop | ||
| 176 | + ;; | ||
| 177 | + restart) | ||
| 178 | + stop | ||
| 179 | + start | ||
| 180 | + ;; | ||
| 181 | + status) | ||
| 182 | + status | ||
| 183 | + ;; | ||
| 184 | + reload) | ||
| 185 | + reload | ||
| 186 | + ;; | ||
| 187 | + *) | ||
| 188 | + echo "Usage: $0 {start|stop|status|restart|reload}" | ||
| 189 | + return 1 | ||
| 190 | + ;; | ||
| 191 | + esac | ||
| 192 | +} | ||
| 193 | + | ||
| 194 | +menu $1 | ||
| 195 | + | ||
| 196 | +code=$? | ||
| 197 | +exit ${code} |
objs/ffmpeg/bin/ffmpeg
0 → 100755
This file is too large to display.
objs/nginx/html/crossdomain.xml
0 → 100644
objs/srs
0 → 100755
This file is too large to display.
-
请 注册 或 登录 后发表评论