2
0

full.conf 112 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712
  1. # All configurations for SRS, you can find whatever you want about configuration of SRS.
  2. # Note that please never use this file as configuration of SRS, because it's just a full set of configurations.
  3. #############################################################################################
  4. # Global sections
  5. #############################################################################################
  6. # Config file, specified by cli such as `-c conf/srs.conf`.
  7. # Overwrite by env SRS_CONFIG_FILE
  8. # The id of server, for stat and api identification.
  9. # Note that SRS will generate a random id if not configured.
  10. # Overwrite by env SRS_SERVER_ID
  11. server_id srs-ie193id;
  12. # The pid file to write the pid, for managing the SRS process and avoiding duplicated processes.
  13. # If need to run multiple processes, please change this pid file to another one.
  14. # Note: Do not support reloading, for SRS5+
  15. # Overwrite by env SRS_PID
  16. # Default: ./objs/srs.pid
  17. pid ./objs/srs.pid;
  18. # the log dir for FFMPEG.
  19. # if enabled ffmpeg, each transcoding stream will create a log file.
  20. # /dev/null to disable the log.
  21. # Note: Do not support reloading, for SRS5+
  22. # Overwrite by env SRS_FF_LOG_DIR
  23. # default: ./objs
  24. ff_log_dir ./objs;
  25. # the log level for FFMPEG.
  26. # info warning error fatal panic quiet
  27. # trace debug verbose
  28. # Note: Do not support reloading, for SRS5+
  29. # Overwrite by env SRS_FF_LOG_LEVEL
  30. # default: info
  31. ff_log_level info;
  32. # the log tank, console or file.
  33. # if console, print log to console.
  34. # if file, write log to file. requires srs_log_file if log to file.
  35. # Note: Do not support reloading, for SRS5+
  36. # Overwrite by env SRS_LOG_TANK or SRS_SRS_LOG_TANK
  37. # default: file.
  38. srs_log_tank console;
  39. # The log level for logging to console or file. It can be:
  40. # verbose, info, trace, warn, error
  41. # If configure --log-level_v2=off, use SRS 4.0 level specs which is v1, the level text is:
  42. # Verb, Info, Trace, Warn, Error
  43. # If configure --log-level_v2=on, use SRS 5.0 level specs which is v2, the level text is:
  44. # TRACE, DEBUG, INFO, WARN, ERROR
  45. # Note: Do not support reloading, for SRS5+
  46. # Overwrite by env SRS_LOG_LEVEL or SRS_SRS_LOG_LEVEL
  47. # default: trace
  48. srs_log_level trace;
  49. # The log level v2, rewrite the config srs_log_level if not empty, it can be:
  50. # trace, debug, info, warn, error
  51. # If configure --log-level_v2=off, use SRS 4.0 level specs which is v1, the level text is:
  52. # Verb, Info, Trace, Warn, Error
  53. # If configure --log-level_v2=on, use SRS 5.0 level specs which is v2, the level text is:
  54. # TRACE, DEBUG, INFO, WARN, ERROR
  55. # Overwrite by env SRS_LOG_LEVEL_V2 or SRS_SRS_LOG_LEVEL_V2
  56. srs_log_level_v2 info;
  57. # when srs_log_tank is file, specifies the log file.
  58. # Note: Do not support reloading, for SRS5+
  59. # Overwrite by env SRS_LOG_FILE or SRS_SRS_LOG_FILE
  60. # default: ./objs/srs.log
  61. srs_log_file ./objs/srs.log;
  62. # the max connections.
  63. # if exceed the max connections, server will drop the new connection.
  64. # Overwrite by env SRS_MAX_CONNECTIONS
  65. # default: 1000
  66. max_connections 1000;
  67. # whether start as daemon
  68. # @remark: do not support reload.
  69. # Overwrite by env SRS_DAEMON
  70. # default: on
  71. daemon off;
  72. # whether use utc_time to generate the time struct,
  73. # if off, use localtime() to generate it,
  74. # if on, use gmtime() instead, which use UTC time.
  75. # Note: Do not support reloading, for SRS5+
  76. # Overwrite by env SRS_UTC_TIME
  77. # default: off
  78. utc_time off;
  79. # config for the pithy print in ms,
  80. # which always print constant message specified by interval,
  81. # whatever the clients in concurrency.
  82. # Overwrite by env SRS_PITHY_PRINT_MS
  83. # default: 10000
  84. pithy_print_ms 10000;
  85. # the work dir for server, to chdir(work_dir) when not empty or "./"
  86. # user can config this directory to change the dir.
  87. # @reamrk do not support reload.
  88. # Overwrite by env SRS_WORK_DIR
  89. # default: ./
  90. work_dir ./;
  91. # whether quit when parent process changed,
  92. # used for supervisor mode(not daemon), srs should always quit when
  93. # supervisor process exited.
  94. # @remark conflict with daemon, error when both daemon and asprocess are on.
  95. # @reamrk do not support reload.
  96. # Overwrite by env SRS_ASPROCESS
  97. # default: off
  98. asprocess off;
  99. # Whether client empty IP is ok, for example, health checking by SLB.
  100. # If ok(on), we will ignore this connection without warnings or errors.
  101. # Overwrite by env SRS_EMPTY_IP_OK
  102. # default: on
  103. empty_ip_ok on;
  104. # Whether in docker. When SRS starting, it will detect the docker, however
  105. # it might detect failed, then read this config.
  106. # Overwrite by env SRS_IN_DOCKER
  107. # Default: off
  108. in_docker off;
  109. # For gracefully quit, wait for a while then close listeners,
  110. # because K8S notify SRS with SIGQUIT and update Service simultaneously,
  111. # maybe there is some new connections incoming before Service updated.
  112. # @see https://github.com/ossrs/srs/issues/1595#issuecomment-587516567
  113. # Overwrite by env SRS_GRACE_START_WAIT
  114. # default: 2300
  115. grace_start_wait 2300;
  116. # For gracefully quit, final wait for cleanup in milliseconds.
  117. # @see https://github.com/ossrs/srs/issues/1579#issuecomment-587414898
  118. # Overwrite by env SRS_GRACE_FINAL_WAIT
  119. # default: 3200
  120. grace_final_wait 3200;
  121. # Whether force gracefully quit, never fast quit.
  122. # By default, SIGTERM which means fast quit, is sent by K8S, so we need to
  123. # force SRS to treat SIGTERM as gracefully quit for gray release or canary.
  124. # @see https://github.com/ossrs/srs/issues/1579#issuecomment-587475077
  125. # Overwrite by env SRS_FORCE_GRACE_QUIT
  126. # default: off
  127. force_grace_quit off;
  128. # Whether disable daemon for docker.
  129. # If on, it will set daemon to off in docker, even daemon is on.
  130. # Overwrite by env SRS_DISABLE_DAEMON_FOR_DOCKER
  131. # default: on
  132. disable_daemon_for_docker on;
  133. # Whether auto reload by watching the config file by inotify.
  134. # Overwrite by env SRS_INOTIFY_AUTO_RELOAD
  135. # default: off
  136. inotify_auto_reload off;
  137. # Whether enable inotify_auto_reload for docker.
  138. # If on, it will set inotify_auto_reload to on in docker, even it's off.
  139. # Overwrite by env SRS_AUTO_RELOAD_FOR_DOCKER
  140. # default: on
  141. auto_reload_for_docker on;
  142. #############################################################################################
  143. # RTMP sections
  144. #############################################################################################
  145. # the rtmp listen ports, split by space, each listen entry is <[ip:]port>
  146. # for example, 192.168.1.100:1935 10.10.10.100:1935
  147. # where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
  148. # Overwrite by env SRS_LISTEN
  149. listen 1935;
  150. # the default chunk size is 128, max is 65536,
  151. # some client does not support chunk size change,
  152. # however, most clients support it and it can improve
  153. # performance about 10%.
  154. # Overwrite by env SRS_CHUNK_SIZE
  155. # default: 60000
  156. chunk_size 60000;
  157. #############################################################################################
  158. # HTTP sections
  159. #############################################################################################
  160. # api of srs.
  161. # the http api config, export for external program to manage srs.
  162. # user can access http api of srs in browser directly, for instance, to access by:
  163. # curl http://192.168.1.170:1985/api/v1/reload
  164. # which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api,
  165. # where the cli can only be used in shell/terminate.
  166. http_api {
  167. # whether http api is enabled.
  168. # Overwrite by env SRS_HTTP_API_ENABLED
  169. # default: off
  170. enabled on;
  171. # The http api listen entry is <[ip:]port>, For example, 192.168.1.100:8080, where the ip is optional, default to
  172. # 0.0.0.0, that is 8080 equals to 0.0.0.0:8080.
  173. # Note that you're able to use a dedicated port for HTTP API, such as 1985, to be different with HTTP server. In
  174. # this situation, you you must also set another HTTPS API port.
  175. # Overwrite by env SRS_HTTP_API_LISTEN
  176. # Default: 1985
  177. listen 8080;
  178. # whether enable crossdomain request.
  179. # Overwrite by env SRS_HTTP_API_CROSSDOMAIN
  180. # default: on
  181. crossdomain on;
  182. # the HTTP RAW API is more powerful api to change srs state and reload.
  183. raw_api {
  184. # whether enable the HTTP RAW API.
  185. # Overwrite by env SRS_HTTP_API_RAW_API_ENABLED
  186. # default: off
  187. enabled off;
  188. # whether enable rpc reload.
  189. # Overwrite by env SRS_HTTP_API_RAW_API_ALLOW_RELOAD
  190. # default: off
  191. allow_reload off;
  192. # whether enable rpc query.
  193. # Always off by https://github.com/ossrs/srs/issues/2653
  194. #allow_query off;
  195. # whether enable rpc update.
  196. # Always off by https://github.com/ossrs/srs/issues/2653
  197. #allow_update off;
  198. }
  199. # the auth is authentication for http api
  200. auth {
  201. # whether enable the HTTP AUTH.
  202. # Overwrite by env SRS_HTTP_API_AUTH_ENABLED
  203. # default: off
  204. enabled on;
  205. # The username of Basic authentication:
  206. # Overwrite by env SRS_HTTP_API_AUTH_USERNAME
  207. username admin;
  208. # The password of Basic authentication:
  209. # Overwrite by env SRS_HTTP_API_AUTH_PASSWORD
  210. password admin;
  211. }
  212. # For https_api or HTTPS API.
  213. https {
  214. # Whether enable HTTPS API.
  215. # Overwrite by env SRS_HTTP_API_HTTPS_ENABLED
  216. # default: off
  217. enabled on;
  218. # The listen endpoint for HTTPS API.
  219. # Note that you're able to use a dedicated port for HTTPS API, such as 1990, and the HTTP API should not be
  220. # the same of HTTP server(8080) neither.
  221. # Overwrite by env SRS_HTTP_API_HTTPS_LISTEN
  222. # Default: 1990
  223. listen 8088;
  224. # The SSL private key file, generated by:
  225. # openssl genrsa -out server.key 2048
  226. # Overwrite by env SRS_HTTP_API_HTTPS_KEY
  227. # default: ./conf/server.key
  228. key ./conf/server.key;
  229. # The SSL public cert file, generated by:
  230. # openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
  231. # Overwrite by env SRS_HTTP_API_HTTPS_CERT
  232. # default: ./conf/server.crt
  233. cert ./conf/server.crt;
  234. }
  235. }
  236. # embedded http server in srs.
  237. # the http streaming config, for HLS/HDS/DASH/HTTPProgressive
  238. # global config for http streaming, user must config the http section for each vhost.
  239. # the embed http server used to substitute nginx in ./objs/nginx,
  240. # for example, srs running in arm, can provides RTMP and HTTP service, only with srs installed.
  241. # user can access the http server pages, generally:
  242. # curl http://192.168.1.170:80/srs.html
  243. # which will show srs version and welcome to srs.
  244. # @remark, the http embedded stream need to config the vhost, for instance, the __defaultVhost__
  245. # need to open the feature http of vhost.
  246. http_server {
  247. # whether http streaming service is enabled.
  248. # Overwrite by env SRS_HTTP_SERVER_ENABLED
  249. # default: off
  250. enabled on;
  251. # the http streaming listen entry is <[ip:]port>
  252. # for example, 192.168.1.100:8080
  253. # where the ip is optional, default to 0.0.0.0, that is 8080 equals to 0.0.0.0:8080
  254. # @remark, if use lower port, for instance 80, user must start srs by root.
  255. # Overwrite by env SRS_HTTP_SERVER_LISTEN
  256. # default: 8080
  257. listen 8080;
  258. # the default dir for http root.
  259. # Overwrite by env SRS_HTTP_SERVER_DIR
  260. # default: ./objs/nginx/html
  261. dir ./objs/nginx/html;
  262. # whether enable crossdomain request.
  263. # for both http static and stream server and apply on all vhosts.
  264. # Overwrite by env SRS_HTTP_SERVER_CROSSDOMAIN
  265. # default: on
  266. crossdomain on;
  267. # For https_server or HTTPS Streaming.
  268. https {
  269. # Whether enable HTTPS Streaming.
  270. # Overwrite by env SRS_HTTP_SERVER_HTTPS_ENABLED
  271. # default: off
  272. enabled on;
  273. # The listen endpoint for HTTPS Streaming.
  274. # Overwrite by env SRS_HTTP_SERVER_HTTPS_LISTEN
  275. # default: 8088
  276. listen 8088;
  277. # The SSL private key file, generated by:
  278. # openssl genrsa -out server.key 2048
  279. # Overwrite by env SRS_HTTP_SERVER_HTTPS_KEY
  280. # default: ./conf/server.key
  281. key ./conf/server.key;
  282. # The SSL public cert file, generated by:
  283. # openssl req -new -x509 -key server.key -out server.crt -days 3650 -subj "/C=CN/ST=Beijing/L=Beijing/O=Me/OU=Me/CN=ossrs.net"
  284. # Overwrite by env SRS_HTTP_SERVER_HTTPS_CERT
  285. # default: ./conf/server.crt
  286. cert ./conf/server.crt;
  287. }
  288. }
  289. #############################################################################################
  290. # SRT server section
  291. #############################################################################################
  292. # @doc https://github.com/ossrs/srs/issues/1147#usage
  293. srt_server {
  294. # whether SRT server is enabled.
  295. # Overwrite by env SRS_SRT_SERVER_ENABLED
  296. # default: off
  297. enabled on;
  298. # The UDP listen port for SRT.
  299. # Overwrite by env SRS_SRT_SERVER_LISTEN
  300. listen 10080;
  301. # For detail parameters, please read wiki:
  302. # @see https://ossrs.net/lts/zh-cn/docs/v5/doc/srt-params
  303. # @see https://ossrs.io/lts/en-us/docs/v5/doc/srt-params
  304. # The maxbw is the max bandwidth of the sender side.
  305. # -1: Means the biggest bandwidth is infinity.
  306. # 0: Means the bandwidth is determined by SRTO_INPUTBW.
  307. # >0: Means the bandwidth is the configuration value.
  308. # Overwrite by env SRS_SRT_SERVER_MAXBW
  309. # default: -1
  310. maxbw 1000000000;
  311. # Maximum Segment Size. Used for buffer allocation and rate calculation using packet counter assuming fully
  312. # filled packets. Each party can set its own MSS value independently. During a handshake the parties exchange
  313. # MSS values, and the lowest is used.
  314. # Overwrite by env SRS_SRT_SERVER_MSS
  315. # default: 1500
  316. mss 1500;
  317. # The timeout time of the SRT connection on the sender side in ms. When SRT connects to a peer costs time
  318. # more than this config, it will be close.
  319. # Overwrite by env SRS_SRT_SERVER_CONNECT_TIMEOUT
  320. # default: 3000
  321. connect_timeout 4000;
  322. # The timeout time of SRT connection on the receiver side in ms. When the SRT connection is idle
  323. # more than this config, it will be close.
  324. # Overwrite by env SRS_SRT_SERVER_PEER_IDLE_TIMEOUT
  325. # default: 10000
  326. peer_idle_timeout 8000;
  327. # Default app for vmix, see https://github.com/ossrs/srs/pull/1615
  328. # Overwrite by env SRS_SRT_SERVER_DEFAULT_APP
  329. # default: live
  330. default_app live;
  331. # The peerlatency is set by the sender side and will notify the receiver side.
  332. # Overwrite by env SRS_SRT_SERVER_PEERLATENCY
  333. # default: 0
  334. peerlatency 0;
  335. # The recvlatency means latency from sender to receiver.
  336. # Overwrite by env SRS_SRT_SERVER_RECVLATENCY
  337. # default: 120
  338. recvlatency 0;
  339. # This latency configuration configures both recvlatency and peerlatency to the same value.
  340. # Overwrite by env SRS_SRT_SERVER_LATENCY
  341. # default: 120
  342. latency 0;
  343. # The tsbpd mode means timestamp based packet delivery.
  344. # SRT sender side will pack timestamp in each packet. If this config is true,
  345. # the receiver will read the packet according to the timestamp in the head of the packet.
  346. # Overwrite by env SRS_SRT_SERVER_TSBPDMODE
  347. # default: on
  348. tsbpdmode off;
  349. # The tlpkdrop means too-late Packet Drop
  350. # SRT sender side will pack timestamp in each packet, When the network is congested,
  351. # the packet will drop if latency is bigger than the configuration in both sender side and receiver side.
  352. # And on the sender side, it also will be dropped because latency is bigger than configuration.
  353. # Overwrite by env SRS_SRT_SERVER_TLPKTDROP
  354. # default: on
  355. tlpktdrop off;
  356. # The send buffer size of SRT.
  357. # Overwrite by env SRS_SRT_SERVER_SENDBUF
  358. # default: 8192 * (1500-28)
  359. sendbuf 2000000;
  360. # The recv buffer size of SRT.
  361. # Overwrite by env SRS_SRT_SERVER_RECVBUF
  362. # default: 8192 * (1500-28)
  363. recvbuf 2000000;
  364. # The passphrase of SRT.
  365. # If passphrase is no empty, all the srt client must be using the correct passphrase to publish or play,
  366. # or the srt connection will reject. The length of passphrase must be in range 10~79.
  367. # @see https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#srto_passphrase.
  368. # Overwrite by env SRS_SRT_SERVER_PASSPHRASE
  369. # default: ""
  370. passphrase xxxxxxxxxxxx;
  371. # The pbkeylen of SRT.
  372. # The pbkeylen determined the AES encrypt algorithm, this option only allow 4 values which is 0, 16, 24, 32
  373. # @see https://github.com/Haivision/srt/blob/master/docs/API/API-socket-options.md#srto_pbkeylen.
  374. # Overwrite by env SRS_SRT_SERVER_PBKEYLEN
  375. # default: 0
  376. pbkeylen 16;
  377. }
  378. vhost srt.vhost.srs.com {
  379. srt {
  380. # Overwrite by env SRS_VHOST_SRT_ENABLED for all vhosts.
  381. enabled on;
  382. # Overwrite by env SRS_VHOST_SRT_TO_RTMP for all vhosts.
  383. srt_to_rtmp on;
  384. }
  385. }
  386. #############################################################################################
  387. # WebRTC server section
  388. #############################################################################################
  389. rtc_server {
  390. # Whether enable WebRTC server.
  391. # Overwrite by env SRS_RTC_SERVER_ENABLED
  392. # default: off
  393. enabled on;
  394. # The udp listen port, we will reuse it for connections.
  395. # Overwrite by env SRS_RTC_SERVER_LISTEN
  396. # default: 8000
  397. listen 8000;
  398. # For WebRTC over TCP directly, not TURN, see https://github.com/ossrs/srs/issues/2852
  399. # Some network does not support UDP, or not very well, so we use TCP like HTTP/80 port for firewall traversing.
  400. tcp {
  401. # Whether enable WebRTC over TCP.
  402. # Overwrite by env SRS_RTC_SERVER_TCP_ENABLED
  403. # Default: off
  404. enabled off;
  405. # The TCP listen port for WebRTC. Highly recommend is some normally used ports, such as TCP/80, TCP/443,
  406. # TCP/8000, TCP/8080 etc. However SRS default to TCP/8000 corresponding to UDP/8000.
  407. # Overwrite by env SRS_RTC_SERVER_TCP_LISTEN
  408. # Default: 8000
  409. listen 8000;
  410. }
  411. # The protocol for candidate to use, it can be:
  412. # udp Generate UDP candidates. Note that UDP server is always enabled for WebRTC.
  413. # tcp Generate TCP candidates. Fail if rtc_server.tcp(WebRTC over TCP) is disabled.
  414. # all Generate UDP+TCP candidates. Ignore if rtc_server.tcp(WebRTC over TCP) is disabled.
  415. # Note that if both are connected, we will use the first connected(DTLS done) one.
  416. # Overwrite by env SRS_RTC_SERVER_PROTOCOL
  417. # Default: udp
  418. protocol udp;
  419. # The exposed candidate IPs, response in SDP candidate line. It can be:
  420. # * Retrieve server IP automatically, from all network interfaces.
  421. # $CANDIDATE Read the IP from ENV variable, use * if not set.
  422. # x.x.x.x A specified IP address or DNS name, use * if 0.0.0.0.
  423. # You can also set the candidate by the query string eip, note that you can also set the UDP port,
  424. # for example:
  425. # http://locahost:1985/rtc/v1/whip/?app=live&stream=livestream&eip=192.168.3.11
  426. # http://locahost:1985/rtc/v1/whip/?app=live&stream=livestream&eip=192.168.3.11:18000
  427. # @remark For Firefox, the candidate MUST be IP, MUST NOT be DNS name, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
  428. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate
  429. # Overwrite by env SRS_RTC_SERVER_CANDIDATE
  430. # default: *
  431. candidate *;
  432. # If candidate is * or 0.0.0.0, means SRS could detect IP automatically, filtered by ip_family.
  433. # You can config this to off to disable the detecting, then SRS will try to parse the API hostname.
  434. # Note that browser might fail if no CANDIDATE specified.
  435. # Overwrite by env SRS_RTC_SERVER_USE_AUTO_DETECT_NETWORK_IP
  436. # Default: on
  437. use_auto_detect_network_ip on;
  438. # The IP family filter for auto discover candidate, it can be:
  439. # ipv4 Filter IP v4 candidates.
  440. # ipv6 Filter IP v6 candidates.
  441. # all Filter all IP v4 or v6 candidates.
  442. # For example, if set to ipv4, we only use the IPv4 address as candidate.
  443. # Overwrite by env SRS_RTC_SERVER_IP_FAMILY
  444. # default: ipv4
  445. ip_family ipv4;
  446. # If api_as_candidates is on, SRS would try to use the IP of api server, specified by srs.sdk.js request:
  447. # api:string "http://r.ossrs.net:1985/rtc/v1/play/"
  448. # in this case, the r.ossrs.net and 39.107.238.185 will be added as candidates.
  449. # Overwrite by env SRS_RTC_SERVER_API_AS_CANDIDATES
  450. # Default: on
  451. api_as_candidates on;
  452. # If use api as CANDIDATE, whether resolve the api hostname.
  453. # Note that use original domain name as CANDIDATE, which might make Firefox failed, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
  454. # Note that if hostname is IPv4 address, always directly use it.
  455. # Overwrite by env SRS_RTC_SERVER_RESOLVE_API_DOMAIN
  456. # Default: on
  457. resolve_api_domain on;
  458. # If use api as CANDIDATE, whether keep original api domain name as CANDIDATE.
  459. # Note that use original domain name as CANDIDATE, which might make Firefox failed, see https://bugzilla.mozilla.org/show_bug.cgi?id=1239006
  460. # Overwrite by env SRS_RTC_SERVER_KEEP_API_DOMAIN
  461. # Default: off
  462. keep_api_domain off;
  463. # Whether use ECDSA certificate.
  464. # If not, use RSA certificate.
  465. # Overwrite by env SRS_RTC_SERVER_ECDSA
  466. # default: on
  467. ecdsa on;
  468. # Whether encrypt RTP packet by SRTP.
  469. # @remark Should always turn it on, or Chrome will fail.
  470. # Overwrite by env SRS_RTC_SERVER_ENCRYPT
  471. # default: on
  472. encrypt on;
  473. # We listen multiple times at the same port, by REUSEPORT, to increase the UDP queue.
  474. # Note that you can set to 1 and increase the system UDP buffer size by net.core.rmem_max
  475. # and net.core.rmem_default or just increase this to get larger UDP recv and send buffer.
  476. # Overwrite by env SRS_RTC_SERVER_REUSEPORT
  477. # default: 1
  478. reuseport 1;
  479. # Whether merge multiple NALUs into one.
  480. # @see https://github.com/ossrs/srs/issues/307#issuecomment-612806318
  481. # Overwrite by env SRS_RTC_SERVER_MERGE_NALUS
  482. # default: off
  483. merge_nalus off;
  484. # The black-hole to copy packet to, for debugging.
  485. # For example, when debugging Chrome publish stream, the received packets are encrypted cipher,
  486. # we can set the publisher black-hole, SRS will copy the plaintext packets to black-hole, and
  487. # we are able to capture the plaintext packets by wireshark.
  488. black_hole {
  489. # Whether enable the black-hole.
  490. # Overwrite by env SRS_RTC_SERVER_BLACK_HOLE_ENABLED
  491. # default: off
  492. enabled off;
  493. # The black-hole address for session.
  494. # Overwrite by env SRS_RTC_SERVER_BLACK_HOLE_ADDR
  495. addr 127.0.0.1:10000;
  496. }
  497. }
  498. vhost rtc.vhost.srs.com {
  499. rtc {
  500. # Whether enable WebRTC server.
  501. # Overwrite by env SRS_VHOST_RTC_ENABLED for all vhosts.
  502. # default: off
  503. enabled on;
  504. # Whether support NACK.
  505. # Overwrite by env SRS_VHOST_RTC_NACK for all vhosts.
  506. # default: on
  507. nack on;
  508. # Whether directly use the packet, avoid copy.
  509. # Overwrite by env SRS_VHOST_RTC_NACK_NO_COPY for all vhosts.
  510. # default: on
  511. nack_no_copy on;
  512. # Whether support TWCC.
  513. # Overwrite by env SRS_VHOST_RTC_TWCC for all vhosts.
  514. # default: on
  515. twcc on;
  516. # The timeout in seconds for session timeout.
  517. # Client will send ping(STUN binding request) to server, we use it as heartbeat.
  518. # Overwrite by env SRS_VHOST_RTC_STUN_TIMEOUT for all vhosts.
  519. # default: 30
  520. stun_timeout 30;
  521. # The strict check when process stun.
  522. # Overwrite by env SRS_VHOST_RTC_STUN_STRICT_CHECK for all vhosts.
  523. # default: off
  524. stun_strict_check on;
  525. # The role of dtls when peer is actpass: passive or active
  526. # Overwrite by env SRS_VHOST_RTC_DTLS_ROLE for all vhosts.
  527. # default: passive
  528. dtls_role passive;
  529. # The version of dtls, support dtls1.0, dtls1.2, and auto
  530. # Overwrite by env SRS_VHOST_RTC_DTLS_VERSION for all vhosts.
  531. # default: auto
  532. dtls_version auto;
  533. # Drop the packet with the pt(payload type), 0 never drop.
  534. # Overwrite by env SRS_VHOST_RTC_DROP_FOR_PT for all vhosts.
  535. # default: 0
  536. drop_for_pt 0;
  537. ###############################################################
  538. # Whether enable transmuxing RTMP to RTC.
  539. # If enabled, transcode aac to opus.
  540. # Overwrite by env SRS_VHOST_RTC_RTMP_TO_RTC for all vhosts.
  541. # default: off
  542. rtmp_to_rtc off;
  543. # Whether keep B-frame, which is normal feature in live streaming,
  544. # but usually disabled in RTC.
  545. # Overwrite by env SRS_VHOST_RTC_KEEP_BFRAME for all vhosts.
  546. # default: off
  547. keep_bframe off;
  548. # Whether to keep the h.264 SEI type NALU packet.
  549. # DJI drone M30T will send many SEI type NALU packet, while iOS hardware decoder (Video Toolbox)
  550. # dislike to feed it so many SEI NALU between NonIDR and IDR NALU packets.
  551. # @see https://github.com/ossrs/srs/issues/4052
  552. # Overwrite by env SRS_VHOST_RTC_KEEP_AVC_NALU_SEI for all vhosts.
  553. # Default: on
  554. keep_avc_nalu_sei on;
  555. # The transcode audio bitrate, for RTMP to RTC.
  556. # Overwrite by env SRS_VHOST_RTC_OPUS_BITRATE for all vhosts.
  557. # [8000, 320000]
  558. # default: 48000
  559. opus_bitrate 48000;
  560. ###############################################################
  561. # Whether enable transmuxing RTC to RTMP.
  562. # Overwrite by env SRS_VHOST_RTC_RTC_TO_RTMP for all vhosts.
  563. # Default: off
  564. rtc_to_rtmp off;
  565. # The PLI interval in seconds, for RTC to RTMP.
  566. # Note the available range is [0.5, 30]
  567. # Overwrite by env SRS_VHOST_RTC_PLI_FOR_RTMP for all vhosts.
  568. # Default: 6.0
  569. pli_for_rtmp 6.0;
  570. # The transcode audio bitrate, for RTC to RTMP.
  571. # Overwrite by env SRS_VHOST_RTC_AAC_BITRATE for all vhosts.
  572. # [8000, 320000]
  573. # default: 48000
  574. aac_bitrate 48000;
  575. }
  576. ###############################################################
  577. # For transmuxing RTMP to RTC, it will impact the default values if RTC is on.
  578. # Whether enable min delay mode for vhost.
  579. # Overwrite by env SRS_VHOST_MIN_LATENCY for all vhosts.
  580. # default: on, for RTC.
  581. min_latency on;
  582. play {
  583. # set the MW(merged-write) latency in ms.
  584. # @remark For WebRTC, we enable pass-by-timestamp mode, so we ignore this config.
  585. # Overwrite by env SRS_VHOST_PLAY_MW_LATENCY for all vhosts.
  586. # default: 0 (For WebRTC)
  587. mw_latency 0;
  588. # Set the MW(merged-write) min messages.
  589. # default: 0 (For Real-Time, that is min_latency on)
  590. # default: 1 (For WebRTC, that is min_latency off)
  591. # Overwrite by env SRS_VHOST_PLAY_MW_MSGS for all vhosts.
  592. mw_msgs 0;
  593. }
  594. }
  595. #############################################################################################
  596. # Stream converter sections
  597. #############################################################################################
  598. # The stream converter coverts stream from other protocol to SRS over RTMP.
  599. # @see https://github.com/ossrs/srs/tree/develop#stream-architecture
  600. # Push MPEGTS over UDP to SRS.
  601. stream_caster {
  602. # Whether stream converter is enabled.
  603. # Default: off
  604. enabled on;
  605. # The type of stream converter, could be:
  606. # mpegts_over_udp, push MPEG-TS over UDP and convert to RTMP.
  607. caster mpegts_over_udp;
  608. # The output rtmp url.
  609. # For mpegts_over_udp converter, the typically output url:
  610. # rtmp://127.0.0.1/live/livestream
  611. output rtmp://127.0.0.1/live/livestream;
  612. # The listen port for stream converter.
  613. # For mpegts_over_udp converter, listen at udp port. for example, 8935.
  614. listen 8935;
  615. }
  616. # Push FLV by HTTP POST to SRS.
  617. stream_caster {
  618. # Whether stream converter is enabled.
  619. # Default: off
  620. enabled on;
  621. # The type of stream converter, could be:
  622. # flv, push FLV by HTTP POST and convert to RTMP.
  623. caster flv;
  624. # The output rtmp url.
  625. # For flv converter, the typically output url:
  626. # rtmp://127.0.0.1/[app]/[stream]
  627. # For example, POST to url:
  628. # http://127.0.0.1:8936/live/livestream.flv
  629. # Where the [app] is "live" and [stream] is "livestream", output is:
  630. # rtmp://127.0.0.1/live/livestream
  631. output rtmp://127.0.0.1/[app]/[stream];
  632. # The listen port for stream converter.
  633. # For flv converter, listen at tcp port. for example, 8936.
  634. listen 8936;
  635. }
  636. # For GB28181 server, see https://github.com/ossrs/srs/issues/3176
  637. # For SIP specification, see https://www.ietf.org/rfc/rfc3261.html
  638. # For GB28181 2016 spec, see https://openstd.samr.gov.cn/bzgk/gb/newGbInfo?hcno=469659DC56B9B8187671FF08748CEC89
  639. stream_caster {
  640. # Whether stream converter is enabled.
  641. # Default: off
  642. enabled off;
  643. # The type of stream converter, could be:
  644. # gb28181, Push GB28181 stream and convert to RTMP.
  645. caster gb28181;
  646. # The output rtmp url.
  647. # For gb28181 converter, the typically output url:
  648. # rtmp://127.0.0.1/live/[stream]
  649. # The available variables:
  650. # [stream] The video channel codec ID.
  651. output rtmp://127.0.0.1/live/[stream];
  652. # The listen TCP port for stream converter.
  653. # For gb28181 converter, listen at TCP port. for example, 9000.
  654. # @remark We always enable bundle for media streams at this port.
  655. listen 9000;
  656. # SIP server for GB28181. Please note that this is only a demonstrated SIP server, please never use it in your
  657. # online production environment. Instead please use [jsip](https://github.com/usnistgov/jsip) and there is a demo
  658. # [srs-sip](https://github.com/ossrs/srs-sip) also base on it.
  659. sip {
  660. # Whether enable embedded SIP server.
  661. # Default: on
  662. enabled on;
  663. # The SIP listen port, for TCP protocol.
  664. # Default: 5060
  665. listen 5060;
  666. # The SIP or media transport timeout in seconds.
  667. # Default: 60
  668. timeout 60;
  669. # When media disconnect, the wait time in seconds to re-invite device to publish. During this wait time, device
  670. # might send bye or unregister message(expire is 0), so that we will cancel the re-invite.
  671. # Default: 5
  672. reinvite 5;
  673. # The exposed candidate IPs, response in SDP connection line. It can be:
  674. # * Retrieve server IP automatically, from all network interfaces.
  675. # $CANDIDATE Read the IP from ENV variable, use * if not set.
  676. # x.x.x.x A specified IP address or DNS name, use * if 0.0.0.0.
  677. # Default: *
  678. candidate *;
  679. }
  680. }
  681. #############################################################################################
  682. # other global sections
  683. #############################################################################################
  684. # For tcmalloc, the release rate.
  685. # @see https://gperftools.github.io/gperftools/tcmalloc.html
  686. # @remark Should run configure --with-gperf
  687. # Overwrite by env SRS_TCMALLOC_RELEASE_RATE
  688. # default: 0.8
  689. tcmalloc_release_rate 0.8;
  690. # Query the latest available version of SRS, write a log to notice user to upgrade.
  691. # @see https://github.com/ossrs/srs/issues/2424
  692. # @see https://github.com/ossrs/srs/issues/2508
  693. # Overwrite by env SRS_QUERY_LATEST_VERSION
  694. # Default: off
  695. query_latest_version off;
  696. # First wait when qlv(query latest version), in seconds.
  697. # Only available when qlv is enabled.
  698. # Overwrite by env SRS_FIRST_WAIT_FOR_QLV
  699. # Default: 300
  700. first_wait_for_qlv 300;
  701. # For thread pool.
  702. threads {
  703. # The thread pool manager cycle interval, in seconds.
  704. # Overwrite by env SRS_THREADS_INTERVAL
  705. # Default: 5
  706. interval 5;
  707. }
  708. # For system circuit breaker.
  709. circuit_breaker {
  710. # Whether enable the circuit breaker.
  711. # Overwrite by env SRS_CIRCUIT_BREAKER_ENABLED
  712. # Default: on
  713. enabled on;
  714. # The CPU percent(0, 100) ever 1s, as system high water-level, which enable the circuit-break
  715. # mechanism, for example, NACK will be disabled if high water-level.
  716. # Overwrite by env SRS_CIRCUIT_BREAKER_HIGH_THRESHOLD
  717. # Default: 90
  718. high_threshold 90;
  719. # Reset the high water-level, if number of pulse under high_threshold.
  720. # @remark 0 to disable the high water-level.
  721. # Overwrite by env SRS_CIRCUIT_BREAKER_HIGH_PULSE
  722. # Default: 2
  723. high_pulse 2;
  724. # The CPU percent(0, 100) ever 1s, as system critical water-level, which enable the circuit-break
  725. # mechanism, for example, TWCC will be disabled if high water-level.
  726. # @note All circuit-break mechanism of high-water-level scope are enabled in critical.
  727. # Overwrite by env SRS_CIRCUIT_BREAKER_CRITICAL_THRESHOLD
  728. # Default: 95
  729. critical_threshold 95;
  730. # Reset the critical water-level, if number of pulse under critical_threshold.
  731. # @remark 0 to disable the critical water-level.
  732. # Overwrite by env SRS_CIRCUIT_BREAKER_CRITICAL_PULSE
  733. # Default: 1
  734. critical_pulse 1;
  735. # If dying, also drop packets for players.
  736. # Overwrite by env SRS_CIRCUIT_BREAKER_DYING_THRESHOLD
  737. # Default: 99
  738. dying_threshold 99;
  739. # If CPU exceed the dying_pulse times, enter dying.
  740. # @remark 0 to disable the dying water-level.
  741. # Overwrite by env SRS_CIRCUIT_BREAKER_DYING_PULSE
  742. # Default: 5
  743. dying_pulse 5;
  744. }
  745. # TencentCloud CLS(Cloud Log Service) config, logging to cloud.
  746. # See https://cloud.tencent.com/document/product/614/11254
  747. tencentcloud_cls {
  748. # Whether CLS is enabled.
  749. # Overwrite by env SRS_TENCENTCLOUD_CLS_ENABLED
  750. # default: off
  751. enabled off;
  752. # The logging label to category the cluster servers.
  753. # Overwrite by env SRS_TENCENTCLOUD_CLS_LABEL
  754. label cn-beijing;
  755. # The logging tag to category the cluster servers.
  756. # Overwrite by env SRS_TENCENTCLOUD_CLS_TAG
  757. tag cn-edge;
  758. # The SecretId to access CLS service, see https://console.cloud.tencent.com/cam/capi
  759. # Overwrite by env SRS_TENCENTCLOUD_CLS_SECRET_ID
  760. secret_id AKIDxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
  761. # The SecretKey to access CLS service, see https://console.cloud.tencent.com/cam/capi
  762. # Overwrite by env SRS_TENCENTCLOUD_CLS_SECRET_KEY
  763. secret_key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;
  764. # The endpoint of CLS, format as <Region>.cls.tencentcs.com. For example:
  765. # ap-guangzhou.cls.tencentcs.com
  766. # Note that tencentyun.com is for internal network, while tencentcs.com is for public internet.
  767. # See https://cloud.tencent.com/document/product/614/18940
  768. # Overwrite by env SRS_TENCENTCLOUD_CLS_ENDPOINT
  769. endpoint ap-guangzhou.cls.tencentcs.com;
  770. # The topic ID of CLS, see https://cloud.tencent.com/document/product/614/41035
  771. # Overwrite by env SRS_TENCENTCLOUD_CLS_TOPIC_ID
  772. topic_id xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx;
  773. # Whether enable logging for each log sending.
  774. # Overwrite by env SRS_TENCENTCLOUD_CLS_DEBUG_LOGGING
  775. # Default: off
  776. debug_logging off;
  777. # Whether enable the heartbeat stat every (5 * heartbeat_ratio)s.
  778. # Overwrite by env SRS_TENCENTCLOUD_CLS_STAT_HEARTBEAT
  779. # Default: on
  780. stat_heartbeat on;
  781. # Setup the heartbeat interval ratio, 1 means 5s, 2 means 10s, etc.
  782. # Overwrite by env SRS_TENCENTCLOUD_CLS_HEARTBEAT_RATIO
  783. # Default: 1
  784. heartbeat_ratio 1;
  785. # Whether enable the streams stat every (5 * streams_ratio)s.
  786. # Overwrite by env SRS_TENCENTCLOUD_CLS_STAT_STREAMS
  787. # Default: on
  788. stat_streams on;
  789. # Setup the streams interval ratio, 1 means 5s, 2 means 10s, etc.
  790. # Overwrite by env SRS_TENCENTCLOUD_CLS_STREAMS_RATIO
  791. # Default: 1
  792. streams_ratio 1;
  793. }
  794. # TencentCloud APM(Application Performance Management) config.
  795. # See https://cloud.tencent.com/document/product/1463/57462
  796. tencentcloud_apm {
  797. # Whether APM is enabled.
  798. # Overwrite by env SRS_TENCENTCLOUD_APM_ENABLED
  799. # default: off
  800. enabled on;
  801. # The APM team or business system ID, to which spans belongs to. For example, the team is apm-FsOsPOIMl (just an
  802. # example, not available), please get your team from https://console.cloud.tencent.com/apm/monitor/team
  803. # Overwrite by env SRS_TENCENTCLOUD_APM_TEAM
  804. team apm-xxxxxxxxx;
  805. # The APM token for authentication. For example, the token is xzddEaegsxGadEpGEDFx (just an example, not available),
  806. # please get your token from https://console.cloud.tencent.com/apm/monitor/access
  807. # Overwrite by env SRS_TENCENTCLOUD_APM_TOKEN
  808. token xxxxxxxx;
  809. # The APM endpoint. See https://github.com/open-telemetry/opentelemetry-go/tree/main/exporters/otlp/otlptrace
  810. # Please note that 4317 is for GRPC/HTTP2, while SRS only support HTTP and the port shoule be 55681.
  811. # Overwrite by env SRS_TENCENTCLOUD_APM_ENDPOINT
  812. endpoint ap-guangzhou.apm.tencentcs.com:55681;
  813. # The service.name of resource.
  814. # Overwrite by env SRS_TENCENTCLOUD_APM_SERVICE_NAME
  815. # Default: srs-server
  816. service_name srs-server;
  817. # Whether enable logging for each log sending.
  818. # Overwrite by env SRS_TENCENTCLOUD_APM_DEBUG_LOGGING
  819. # Default: off
  820. debug_logging off;
  821. }
  822. # Prometheus exporter config.
  823. # See https://prometheus.io/docs/instrumenting/exporters
  824. exporter {
  825. # Whether exporter is enabled.
  826. # Overwrite by env SRS_EXPORTER_ENABLED
  827. # Default: off
  828. enabled off;
  829. # The http api listen port for exporter metrics.
  830. # Overwrite by env SRS_EXPORTER_LISTEN
  831. # Default: 9972
  832. # See https://github.com/prometheus/prometheus/wiki/Default-port-allocations
  833. listen 9972;
  834. # The logging label to category the cluster servers.
  835. # Overwrite by env SRS_EXPORTER_LABEL
  836. label cn-beijing;
  837. # The logging tag to category the cluster servers.
  838. # Overwrite by env SRS_EXPORTER_TAG
  839. tag cn-edge;
  840. }
  841. #############################################################################################
  842. # heartbeat/stats sections
  843. #############################################################################################
  844. # heartbeat to api server
  845. # @remark, the ip report to server, is retrieve from system stat,
  846. # which need the config item stats.network.
  847. heartbeat {
  848. # whether heartbeat is enabled.
  849. # Overwrite by env SRS_HEARTBEAT_ENABLED
  850. # default: off
  851. enabled off;
  852. # the interval seconds for heartbeat,
  853. # recommend 0.3,0.6,0.9,1.2,1.5,1.8,2.1,2.4,2.7,3,...,6,9,12,....
  854. # Overwrite by env SRS_HEARTBEAT_INTERVAL
  855. # default: 9.9
  856. interval 9.3;
  857. # when startup, srs will heartbeat to this api.
  858. # @remark: must be a restful http api url, where SRS will POST with following data:
  859. # {
  860. # "device_id": "my-srs-device",
  861. # "ip": "192.168.1.100"
  862. # }
  863. # Overwrite by env SRS_HEARTBEAT_URL
  864. # default: http://127.0.0.1:8085/api/v1/servers
  865. url http://127.0.0.1:8085/api/v1/servers;
  866. # the id of device.
  867. # Overwrite by env SRS_HEARTBEAT_DEVICE_ID
  868. device_id "my-srs-device";
  869. # whether report with summaries
  870. # if on, put /api/v1/summaries to the request data:
  871. # {
  872. # "summaries": summaries object.
  873. # }
  874. # @remark: optional config.
  875. # Overwrite by env SRS_HEARTBEAT_SUMMARIES
  876. # default: off
  877. summaries off;
  878. # Whether report with listen ports.
  879. # if on, request with the ports of SRS:
  880. # {
  881. # "rtmp": ["1935"], "http": ["8080"], "api": ["1985"], "srt": ["10080"], "rtc": ["8000"]
  882. # }
  883. # Overwrite by env SRS_HEARTBEAT_PORTS
  884. # default: off
  885. ports off;
  886. }
  887. # system statistics section.
  888. # the main cycle will retrieve the system stat,
  889. # for example, the cpu/mem/network/disk-io data,
  890. # the http api, for instance, /api/v1/summaries will show these data.
  891. # @remark the heartbeat depends on the network,
  892. # for example, the eth0 maybe the device which index is 0.
  893. stats {
  894. # Whether enable the stat of system resources.
  895. # Default: on
  896. enabled on;
  897. # the index of device ip.
  898. # we may retrieve more than one network device.
  899. # default: 0
  900. network 0;
  901. # the device name to stat the disk iops.
  902. # ignore the device of /proc/diskstats if not configured.
  903. disk sda sdb xvda xvdb;
  904. }
  905. #############################################################################################
  906. # RTMP/HTTP VHOST sections
  907. #############################################################################################
  908. # vhost list, the __defaultVhost__ is the default vhost
  909. # for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
  910. # for which cannot identify the required vhost.
  911. vhost __defaultVhost__ {
  912. }
  913. # the vhost scope configs.
  914. vhost scope.vhost.srs.com {
  915. # whether the vhost is enabled.
  916. # if off, all request access denied.
  917. # default: on
  918. enabled off;
  919. # whether enable min delay mode for vhost.
  920. # for min latency mode:
  921. # 1. disable the publish.mr for vhost.
  922. # 2. use timeout for cond wait for consumer queue.
  923. # @see https://github.com/ossrs/srs/issues/257
  924. # default: off (for RTMP/HTTP-FLV)
  925. # default: on (for WebRTC)
  926. min_latency off;
  927. # whether enable the TCP_NODELAY
  928. # if on, set the nodelay of fd by setsockopt
  929. # Overwrite by env SRS_VHOST_TCP_NODELAY for all vhosts.
  930. # default: off
  931. tcp_nodelay off;
  932. # the default chunk size is 128, max is 65536,
  933. # some client does not support chunk size change,
  934. # vhost chunk size will override the global value.
  935. # Overwrite by env SRS_VHOST_CHUNK_SIZE for all vhosts.
  936. # default: global chunk size.
  937. chunk_size 128;
  938. # The input ack size, 0 to not set.
  939. # Generally, it's set by the message from peer,
  940. # but for some peer(encoder), it never send message but use a different ack size.
  941. # We can chnage the default ack size in server-side, to send acknowledge message,
  942. # or the encoder maybe blocked after publishing for some time.
  943. # Overwrite by env SRS_VHOST_IN_ACK_SIZE for all vhosts.
  944. # Default: 0
  945. in_ack_size 0;
  946. # The output ack size, 0 to not set.
  947. # This is used to notify the peer(player) to send acknowledge to server.
  948. # Overwrite by env SRS_VHOST_OUT_ACK_SIZE for all vhosts.
  949. # Default: 2500000
  950. out_ack_size 2500000;
  951. }
  952. # set the chunk size of vhost.
  953. vhost chunksize.srs.com {
  954. # @see scope.vhost.srs.com
  955. chunk_size 128;
  956. }
  957. # the vhost disabled.
  958. vhost removed.srs.com {
  959. # @see scope.vhost.srs.com
  960. enabled off;
  961. }
  962. # vhost for stream cluster for RTMP/FLV
  963. vhost cluster.srs.com {
  964. # The config for cluster.
  965. cluster {
  966. # The cluster mode, local or remote.
  967. # local: It's an origin server, serve streams itself.
  968. # remote: It's an edge server, fetch or push stream to origin server.
  969. # default: local
  970. mode remote;
  971. # For edge(mode remote), user must specifies the origin server
  972. # format as: <server_name|ip>[:port]
  973. # @remark user can specifies multiple origin for error backup, by space,
  974. # for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
  975. origin 127.0.0.1:1935 localhost:1935;
  976. # For edge(mode remote), whether open the token traverse mode,
  977. # if token traverse on, all connections of edge will forward to origin to check(auth),
  978. # it's very important for the edge to do the token auth.
  979. # the better way is use http callback to do the token auth by the edge,
  980. # but if user prefer origin check(auth), the token_traverse if better solution.
  981. # default: off
  982. token_traverse off;
  983. # For edge(mode remote), the vhost to transform for edge,
  984. # to fetch from the specified vhost at origin,
  985. # if not specified, use the current vhost of edge in origin, the variable [vhost].
  986. # default: [vhost]
  987. vhost same.edge.srs.com;
  988. # For edge(mode remote), when upnode(forward to, edge push to, edge pull from) is srs,
  989. # it's strongly recommend to open the debug_srs_upnode,
  990. # when connect to upnode, it will take the debug info,
  991. # for example, the id, source id, pid.
  992. # please see https://ossrs.net/lts/zh-cn/docs/v4/doc/log
  993. # default: on
  994. debug_srs_upnode on;
  995. # For origin(mode local) cluster, turn on the cluster.
  996. # @remark Origin cluster only supports RTMP, use Edge to transmux RTMP to FLV.
  997. # default: off
  998. # TODO: FIXME: Support reload.
  999. origin_cluster off;
  1000. # For origin (mode local) cluster, the co-worker's HTTP APIs.
  1001. # This origin will connect to co-workers and communicate with them.
  1002. # please see https://ossrs.io/lts/en-us/docs/v4/doc/origin-cluster
  1003. # TODO: FIXME: Support reload.
  1004. coworkers 127.0.0.1:9091 127.0.0.1:9092;
  1005. # The protocol to connect to origin.
  1006. # rtmp, Connect origin by RTMP
  1007. # flv, Connect origin by HTTP-FLV
  1008. # flvs, Connect origin by HTTPS-FLV
  1009. # Default: rtmp
  1010. protocol rtmp;
  1011. # Whether follow client protocol to connect to origin.
  1012. # @remark The FLV might use different signature(in query string) to RTMP.
  1013. # Default: off
  1014. follow_client off;
  1015. }
  1016. }
  1017. # vhost for edge, edge and origin is the same vhost
  1018. vhost same.edge.srs.com {
  1019. # @see cluster.srs.com
  1020. cluster {
  1021. mode remote;
  1022. origin 127.0.0.1:1935 localhost:1935;
  1023. token_traverse off;
  1024. }
  1025. }
  1026. # vhost for edge, edge transform vhost to fetch from another vhost.
  1027. vhost transform.edge.srs.com {
  1028. # @see cluster.srs.com
  1029. cluster {
  1030. mode remote;
  1031. origin 127.0.0.1:1935;
  1032. vhost same.edge.srs.com;
  1033. }
  1034. }
  1035. # the vhost for srs debug info, whether send args in connect(tcUrl).
  1036. vhost debug.srs.com {
  1037. # @see cluster.srs.com
  1038. cluster {
  1039. debug_srs_upnode on;
  1040. }
  1041. }
  1042. # the vhost which forward publish streams.
  1043. vhost same.vhost.forward.srs.com {
  1044. # forward stream to other servers.
  1045. forward {
  1046. # whether enable the forward.
  1047. # default: off
  1048. enabled on;
  1049. # forward all publish stream to the specified server.
  1050. # this used to split/forward the current stream for cluster active-standby,
  1051. # active-active for cdn to build high available fault tolerance system.
  1052. # format: {ip}:{port} {ip_N}:{port_N}
  1053. destination 127.0.0.1:1936 127.0.0.1:1937;
  1054. # when client(encoder) publish to vhost/app/stream, call the hook in creating backend forwarder.
  1055. # the request in the POST data string is a object encode by json:
  1056. # {
  1057. # "action": "on_forward",
  1058. # "server_id": "vid-k21d7y2",
  1059. # "client_id": "9o7g1330",
  1060. # "ip": "127.0.0.1",
  1061. # "vhost": "__defaultVhost__",
  1062. # "app": "live",
  1063. # "tcUrl": "rtmp://127.0.0.1:1935/live",
  1064. # "stream": "livestream",
  1065. # "param": ""
  1066. # }
  1067. # if valid, the hook must return HTTP code 200(Status OK) and response
  1068. # an int value specifies the error code(0 corresponding to success):
  1069. # {
  1070. # "code": 0,
  1071. # "data": {
  1072. # "urls":[
  1073. # "rtmp://127.0.0.1:19350/test/teststream"
  1074. # ]
  1075. # }
  1076. # }
  1077. # PS: you can transform params to backend service, such as:
  1078. # { "param": "?forward=rtmp://127.0.0.1:19351/test/livestream" }
  1079. # then backend return forward's url in response.
  1080. # if backend return empty urls, destanition is still disabled.
  1081. # only support one api hook, format:
  1082. # backend http://xxx/api0
  1083. backend http://127.0.0.1:8085/api/v1/forward;
  1084. }
  1085. }
  1086. # the play specified configs
  1087. vhost play.srs.com {
  1088. # for play client, both RTMP and other stream clients,
  1089. # for instance, the HTTP FLV stream clients.
  1090. play {
  1091. # whether cache the last gop.
  1092. # if on, cache the last gop and dispatch to client,
  1093. # to enabled fast startup for client, client play immediately.
  1094. # if off, send the latest media data to client,
  1095. # client need to wait for the next Iframe to decode and show the video.
  1096. # set to off if requires min delay;
  1097. # set to on if requires client fast startup.
  1098. # Overwrite by env SRS_VHOST_PLAY_GOP_CACHE for all vhosts.
  1099. # default: on
  1100. gop_cache off;
  1101. # Limit the max frames in gop cache. It might cause OOM if video stream has no IDR frame, so we limit to N
  1102. # frames by default. Note that it's the size of gop cache, including videos, audios and other messages.
  1103. # Overwrite by env SRS_VHOST_PLAY_GOP_CACHE_MAX_FRAMES for all vhosts.
  1104. # default: 2500
  1105. gop_cache_max_frames 2500;
  1106. # the max live queue length in seconds.
  1107. # if the messages in the queue exceed the max length,
  1108. # drop the old whole gop.
  1109. # Overwrite by env SRS_VHOST_PLAY_QUEUE_LENGTH for all vhosts.
  1110. # default: 30
  1111. queue_length 10;
  1112. # about the stream monotonically increasing:
  1113. # 1. video timestamp is monotonically increasing,
  1114. # 2. audio timestamp is monotonically increasing,
  1115. # 3. video and audio timestamp is interleaved/mixed monotonically increasing.
  1116. # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
  1117. # however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
  1118. # the time jitter algorithm:
  1119. # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
  1120. # 2. zero, only ensure stream start at zero, ignore timestamp jitter.
  1121. # 3. off, disable the time jitter algorithm, like atc.
  1122. # @remark for full, correct timestamp only when |delta| > 250ms.
  1123. # @remark disabled when atc is on.
  1124. # Overwrite by env SRS_VHOST_PLAY_TIME_JITTER for all vhosts.
  1125. # default: full
  1126. time_jitter full;
  1127. # vhost for atc for hls/hds/rtmp backup.
  1128. # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
  1129. # when atc is on, server delivery rtmp stream by absolute time.
  1130. # atc is used, for instance, encoder will copy stream to master and slave server,
  1131. # server use atc to delivery stream to edge/client, where stream time from master/slave server
  1132. # is always the same, client/tools can slice RTMP stream to HLS according to the same time,
  1133. # if the time not the same, the HLS stream cannot slice to support system backup.
  1134. #
  1135. # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
  1136. # @see http://www.baidu.com/#wd=hds%20hls%20atc
  1137. #
  1138. # @remark when atc is on, auto off the time_jitter
  1139. # Overwrite by env SRS_VHOST_PLAY_ATC for all vhosts.
  1140. # default: off
  1141. atc off;
  1142. # whether use the interleaved/mixed algorithm to correct the timestamp.
  1143. # if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
  1144. # if off, use time_jitter to correct the timestamp if required.
  1145. # @remark to use mix_correct, atc should on(or time_jitter should off).
  1146. # Overwrite by env SRS_VHOST_PLAY_MIX_CORRECT for all vhosts.
  1147. # default: off
  1148. mix_correct off;
  1149. # whether enable the auto atc,
  1150. # if enabled, detect the bravo_atc="true" in onMetaData packet,
  1151. # set atc to on if matched.
  1152. # always ignore the onMetaData if atc_auto is off.
  1153. # Overwrite by env SRS_VHOST_PLAY_ATC_AUTO for all vhosts.
  1154. # default: off
  1155. atc_auto off;
  1156. # set the MW(merged-write) latency in ms.
  1157. # SRS always set mw on, so we just set the latency value.
  1158. # the latency of stream >= mw_latency + mr_latency
  1159. # the value recomment is [300, 1800]
  1160. # @remark For WebRTC, we enable pass-by-timestamp mode, so we ignore this config.
  1161. # default: 350 (For RTMP/HTTP-FLV)
  1162. # Overwrite by env SRS_VHOST_PLAY_MW_LATENCY for all vhosts.
  1163. # default: 0 (For WebRTC)
  1164. mw_latency 350;
  1165. # Set the MW(merged-write) min messages.
  1166. # default: 0 (For Real-Time, min_latency on)
  1167. # default: 1 (For WebRTC, min_latency off)
  1168. # default: 8 (For RTMP/HTTP-FLV, min_latency off).
  1169. # Overwrite by env SRS_VHOST_PLAY_MW_MSGS for all vhosts.
  1170. mw_msgs 8;
  1171. # the minimal packets send interval in ms,
  1172. # used to control the ndiff of stream by srs_rtmp_dump,
  1173. # for example, some device can only accept some stream which
  1174. # delivery packets in constant interval(not cbr).
  1175. # @remark 0 to disable the minimal interval.
  1176. # @remark >0 to make the srs to send message one by one.
  1177. # @remark user can get the right packets interval in ms by srs_rtmp_dump.
  1178. # Overwrite by env SRS_VHOST_PLAY_SEND_MIN_INTERVAL for all vhosts.
  1179. # default: 0
  1180. send_min_interval 10.0;
  1181. # whether reduce the sequence header,
  1182. # for some client which cannot got duplicated sequence header,
  1183. # while the sequence header is not changed yet.
  1184. # Overwrite by env SRS_VHOST_PLAY_REDUCE_SEQUENCE_HEADER for all vhosts.
  1185. # default: off
  1186. reduce_sequence_header on;
  1187. }
  1188. }
  1189. # vhost for time jitter
  1190. vhost jitter.srs.com {
  1191. # @see play.srs.com
  1192. # to use time_jitter full, the default config.
  1193. play {
  1194. }
  1195. # to use mix_correct.
  1196. play {
  1197. time_jitter off;
  1198. mix_correct on;
  1199. }
  1200. play {
  1201. atc on;
  1202. mix_correct on;
  1203. }
  1204. # to use atc
  1205. play {
  1206. atc on;
  1207. }
  1208. }
  1209. # vhost for atc.
  1210. vhost atc.srs.com {
  1211. # @see play.srs.com
  1212. play {
  1213. atc on;
  1214. atc_auto on;
  1215. }
  1216. }
  1217. # the MR(merged-read) setting for publisher.
  1218. # the MW(merged-write) settings for player.
  1219. vhost mrw.srs.com {
  1220. # @see scope.vhost.srs.com
  1221. min_latency off;
  1222. # @see play.srs.com
  1223. play {
  1224. mw_latency 350;
  1225. mw_msgs 8;
  1226. }
  1227. # @see publish.srs.com
  1228. publish {
  1229. mr on;
  1230. mr_latency 350;
  1231. }
  1232. }
  1233. # the vhost for min delay, do not cache any stream.
  1234. vhost min.delay.com {
  1235. # @see scope.vhost.srs.com
  1236. min_latency on;
  1237. # @see scope.vhost.srs.com
  1238. tcp_nodelay on;
  1239. # @see play.srs.com
  1240. play {
  1241. mw_latency 100;
  1242. mw_msgs 4;
  1243. gop_cache off;
  1244. queue_length 10;
  1245. }
  1246. # @see publish.srs.com
  1247. publish {
  1248. mr off;
  1249. }
  1250. }
  1251. # whether disable the sps parse, for the resolution of video.
  1252. vhost no.parse.sps.com {
  1253. # @see publish.srs.com
  1254. publish {
  1255. parse_sps on;
  1256. }
  1257. }
  1258. # the vhost to control the stream delivery feature
  1259. vhost stream.control.com {
  1260. # @see scope.vhost.srs.com
  1261. min_latency on;
  1262. # @see scope.vhost.srs.com
  1263. tcp_nodelay on;
  1264. # @see play.srs.com
  1265. play {
  1266. mw_latency 100;
  1267. mw_msgs 4;
  1268. queue_length 10;
  1269. send_min_interval 10.0;
  1270. reduce_sequence_header on;
  1271. }
  1272. # @see publish.srs.com
  1273. publish {
  1274. mr off;
  1275. firstpkt_timeout 20000;
  1276. normal_timeout 7000;
  1277. }
  1278. }
  1279. # the publish specified configs
  1280. vhost publish.srs.com {
  1281. # the config for FMLE/Flash publisher, which push RTMP to SRS.
  1282. publish {
  1283. # when enabled the mr, SRS will read as large as possible.
  1284. # Overwrite by env SRS_VHOST_PUBLISH_MR for all vhosts.
  1285. # default: off
  1286. mr off;
  1287. # the latency in ms for MR(merged-read),
  1288. # the performance+ when latency+, and memory+,
  1289. # memory(buffer) = latency * kbps / 8
  1290. # for example, latency=500ms, kbps=3000kbps, each publish connection will consume
  1291. # memory = 500 * 3000 / 8 = 187500B = 183KB
  1292. # when there are 2500 publisher, the total memory of SRS at least:
  1293. # 183KB * 2500 = 446MB
  1294. # the recommended value is [300, 2000]
  1295. # Overwrite by env SRS_VHOST_PUBLISH_MR_LATENCY for all vhosts.
  1296. # default: 350
  1297. mr_latency 350;
  1298. # the 1st packet timeout in ms for encoder.
  1299. # Overwrite by env SRS_VHOST_PUBLISH_FIRSTPKT_TIMEOUT for all vhosts.
  1300. # default: 20000
  1301. firstpkt_timeout 20000;
  1302. # the normal packet timeout in ms for encoder.
  1303. # Overwrite by env SRS_VHOST_PUBLISH_NORMAL_TIMEOUT for all vhosts.
  1304. # default: 5000
  1305. normal_timeout 7000;
  1306. # whether parse the sps when publish stream.
  1307. # we can got the resolution of video for stat api.
  1308. # but we may failed to cause publish failed.
  1309. # @remark If disabled, HLS might never update the sps/pps, it depends on this.
  1310. # Overwrite by env SRS_VHOST_PUBLISH_PARSE_SPS for all vhosts.
  1311. # default: on
  1312. parse_sps on;
  1313. # When parsing SPS/PPS, whether try ANNEXB first. If not, try IBMF first, then ANNEXB.
  1314. # Overwrite by env SRS_VHOST_PUBLISH_TRY_ANNEXB_FIRST for all vhosts.
  1315. # default: on
  1316. try_annexb_first on;
  1317. # The timeout in seconds to disconnect publisher when idle, which means no players.
  1318. # Note that 0 means no timeout or this feature is disabled.
  1319. # Note that this feature conflicts with forward, because it disconnect the publisher stream.
  1320. # Overwrite by env SRS_VHOST_PUBLISH_KICKOFF_FOR_IDLE for all vhosts.
  1321. # default: 0
  1322. kickoff_for_idle 0;
  1323. }
  1324. }
  1325. # the vhost for anti-suck.
  1326. vhost refer.anti_suck.com {
  1327. # refer hotlink-denial.
  1328. refer {
  1329. # whether enable the refer hotlink-denial.
  1330. # default: off.
  1331. enabled on;
  1332. # the common refer for play and publish.
  1333. # if the page url of client not in the refer, access denied.
  1334. # if not specified this field, allow all.
  1335. # default: not specified.
  1336. all github.com github.io;
  1337. # refer for publish clients specified.
  1338. # the common refer is not overridden by this.
  1339. # if not specified this field, allow all.
  1340. # default: not specified.
  1341. publish github.com github.io;
  1342. # refer for play clients specified.
  1343. # the common refer is not overridden by this.
  1344. # if not specified this field, allow all.
  1345. # default: not specified.
  1346. play github.com github.io;
  1347. }
  1348. }
  1349. # the security to allow or deny clients.
  1350. vhost security.srs.com {
  1351. # security for host to allow or deny clients.
  1352. security {
  1353. # whether enable the security for vhost.
  1354. # default: off
  1355. enabled on;
  1356. # the security list, each item format as:
  1357. # allow|deny publish|play all|<ip or cidr>
  1358. # for example:
  1359. # allow publish all;
  1360. # deny publish all;
  1361. # allow publish 127.0.0.1;
  1362. # deny publish 127.0.0.1;
  1363. # allow publish 10.0.0.0/8;
  1364. # deny publish 10.0.0.0/8;
  1365. # allow play all;
  1366. # deny play all;
  1367. # allow play 127.0.0.1;
  1368. # deny play 127.0.0.1;
  1369. # allow play 10.0.0.0/8;
  1370. # deny play 10.0.0.0/8;
  1371. # SRS apply the following simple strategies one by one:
  1372. # 1. allow all if security disabled.
  1373. # 2. default to deny all when security enabled.
  1374. # 3. allow if matches allow strategy.
  1375. # 4. deny if matches deny strategy.
  1376. allow play all;
  1377. allow publish all;
  1378. }
  1379. }
  1380. # vhost for http static and flv vod stream for each vhost.
  1381. vhost http.static.srs.com {
  1382. # http static vhost specified config
  1383. http_static {
  1384. # whether enabled the http static service for vhost.
  1385. # Overwrite by env SRS_VHOST_HTTP_STATIC_ENABLED for all vhosts.
  1386. # default: off
  1387. enabled on;
  1388. # the url to mount to,
  1389. # typical mount to [vhost]/
  1390. # the variables:
  1391. # [vhost] current vhost for http server.
  1392. # @remark the [vhost] is optional, used to mount at specified vhost.
  1393. # @remark the http of __defaultVhost__ will override the http_server section.
  1394. # for example:
  1395. # mount to [vhost]/
  1396. # access by http://ossrs.net:8080/xxx.html
  1397. # mount to [vhost]/hls
  1398. # access by http://ossrs.net:8080/hls/xxx.html
  1399. # mount to /
  1400. # access by http://ossrs.net:8080/xxx.html
  1401. # or by http://192.168.1.173:8080/xxx.html
  1402. # mount to /hls
  1403. # access by http://ossrs.net:8080/hls/xxx.html
  1404. # or by http://192.168.1.173:8080/hls/xxx.html
  1405. # @remark the port of http is specified by http_server section.
  1406. # Overwrite by env SRS_VHOST_HTTP_STATIC_MOUNT for all vhosts.
  1407. # default: [vhost]/
  1408. mount [vhost]/hls;
  1409. # main dir of vhost,
  1410. # to delivery HTTP stream of this vhost.
  1411. # default: ./objs/nginx/html
  1412. # Overwrite by env SRS_VHOST_HTTP_STATIC_DIR for all vhosts.
  1413. dir ./objs/nginx/html/hls;
  1414. }
  1415. }
  1416. # vhost for http flv/aac/mp3 live stream for each vhost.
  1417. vhost http.remux.srs.com {
  1418. # http flv/mp3/aac/ts stream vhost specified config
  1419. http_remux {
  1420. # whether enable the http live streaming service for vhost.
  1421. # Overwrite by env SRS_VHOST_HTTP_REMUX_ENABLED for all vhosts.
  1422. # default: off
  1423. enabled on;
  1424. # the fast cache for audio stream(mp3/aac),
  1425. # to cache more audio and send to client in a time to make android(weixin) happy.
  1426. # @remark the flv/ts stream ignore it
  1427. # @remark 0 to disable fast cache for http audio stream.
  1428. # Overwrite by env SRS_VHOST_HTTP_REMUX_FAST_CACHE for all vhosts.
  1429. # default: 0
  1430. fast_cache 30;
  1431. # Whether drop packet if not match header. For example, there is has_audio and has video flag in FLV header, if
  1432. # this is set to on and has_audio is false, then SRS will drop audio packets when got audio packets. Generally
  1433. # it should work, but sometimes you might need SRS to keep packets even when FLV header is set to false.
  1434. # See https://github.com/ossrs/srs/issues/939#issuecomment-1348740526
  1435. # TODO: Only support HTTP-FLV stream right now.
  1436. # Overwrite by env SRS_VHOST_HTTP_REMUX_DROP_IF_NOT_MATCH for all vhosts.
  1437. # Default: on
  1438. drop_if_not_match on;
  1439. # Whether stream has audio track, used as default value for stream metadata, for example, FLV header contains
  1440. # this flag. Sometimes you might want to force the metadata by disable guess_has_av.
  1441. # See https://github.com/ossrs/srs/issues/939#issuecomment-1351385460
  1442. # TODO: Only support HTTP-FLV stream right now.
  1443. # Overwrite by env SRS_VHOST_HTTP_REMUX_HAS_AUDIO for all vhosts.
  1444. # Default: on
  1445. has_audio on;
  1446. # Whether stream has video track, used as default value for stream metadata, for example, FLV header contains
  1447. # this flag. Sometimes you might want to force the metadata by disable guess_has_av.
  1448. # See https://github.com/ossrs/srs/issues/939#issuecomment-1351385460
  1449. # TODO: Only support HTTP-FLV stream right now.
  1450. # Overwrite by env SRS_VHOST_HTTP_REMUX_HAS_VIDEO for all vhosts.
  1451. # Default: on
  1452. has_video on;
  1453. # Whether guessing stream about audio or video track, used to generate the flags in, such as FLV header. If
  1454. # guessing, depends on sequence header and frames in gop cache, so it might be incorrect especially your stream
  1455. # is not regular. If not guessing, use the configured default value has_audio and has_video.
  1456. # See https://github.com/ossrs/srs/issues/939#issuecomment-1351385460
  1457. # TODO: Only support HTTP-FLV stream right now.
  1458. # Overwrite by env SRS_VHOST_HTTP_REMUX_GUESS_HAS_AV for all vhosts.
  1459. # Default: on
  1460. guess_has_av on;
  1461. # the stream mount for rtmp to remux to live streaming.
  1462. # typical mount to [vhost]/[app]/[stream].flv
  1463. # the variables:
  1464. # [vhost] current vhost for http live stream.
  1465. # [app] current app for http live stream.
  1466. # [stream] current stream for http live stream.
  1467. # @remark the [vhost] is optional, used to mount at specified vhost.
  1468. # the extension:
  1469. # .flv mount http live flv stream, use default gop cache.
  1470. # .ts mount http live ts stream, use default gop cache.
  1471. # .mp3 mount http live mp3 stream, ignore video and audio mp3 codec required.
  1472. # .aac mount http live aac stream, ignore video and audio aac codec required.
  1473. # for example:
  1474. # mount to [vhost]/[app]/[stream].flv
  1475. # access by http://ossrs.net:8080/live/livestream.flv
  1476. # mount to /[app]/[stream].flv
  1477. # access by http://ossrs.net:8080/live/livestream.flv
  1478. # or by http://192.168.1.173:8080/live/livestream.flv
  1479. # mount to [vhost]/[app]/[stream].mp3
  1480. # access by http://ossrs.net:8080/live/livestream.mp3
  1481. # mount to [vhost]/[app]/[stream].aac
  1482. # access by http://ossrs.net:8080/live/livestream.aac
  1483. # mount to [vhost]/[app]/[stream].ts
  1484. # access by http://ossrs.net:8080/live/livestream.ts
  1485. # @remark the port of http is specified by http_server section.
  1486. # Overwrite by env SRS_VHOST_HTTP_REMUX_MOUNT for all vhosts.
  1487. # default: [vhost]/[app]/[stream].flv
  1488. mount [vhost]/[app]/[stream].flv;
  1489. }
  1490. }
  1491. # the http hook callback vhost, srs will invoke the hooks for specified events.
  1492. vhost hooks.callback.srs.com {
  1493. http_hooks {
  1494. # whether the http hooks enable.
  1495. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ENABLED for all vhosts.
  1496. # default off.
  1497. enabled on;
  1498. # when client(encoder) publish to vhost/app/stream, call the hook,
  1499. # the request in the POST data string is a object encode by json:
  1500. # {
  1501. # "action": "on_publish",
  1502. # "client_id": "9308h583",
  1503. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1504. # "stream": "livestream", "param":"?token=xxx&salt=yyy", "server_id": "vid-werty",
  1505. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1506. # }
  1507. # if valid, the hook must return HTTP code 200(Status OK) and response
  1508. # an int value specifies the error code(0 corresponding to success):
  1509. # 0
  1510. # support multiple api hooks, format:
  1511. # on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
  1512. # @remark For SRS4, the HTTPS url is supported, for example:
  1513. # on_publish https://xxx/api0 https://xxx/api1 https://xxx/apiN
  1514. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_PUBLISH for all vhosts.
  1515. on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  1516. # when client(encoder) stop publish to vhost/app/stream, call the hook,
  1517. # the request in the POST data string is a object encode by json:
  1518. # {
  1519. # "action": "on_unpublish",
  1520. # "client_id": "9308h583",
  1521. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1522. # "stream": "livestream", "param":"?token=xxx&salt=yyy", "server_id": "vid-werty",
  1523. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1524. # }
  1525. # if valid, the hook must return HTTP code 200(Status OK) and response
  1526. # an int value specifies the error code(0 corresponding to success):
  1527. # 0
  1528. # support multiple api hooks, format:
  1529. # on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
  1530. # @remark For SRS4, the HTTPS url is supported, for example:
  1531. # on_unpublish https://xxx/api0 https://xxx/api1 https://xxx/apiN
  1532. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_UNPUBLISH for all vhosts.
  1533. on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  1534. # when client start to play vhost/app/stream, call the hook,
  1535. # the request in the POST data string is a object encode by json:
  1536. # {
  1537. # "action": "on_play",
  1538. # "client_id": "9308h583",
  1539. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1540. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  1541. # "pageUrl": "http://www.test.com/live.html", "server_id": "vid-werty",
  1542. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1543. # }
  1544. # if valid, the hook must return HTTP code 200(Status OK) and response
  1545. # an int value specifies the error code(0 corresponding to success):
  1546. # 0
  1547. # support multiple api hooks, format:
  1548. # on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
  1549. # @remark For SRS4, the HTTPS url is supported, for example:
  1550. # on_play https://xxx/api0 https://xxx/api1 https://xxx/apiN
  1551. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_PLAY for all vhosts.
  1552. on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  1553. # when client stop to play vhost/app/stream, call the hook,
  1554. # the request in the POST data string is a object encode by json:
  1555. # {
  1556. # "action": "on_stop",
  1557. # "client_id": "9308h583",
  1558. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1559. # "stream": "livestream", "param":"?token=xxx&salt=yyy", "server_id": "vid-werty",
  1560. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1561. # }
  1562. # if valid, the hook must return HTTP code 200(Status OK) and response
  1563. # an int value specifies the error code(0 corresponding to success):
  1564. # 0
  1565. # support multiple api hooks, format:
  1566. # on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
  1567. # @remark For SRS4, the HTTPS url is supported, for example:
  1568. # on_stop https://xxx/api0 https://xxx/api1 https://xxx/apiN
  1569. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_STOP for all vhosts.
  1570. on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  1571. # when srs reap a dvr file, call the hook,
  1572. # the request in the POST data string is a object encode by json:
  1573. # {
  1574. # "action": "on_dvr",
  1575. # "client_id": "9308h583",
  1576. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1577. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  1578. # "cwd": "/usr/local/srs",
  1579. # "file": "./objs/nginx/html/live/livestream.1420254068776.flv", "server_id": "vid-werty",
  1580. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1581. # }
  1582. # if valid, the hook must return HTTP code 200(Status OK) and response
  1583. # an int value specifies the error code(0 corresponding to success):
  1584. # 0
  1585. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_DVR for all vhosts.
  1586. on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
  1587. # when srs reap a ts file of hls, call the hook,
  1588. # the request in the POST data string is a object encode by json:
  1589. # {
  1590. # "action": "on_hls",
  1591. # "client_id": "9308h583",
  1592. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  1593. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  1594. # "duration": 9.36, // in seconds
  1595. # "cwd": "/usr/local/srs",
  1596. # "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
  1597. # "url": "live/livestream/2015-04-23/01/476584165.ts",
  1598. # "m3u8": "./objs/nginx/html/live/livestream/live.m3u8",
  1599. # "m3u8_url": "live/livestream/live.m3u8",
  1600. # "seq_no": 100, "server_id": "vid-werty",
  1601. # "stream_url": "video.test.com/live/livestream", "stream_id": "vid-124q9y3"
  1602. # }
  1603. # if valid, the hook must return HTTP code 200(Status OK) and response
  1604. # an int value specifies the error code(0 corresponding to success):
  1605. # 0
  1606. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_HLS for all vhosts.
  1607. on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls;
  1608. # when srs reap a ts file of hls, call this hook,
  1609. # used to push file to cdn network, by get the ts file from cdn network.
  1610. # so we use HTTP GET and use the variable following:
  1611. # [server_id], replace with the server_id
  1612. # [app], replace with the app.
  1613. # [stream], replace with the stream.
  1614. # [param], replace with the param.
  1615. # [ts_url], replace with the ts url.
  1616. # ignore any return data of server.
  1617. # @remark random select a url to report, not report all.
  1618. # Overwrite by env SRS_VHOST_HTTP_HOOKS_ON_HLS_NOTIFY for all vhosts.
  1619. on_hls_notify http://127.0.0.1:8085/api/v1/hls/[server_id]/[app]/[stream]/[ts_url][param];
  1620. }
  1621. }
  1622. # the vhost for exec, fork process when publish stream.
  1623. vhost exec.srs.com {
  1624. # the exec used to fork process when got some event.
  1625. exec {
  1626. # whether enable the exec.
  1627. # default: off.
  1628. enabled off;
  1629. # when publish stream, exec the process with variables:
  1630. # [vhost] the input stream vhost.
  1631. # [port] the input stream port.
  1632. # [app] the input stream app.
  1633. # [stream] the input stream name.
  1634. # [engine] the transcode engine name.
  1635. # other variables for exec only:
  1636. # [url] the rtmp url which trigger the publish.
  1637. # [tcUrl] the client request tcUrl.
  1638. # [swfUrl] the client request swfUrl.
  1639. # [pageUrl] the client request pageUrl.
  1640. # we also support datetime variables.
  1641. # [2006], replace this const to current year.
  1642. # [01], replace this const to current month.
  1643. # [02], replace this const to current date.
  1644. # [15], replace this const to current hour.
  1645. # [04], replace this const to current minute.
  1646. # [05], replace this const to current second.
  1647. # [999], replace this const to current millisecond.
  1648. # [timestamp],replace this const to current UNIX timestamp in ms.
  1649. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  1650. # @remark empty to ignore this exec.
  1651. publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
  1652. }
  1653. }
  1654. # The vhost for MPEG-DASH.
  1655. vhost dash.srs.com {
  1656. dash {
  1657. # Whether DASH is enabled.
  1658. # Transmux RTMP to DASH if on.
  1659. # Overwrite by env SRS_VHOST_DASH_ENABLED for all vhosts.
  1660. # Default: off
  1661. enabled on;
  1662. # The duration of segment in seconds.
  1663. # Overwrite by env SRS_VHOST_DASH_DASH_FRAGMENT for all vhosts.
  1664. # Default: 30
  1665. dash_fragment 30;
  1666. # The period to update the MPD in seconds.
  1667. # Overwrite by env SRS_VHOST_DASH_DASH_UPDATE_PERIOD for all vhosts.
  1668. # Default: 150
  1669. dash_update_period 150;
  1670. # The depth of timeshift buffer in seconds.
  1671. # Overwrite by env SRS_VHOST_DASH_DASH_TIMESHIFT for all vhosts.
  1672. # Default: 300
  1673. dash_timeshift 300;
  1674. # The base/home dir/path for dash.
  1675. # All init and segment files will write under this dir.
  1676. # Overwrite by env SRS_VHOST_DASH_DASH_PATH for all vhosts.
  1677. dash_path ./objs/nginx/html;
  1678. # The DASH MPD file path.
  1679. # We supports some variables to generate the filename.
  1680. # [vhost], the vhost of stream.
  1681. # [app], the app of stream.
  1682. # [stream], the stream name of stream.
  1683. # Overwrite by env SRS_VHOST_DASH_DASH_MPD_FILE for all vhosts.
  1684. # Default: [app]/[stream].mpd
  1685. dash_mpd_file [app]/[stream].mpd;
  1686. }
  1687. }
  1688. # the vhost with hls specified.
  1689. vhost hls.srs.com {
  1690. hls {
  1691. # whether the hls is enabled.
  1692. # if off, do not write hls(ts and m3u8) when publish.
  1693. # Overwrite by env SRS_VHOST_HLS_ENABLED for all vhosts.
  1694. # default: off
  1695. enabled on;
  1696. # the hls fragment in seconds, the duration of a piece of ts.
  1697. # Overwrite by env SRS_VHOST_HLS_HLS_FRAGMENT for all vhosts.
  1698. # default: 10
  1699. hls_fragment 10;
  1700. # the hls m3u8 target duration ratio,
  1701. # EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
  1702. # EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
  1703. # Overwrite by env SRS_VHOST_HLS_HLS_TD_RATIO for all vhosts.
  1704. # default: 1.0
  1705. hls_td_ratio 1.0;
  1706. # the audio overflow ratio.
  1707. # for pure audio, the duration to reap the segment.
  1708. # for example, the hls_fragment is 10s, hls_aof_ratio is 1.2,
  1709. # the segment will reap to 12s for pure audio.
  1710. # Overwrite by env SRS_VHOST_HLS_HLS_AOF_RATIO for all vhosts.
  1711. # default: 2.1
  1712. hls_aof_ratio 2.1;
  1713. # the hls window in seconds, the number of ts in m3u8.
  1714. # Overwrite by env SRS_VHOST_HLS_HLS_WINDOW for all vhosts.
  1715. # default: 60
  1716. hls_window 60;
  1717. # the error strategy. can be:
  1718. # ignore, disable the hls.
  1719. # disconnect, require encoder republish.
  1720. # continue, ignore failed try to continue output hls.
  1721. # Overwrite by env SRS_VHOST_HLS_HLS_ON_ERROR for all vhosts.
  1722. # default: continue
  1723. hls_on_error continue;
  1724. # the hls output path.
  1725. # the m3u8 file is configured by hls_path/hls_m3u8_file, the default is:
  1726. # ./objs/nginx/html/[app]/[stream].m3u8
  1727. # the ts file is configured by hls_path/hls_ts_file, the default is:
  1728. # ./objs/nginx/html/[app]/[stream]-[seq].ts
  1729. # @remark the hls_path is compatible with srs v1 config.
  1730. # Overwrite by env SRS_VHOST_HLS_HLS_PATH for all vhosts.
  1731. # default: ./objs/nginx/html
  1732. hls_path ./objs/nginx/html;
  1733. # the hls m3u8 file name.
  1734. # we supports some variables to generate the filename.
  1735. # [vhost], the vhost of stream.
  1736. # [app], the app of stream.
  1737. # [stream], the stream name of stream.
  1738. # Overwrite by env SRS_VHOST_HLS_HLS_M3U8_FILE for all vhosts.
  1739. # default: [app]/[stream].m3u8
  1740. hls_m3u8_file [app]/[stream].m3u8;
  1741. # the hls ts file name.
  1742. # we supports some variables to generate the filename.
  1743. # [vhost], the vhost of stream.
  1744. # [app], the app of stream.
  1745. # [stream], the stream name of stream.
  1746. # [2006], replace this const to current year.
  1747. # [01], replace this const to current month.
  1748. # [02], replace this const to current date.
  1749. # [15], replace this const to current hour.
  1750. # [04], replace this const to current minute.
  1751. # [05], replace this const to current second.
  1752. # [999], replace this const to current millisecond.
  1753. # [timestamp],replace this const to current UNIX timestamp in ms.
  1754. # [seq], the sequence number of ts.
  1755. # [duration], replace this const to current ts duration.
  1756. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path
  1757. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls#hls-config
  1758. # Overwrite by env SRS_VHOST_HLS_HLS_TS_FILE for all vhosts.
  1759. # default: [app]/[stream]-[seq].ts
  1760. hls_ts_file [app]/[stream]-[seq].ts;
  1761. # the hls entry prefix, which is base url of ts url.
  1762. # for example, the prefix is:
  1763. # http://your-server/
  1764. # then, the ts path in m3u8 will be like:
  1765. # http://your-server/live/livestream-0.ts
  1766. # http://your-server/live/livestream-1.ts
  1767. # ...
  1768. # Overwrite by env SRS_VHOST_HLS_HLS_ENTRY_PREFIX for all vhosts.
  1769. # optional, default to empty string.
  1770. hls_entry_prefix http://your-server;
  1771. # the default audio codec of hls.
  1772. # when codec changed, write the PAT/PMT table, but maybe ok util next ts.
  1773. # so user can set the default codec for mp3.
  1774. # the available audio codec:
  1775. # aac, mp3, an
  1776. # Overwrite by env SRS_VHOST_HLS_HLS_ACODEC for all vhosts.
  1777. # default: aac
  1778. hls_acodec aac;
  1779. # the default video codec of hls.
  1780. # when codec changed, write the PAT/PMT table, but maybe ok util next ts.
  1781. # so user can set the default codec for pure audio(without video) to vn.
  1782. # the available video codec:
  1783. # h264, vn
  1784. # Overwrite by env SRS_VHOST_HLS_HLS_VCODEC for all vhosts.
  1785. # default: h264
  1786. hls_vcodec h264;
  1787. # whether cleanup the old expired ts files.
  1788. # Overwrite by env SRS_VHOST_HLS_HLS_CLEANUP for all vhosts.
  1789. # default: on
  1790. hls_cleanup on;
  1791. # If there is no incoming packets, dispose HLS in this timeout in seconds,
  1792. # which removes all HLS files including m3u8 and ts files.
  1793. # @remark 0 to disable dispose for publisher.
  1794. # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose hls.
  1795. # Overwrite by env SRS_VHOST_HLS_HLS_DISPOSE for all vhosts.
  1796. # default: 120
  1797. hls_dispose 120;
  1798. # whether wait keyframe to reap segment,
  1799. # if off, reap segment when duration exceed the fragment,
  1800. # if on, reap segment when duration exceed and got keyframe.
  1801. # Overwrite by env SRS_VHOST_HLS_HLS_WAIT_KEYFRAME for all vhosts.
  1802. # default: on
  1803. hls_wait_keyframe on;
  1804. # whether use floor for the hls_ts_file path generation.
  1805. # if on, use floor(timestamp/hls_fragment) as the variable [timestamp],
  1806. # and use enhanced algorithm to calc deviation for segment.
  1807. # @remark when floor on, recommend the hls_segment>=2*gop.
  1808. # Overwrite by env SRS_VHOST_HLS_HLS_TS_FLOOR for all vhosts.
  1809. # default: off
  1810. hls_ts_floor off;
  1811. # the max size to notify hls,
  1812. # to read max bytes from ts of specified cdn network,
  1813. # @remark only used when on_hls_notify is config.
  1814. # Overwrite by env SRS_VHOST_HLS_HLS_NB_NOTIFY for all vhosts.
  1815. # default: 64
  1816. hls_nb_notify 64;
  1817. # Whether enable hls_ctx for HLS streaming, for which we create a "fake" connection for HTTP API and callback.
  1818. # For each HLS streaming session, we use a child m3u8 with a session identified by query "hls_ctx", it simply
  1819. # work as the session id.
  1820. # Once the HLS streaming session is created, we will cleanup it when timeout in 2*hls_window seconds. So it
  1821. # takes a long time period to identify the timeout.
  1822. # Now we got a HLS stremaing session, just like RTMP/WebRTC/HTTP-FLV streaming, we're able to stat the session
  1823. # as a "fake" connection, do HTTP callback when start playing the HLS streaming. You're able to do querying and
  1824. # authentication.
  1825. # Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
  1826. # Overwrite by env SRS_VHOST_HLS_HLS_CTX for all vhosts.
  1827. # Default: on
  1828. hls_ctx on;
  1829. # For HLS pseudo streaming, whether enable the session for each TS segment.
  1830. # If enabled, SRS HTTP API will show the statistics about HLS streaming bandwidth, both m3u8 and ts file. Please
  1831. # note that it also consumes resource, because each ts file should be served by SRS, all NGINX cache will be
  1832. # missed because we add session id to each ts file.
  1833. # Note that it will make NGINX edge cache always missed, so never enable HLS streaming if use NGINX edges.
  1834. # Overwrite by env SRS_VHOST_HLS_HLS_TS_CTX for all vhosts.
  1835. # Default: on
  1836. hls_ts_ctx on;
  1837. # whether using AES encryption.
  1838. # Overwrite by env SRS_VHOST_HLS_HLS_KEYS for all vhosts.
  1839. # default: off
  1840. hls_keys on;
  1841. # the number of clear ts which one key can encrypt.
  1842. # Overwrite by env SRS_VHOST_HLS_HLS_FRAGMENTS_PER_KEY for all vhosts.
  1843. # default: 5
  1844. hls_fragments_per_key 5;
  1845. # the hls key file name.
  1846. # we supports some variables to generate the filename.
  1847. # [vhost], the vhost of stream.
  1848. # [app], the app of stream.
  1849. # [stream], the stream name of stream.
  1850. # [seq], the sequence number of key corresponding to the ts.
  1851. # Overwrite by env SRS_VHOST_HLS_HLS_KEY_FILE for all vhosts.
  1852. hls_key_file [app]/[stream]-[seq].key;
  1853. # the key output path.
  1854. # the key file is configed by hls_path/hls_key_file, the default is:
  1855. # ./objs/nginx/html/[app]/[stream]-[seq].key
  1856. # Overwrite by env SRS_VHOST_HLS_HLS_KEY_FILE_PATH for all vhosts.
  1857. hls_key_file_path ./objs/nginx/html;
  1858. # the key root URL, use this can support https.
  1859. # @remark It's optional.
  1860. # Overwrite by env SRS_VHOST_HLS_HLS_KEY_URL for all vhosts.
  1861. hls_key_url https://localhost:8080;
  1862. # Special control controls.
  1863. ###########################################
  1864. # Whether calculate the DTS of audio frame directly.
  1865. # If on, guess the specific DTS by AAC samples, please read https://github.com/ossrs/srs/issues/547#issuecomment-294350544
  1866. # If off, directly turn the FLV timestamp to DTS, which might cause corrupt audio stream.
  1867. # @remark Recommend to set to off, unless your audio stream sample-rate and timestamp is not correct.
  1868. # Overwrite by env SRS_VHOST_HLS_HLS_DTS_DIRECTLY for all vhosts.
  1869. # Default: on
  1870. hls_dts_directly on;
  1871. # on_hls, never config in here, should config in http_hooks.
  1872. # for the hls http callback, @see http_hooks.on_hls of vhost hooks.callback.srs.com
  1873. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls#http-callback
  1874. # @see https://ossrs.io/lts/en-us/docs/v4/doc/delivery-hls#http-callback
  1875. # on_hls_notify, never config in here, should config in http_hooks.
  1876. # we support the variables to generate the notify url:
  1877. # [app], replace with the app.
  1878. # [stream], replace with the stream.
  1879. # [param], replace with the param.
  1880. # [ts_url], replace with the ts url.
  1881. # for the hls http callback, @see http_hooks.on_hls_notify of vhost hooks.callback.srs.com
  1882. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/delivery-hls#on-hls-notify
  1883. # @see https://ossrs.io/lts/en-us/docs/v4/doc/delivery-hls#on-hls-notify
  1884. }
  1885. }
  1886. # the vhost with hls disabled.
  1887. vhost no-hls.srs.com {
  1888. hls {
  1889. # whether the hls is enabled.
  1890. # if off, do not write hls(ts and m3u8) when publish.
  1891. # default: off
  1892. enabled off;
  1893. }
  1894. }
  1895. # the vhost with adobe hds
  1896. vhost hds.srs.com {
  1897. hds {
  1898. # whether hds enabled
  1899. # Overwrite by env SRS_VHOST_HDS_ENABLED for all vhosts.
  1900. # default: off
  1901. enabled on;
  1902. # the hds fragment in seconds.
  1903. # Overwrite by env SRS_VHOST_HDS_HDS_FRAGMENT for all vhosts.
  1904. # default: 10
  1905. hds_fragment 10;
  1906. # the hds window in seconds, erase the segment when exceed the window.
  1907. # Overwrite by env SRS_VHOST_HDS_HDS_WINDOW for all vhosts.
  1908. # default: 60
  1909. hds_window 60;
  1910. # the path to store the hds files.
  1911. # Overwrite by env SRS_VHOST_HDS_HDS_PATH for all vhosts.
  1912. # default: ./objs/nginx/html
  1913. hds_path ./objs/nginx/html;
  1914. }
  1915. }
  1916. # vhost for dvr
  1917. vhost dvr.srs.com {
  1918. # DVR RTMP stream to file,
  1919. # start to record to file when encoder publish,
  1920. # reap flv/mp4 according by specified dvr_plan.
  1921. dvr {
  1922. # whether enabled dvr features
  1923. # Overwrite by env SRS_VHOST_DVR_ENABLED for all vhosts.
  1924. # default: off
  1925. enabled on;
  1926. # the filter for dvr to apply to.
  1927. # all, dvr all streams of all apps.
  1928. # <app>/<stream>, apply to specified stream of app.
  1929. # for example, to dvr the following two streams:
  1930. # live/stream1 live/stream2
  1931. # @remark Reload is disabled, @see https://github.com/ossrs/srs/issues/2181
  1932. # default: all
  1933. dvr_apply all;
  1934. # the dvr plan. canbe:
  1935. # session reap flv/mp4 when session end(unpublish).
  1936. # segment reap flv/mp4 when flv duration exceed the specified dvr_duration.
  1937. # @remark The plan append is removed in SRS3+, for it's no use.
  1938. # Overwrite by env SRS_VHOST_DVR_DVR_PLAN for all vhosts.
  1939. # default: session
  1940. dvr_plan session;
  1941. # the dvr output path, *.flv or *.mp4.
  1942. # we supports some variables to generate the filename.
  1943. # [vhost], the vhost of stream.
  1944. # [app], the app of stream.
  1945. # [stream], the stream name of stream.
  1946. # [2006], replace this const to current year.
  1947. # [01], replace this const to current month.
  1948. # [02], replace this const to current date.
  1949. # [15], replace this const to current hour.
  1950. # [04], replace this const to current minute.
  1951. # [05], replace this const to current second.
  1952. # [999], replace this const to current millisecond.
  1953. # [timestamp],replace this const to current UNIX timestamp in ms.
  1954. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  1955. # for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776
  1956. # 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename):
  1957. # dvr_path ./objs/nginx/html;
  1958. # =>
  1959. # dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv;
  1960. # 2. Use stream and date as dir name, time as filename:
  1961. # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
  1962. # =>
  1963. # dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv;
  1964. # 3. Use stream and year/month as dir name, date and time as filename:
  1965. # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv;
  1966. # =>
  1967. # dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv;
  1968. # 4. Use vhost/app and year/month as dir name, stream/date/time as filename:
  1969. # dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv;
  1970. # =>
  1971. # dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv;
  1972. # 5. DVR to mp4:
  1973. # dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].mp4;
  1974. # =>
  1975. # dvr_path ./objs/nginx/html/live/livestream.1420254068776.mp4;
  1976. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#custom-path
  1977. # @see https://ossrs.io/lts/en-us/docs/v4/doc/dvr#custom-path
  1978. # segment,session apply it.
  1979. # Overwrite by env SRS_VHOST_DVR_DVR_PATH for all vhosts.
  1980. # default: ./objs/nginx/html/[app]/[stream].[timestamp].flv
  1981. dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
  1982. # the duration for dvr file, reap if exceed, in seconds.
  1983. # segment apply it.
  1984. # session,append ignore.
  1985. # Overwrite by env SRS_VHOST_DVR_DVR_DURATION for all vhosts.
  1986. # default: 30
  1987. dvr_duration 30;
  1988. # whether wait keyframe to reap segment,
  1989. # if off, reap segment when duration exceed the dvr_duration,
  1990. # if on, reap segment when duration exceed and got keyframe.
  1991. # segment apply it.
  1992. # session,append ignore.
  1993. # Overwrite by env SRS_VHOST_DVR_DVR_WAIT_KEYFRAME for all vhosts.
  1994. # default: on
  1995. dvr_wait_keyframe on;
  1996. # about the stream monotonically increasing:
  1997. # 1. video timestamp is monotonically increasing,
  1998. # 2. audio timestamp is monotonically increasing,
  1999. # 3. video and audio timestamp is interleaved monotonically increasing.
  2000. # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
  2001. # however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
  2002. # the time jitter algorithm:
  2003. # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
  2004. # 2. zero, only ensure stream start at zero, ignore timestamp jitter.
  2005. # 3. off, disable the time jitter algorithm, like atc.
  2006. # apply for all dvr plan.
  2007. # Overwrite by env SRS_VHOST_DVR_TIME_JITTER for all vhosts.
  2008. # default: full
  2009. time_jitter full;
  2010. # on_dvr, never config in here, should config in http_hooks.
  2011. # for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com
  2012. # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/dvr#http-callback
  2013. # @see https://ossrs.io/lts/en-us/docs/v4/doc/dvr#http-callback
  2014. }
  2015. }
  2016. # vhost for ingest
  2017. vhost ingest.srs.com {
  2018. # ingest file/stream/device then push to SRS over RTMP.
  2019. # the name/id used to identify the ingest, must be unique in global.
  2020. # ingest id is used in reload or http api management.
  2021. # @remark vhost can contains multiple ingest
  2022. ingest livestream {
  2023. # whether enabled ingest features
  2024. # default: off
  2025. enabled on;
  2026. # input file/stream/device
  2027. # @remark only support one input.
  2028. input {
  2029. # the type of input.
  2030. # can be file/stream/device, that is,
  2031. # file: ingest file specified by url.
  2032. # stream: ingest stream specified by url.
  2033. # device: not support yet.
  2034. # default: file
  2035. type file;
  2036. # the url of file/stream.
  2037. url ./doc/source.200kbps.768x320.flv;
  2038. }
  2039. # the ffmpeg
  2040. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2041. # the transcode engine, @see all.transcode.srs.com
  2042. # @remark, the output is specified following.
  2043. engine {
  2044. # @see enabled of transcode engine.
  2045. # if disabled or vcodec/acodec not specified, use copy.
  2046. # default: off.
  2047. enabled off;
  2048. # output stream. variables:
  2049. # [vhost] current vhost which start the ingest.
  2050. # [port] system RTMP stream port.
  2051. # we also support datetime variables.
  2052. # [2006], replace this const to current year.
  2053. # [01], replace this const to current month.
  2054. # [02], replace this const to current date.
  2055. # [15], replace this const to current hour.
  2056. # [04], replace this const to current minute.
  2057. # [05], replace this const to current second.
  2058. # [999], replace this const to current millisecond.
  2059. # [timestamp],replace this const to current UNIX timestamp in ms.
  2060. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  2061. output rtmp://127.0.0.1:[port]/live/livestream?vhost=[vhost];
  2062. }
  2063. }
  2064. }
  2065. # the vhost for ingest with transcode engine.
  2066. vhost transcode.ingest.srs.com {
  2067. ingest livestream {
  2068. enabled on;
  2069. input {
  2070. type file;
  2071. url ./doc/source.200kbps.768x320.flv;
  2072. }
  2073. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2074. engine {
  2075. enabled off;
  2076. perfile {
  2077. re;
  2078. rtsp_transport tcp;
  2079. }
  2080. iformat flv;
  2081. vfilter {
  2082. i ./doc/ffmpeg-logo.png;
  2083. filter_complex 'overlay=10:10';
  2084. }
  2085. vcodec libx264;
  2086. vbitrate 1500;
  2087. vfps 25;
  2088. vwidth 768;
  2089. vheight 320;
  2090. vthreads 12;
  2091. vprofile main;
  2092. vpreset medium;
  2093. vparams {
  2094. t 100;
  2095. coder 1;
  2096. b_strategy 2;
  2097. bf 3;
  2098. refs 10;
  2099. }
  2100. acodec libfdk_aac;
  2101. abitrate 70;
  2102. asample_rate 44100;
  2103. achannels 2;
  2104. aparams {
  2105. profile:a aac_low;
  2106. }
  2107. oformat flv;
  2108. output rtmp://127.0.0.1:[port]/[app]/[stream]?vhost=[vhost];
  2109. }
  2110. }
  2111. }
  2112. # the main comments for transcode
  2113. vhost example.transcode.srs.com {
  2114. # the streaming transcode configs.
  2115. # @remark vhost can contains multiple transcode
  2116. transcode {
  2117. # whether the transcode enabled.
  2118. # if off, donot transcode.
  2119. # default: off.
  2120. enabled on;
  2121. # the ffmpeg
  2122. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2123. # the transcode engine for matched stream.
  2124. # all matched stream will transcoded to the following stream.
  2125. # the transcode set name(ie. hd) is optional and not used.
  2126. # we will build the parameters to fork ffmpeg:
  2127. # ffmpeg <perfile>
  2128. # -i <iformat>
  2129. # <vfilter>
  2130. # -vcodec <vcodec> -b:v <vbitrate> -r <vfps> -s <vwidth>x<vheight> -profile:v <vprofile> -preset <vpreset>
  2131. # <vparams>
  2132. # -acodec <acodec> -b:a <abitrate> -ar <asample_rate> -ac <achannels>
  2133. # <aparams>
  2134. # -f <oformat>
  2135. # -y <output>
  2136. engine example {
  2137. # whether the engine is enabled
  2138. # default: off.
  2139. enabled on;
  2140. # pre-file options, before "-i"
  2141. perfile {
  2142. re;
  2143. rtsp_transport tcp;
  2144. }
  2145. # input format "-i", can be:
  2146. # off, do not specifies the format, ffmpeg will guess it.
  2147. # flv, for flv or RTMP stream.
  2148. # other format, for example, mp4/aac whatever.
  2149. # default: flv
  2150. iformat flv;
  2151. # ffmpeg filters, between "-i" and "-vcodec"
  2152. # follows the main input.
  2153. vfilter {
  2154. # the logo input file.
  2155. i ./doc/ffmpeg-logo.png;
  2156. # the ffmpeg complex filter.
  2157. # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
  2158. filter_complex 'overlay=10:10';
  2159. }
  2160. # video encoder name, "ffmpeg -vcodec"
  2161. # can be:
  2162. # libx264: use h.264(libx264) video encoder.
  2163. # png: use png to snapshot thumbnail.
  2164. # copy: donot encoder the video stream, copy it.
  2165. # vn: disable video output.
  2166. vcodec libx264;
  2167. # video bitrate, in kbps, "ffmepg -b:v"
  2168. # @remark 0 to use source video bitrate.
  2169. # default: 0
  2170. vbitrate 1500;
  2171. # video framerate, "ffmepg -r"
  2172. # @remark 0 to use source video fps.
  2173. # default: 0
  2174. vfps 25;
  2175. # video width, must be even numbers, "ffmepg -s"
  2176. # @remark 0 to use source video width.
  2177. # default: 0
  2178. vwidth 768;
  2179. # video height, must be even numbers, "ffmepg -s"
  2180. # @remark 0 to use source video height.
  2181. # default: 0
  2182. vheight 320;
  2183. # the max threads for ffmpeg to used, "ffmepg -thread"
  2184. # default: 1
  2185. vthreads 12;
  2186. # x264 profile, "ffmepg -profile:v"
  2187. # @see x264 -help, can be:
  2188. # high,main,baseline
  2189. vprofile main;
  2190. # x264 preset, "ffmpeg -preset"
  2191. # @see x264 -help, can be:
  2192. # ultrafast,superfast,veryfast,faster,fast
  2193. # medium,slow,slower,veryslow,placebo
  2194. vpreset medium;
  2195. # other x264 or ffmpeg video params, between "-preset" and "-acodec"
  2196. vparams {
  2197. # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
  2198. t 100;
  2199. # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
  2200. coder 1;
  2201. b_strategy 2;
  2202. bf 3;
  2203. refs 10;
  2204. }
  2205. # audio encoder name, "ffmpeg -acodec"
  2206. # can be:
  2207. # libfdk_aac: use aac(libfdk_aac) audio encoder.
  2208. # copy: donot encoder the audio stream, copy it.
  2209. # an: disable audio output.
  2210. acodec libfdk_aac;
  2211. # audio bitrate, in kbps, "ffmpeg -b:a"
  2212. # [16, 72] for libfdk_aac.
  2213. # @remark 0 to use source audio bitrate.
  2214. # default: 0
  2215. abitrate 70;
  2216. # audio sample rate, "ffmpeg -ar"
  2217. # for flv/rtmp, it must be:
  2218. # 44100,22050,11025,5512
  2219. # @remark 0 to use source audio sample rate.
  2220. # default: 0
  2221. asample_rate 44100;
  2222. # audio channel, "ffmpeg -ac"
  2223. # 1 for mono, 2 for stereo.
  2224. # @remark 0 to use source audio channels.
  2225. # default: 0
  2226. achannels 2;
  2227. # other ffmpeg audio params, between "-ac" and "-f"/"-y"
  2228. aparams {
  2229. # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
  2230. # @remark SRS supported aac profile for HLS is: aac_low, aac_he, aac_he_v2
  2231. profile:a aac_low;
  2232. bsf:a aac_adtstoasc;
  2233. }
  2234. # output format, "ffmpeg -f" can be:
  2235. # off, do not specifies the format, ffmpeg will guess it.
  2236. # flv, for flv or RTMP stream.
  2237. # image2, for vcodec png to snapshot thumbnail.
  2238. # other format, for example, mp4/aac whatever.
  2239. # default: flv
  2240. oformat flv;
  2241. # output stream, "ffmpeg -y", variables:
  2242. # [vhost] the input stream vhost.
  2243. # [port] the input stream port.
  2244. # [app] the input stream app.
  2245. # [stream] the input stream name.
  2246. # [engine] the transcode engine name.
  2247. # [param] the input stream query string.
  2248. # we also support datetime variables.
  2249. # [2006], replace this const to current year.
  2250. # [01], replace this const to current month.
  2251. # [02], replace this const to current date.
  2252. # [15], replace this const to current hour.
  2253. # [04], replace this const to current minute.
  2254. # [05], replace this const to current second.
  2255. # [999], replace this const to current millisecond.
  2256. # [timestamp],replace this const to current UNIX timestamp in ms.
  2257. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  2258. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2259. }
  2260. }
  2261. }
  2262. # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
  2263. vhost mirror.transcode.srs.com {
  2264. transcode {
  2265. enabled on;
  2266. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2267. engine mirror {
  2268. enabled on;
  2269. vfilter {
  2270. vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
  2271. }
  2272. vcodec libx264;
  2273. vbitrate 300;
  2274. vfps 20;
  2275. vwidth 768;
  2276. vheight 320;
  2277. vthreads 2;
  2278. vprofile baseline;
  2279. vpreset superfast;
  2280. vparams {
  2281. }
  2282. acodec libfdk_aac;
  2283. abitrate 45;
  2284. asample_rate 44100;
  2285. achannels 2;
  2286. aparams {
  2287. }
  2288. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2289. }
  2290. }
  2291. }
  2292. # the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
  2293. # remark: we remove the libfreetype which always cause build failed, you must add it manual if needed.
  2294. #######################################################################################################
  2295. # the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
  2296. vhost crop.transcode.srs.com {
  2297. transcode {
  2298. enabled on;
  2299. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2300. engine crop {
  2301. enabled on;
  2302. vfilter {
  2303. vf 'crop=in_w-20:in_h-160:10:80';
  2304. }
  2305. vcodec libx264;
  2306. vbitrate 300;
  2307. vfps 20;
  2308. vwidth 768;
  2309. vheight 320;
  2310. vthreads 2;
  2311. vprofile baseline;
  2312. vpreset superfast;
  2313. vparams {
  2314. }
  2315. acodec libfdk_aac;
  2316. abitrate 45;
  2317. asample_rate 44100;
  2318. achannels 2;
  2319. aparams {
  2320. }
  2321. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2322. }
  2323. }
  2324. }
  2325. # the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
  2326. vhost logo.transcode.srs.com {
  2327. transcode {
  2328. enabled on;
  2329. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2330. engine logo {
  2331. enabled on;
  2332. vfilter {
  2333. i ./doc/ffmpeg-logo.png;
  2334. filter_complex 'overlay=10:10';
  2335. }
  2336. vcodec libx264;
  2337. vbitrate 300;
  2338. vfps 20;
  2339. vwidth 768;
  2340. vheight 320;
  2341. vthreads 2;
  2342. vprofile baseline;
  2343. vpreset superfast;
  2344. vparams {
  2345. }
  2346. acodec libfdk_aac;
  2347. abitrate 45;
  2348. asample_rate 44100;
  2349. achannels 2;
  2350. aparams {
  2351. }
  2352. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2353. }
  2354. }
  2355. }
  2356. # audio transcode only.
  2357. # for example, FMLE publish audio codec in mp3, and do not support HLS output,
  2358. # we can transcode the audio to aac and copy video to the new stream with HLS.
  2359. vhost audio.transcode.srs.com {
  2360. transcode {
  2361. enabled on;
  2362. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2363. engine acodec {
  2364. enabled on;
  2365. vcodec copy;
  2366. acodec libfdk_aac;
  2367. abitrate 45;
  2368. asample_rate 44100;
  2369. achannels 2;
  2370. aparams {
  2371. }
  2372. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2373. }
  2374. }
  2375. }
  2376. # disable video, transcode/copy audio.
  2377. # for example, publish pure audio stream.
  2378. vhost vn.transcode.srs.com {
  2379. transcode {
  2380. enabled on;
  2381. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2382. engine vn {
  2383. enabled on;
  2384. vcodec vn;
  2385. acodec libfdk_aac;
  2386. abitrate 45;
  2387. asample_rate 44100;
  2388. achannels 2;
  2389. aparams {
  2390. }
  2391. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2392. }
  2393. }
  2394. }
  2395. # ffmpeg-copy(forward implements by ffmpeg).
  2396. # copy the video and audio to a new stream.
  2397. vhost copy.transcode.srs.com {
  2398. transcode {
  2399. enabled on;
  2400. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2401. engine copy {
  2402. enabled on;
  2403. vcodec copy;
  2404. acodec copy;
  2405. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2406. }
  2407. }
  2408. }
  2409. # forward the input stream query string to output
  2410. vhost param.transcode.srs.com {
  2411. transcode {
  2412. enabled on;
  2413. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2414. engine copy {
  2415. enabled on;
  2416. vcodec copy;
  2417. acodec copy;
  2418. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine][param];
  2419. }
  2420. }
  2421. }
  2422. # transcode all app and stream of vhost
  2423. # the comments, read example.transcode.srs.com
  2424. vhost all.transcode.srs.com {
  2425. transcode {
  2426. enabled on;
  2427. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2428. engine ffsuper {
  2429. enabled on;
  2430. iformat flv;
  2431. vfilter {
  2432. i ./doc/ffmpeg-logo.png;
  2433. filter_complex 'overlay=10:10';
  2434. }
  2435. vcodec libx264;
  2436. vbitrate 1500;
  2437. vfps 25;
  2438. vwidth 768;
  2439. vheight 320;
  2440. vthreads 12;
  2441. vprofile main;
  2442. vpreset medium;
  2443. vparams {
  2444. t 100;
  2445. coder 1;
  2446. b_strategy 2;
  2447. bf 3;
  2448. refs 10;
  2449. }
  2450. acodec libfdk_aac;
  2451. abitrate 70;
  2452. asample_rate 44100;
  2453. achannels 2;
  2454. aparams {
  2455. profile:a aac_low;
  2456. }
  2457. oformat flv;
  2458. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2459. }
  2460. engine ffhd {
  2461. enabled on;
  2462. vcodec libx264;
  2463. vbitrate 1200;
  2464. vfps 25;
  2465. vwidth 1382;
  2466. vheight 576;
  2467. vthreads 6;
  2468. vprofile main;
  2469. vpreset medium;
  2470. vparams {
  2471. }
  2472. acodec libfdk_aac;
  2473. abitrate 70;
  2474. asample_rate 44100;
  2475. achannels 2;
  2476. aparams {
  2477. }
  2478. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2479. }
  2480. engine ffsd {
  2481. enabled on;
  2482. vcodec libx264;
  2483. vbitrate 800;
  2484. vfps 25;
  2485. vwidth 1152;
  2486. vheight 480;
  2487. vthreads 4;
  2488. vprofile main;
  2489. vpreset fast;
  2490. vparams {
  2491. }
  2492. acodec libfdk_aac;
  2493. abitrate 60;
  2494. asample_rate 44100;
  2495. achannels 2;
  2496. aparams {
  2497. }
  2498. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2499. }
  2500. engine fffast {
  2501. enabled on;
  2502. vcodec libx264;
  2503. vbitrate 300;
  2504. vfps 20;
  2505. vwidth 768;
  2506. vheight 320;
  2507. vthreads 2;
  2508. vprofile baseline;
  2509. vpreset superfast;
  2510. vparams {
  2511. }
  2512. acodec libfdk_aac;
  2513. abitrate 45;
  2514. asample_rate 44100;
  2515. achannels 2;
  2516. aparams {
  2517. }
  2518. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2519. }
  2520. engine vcopy {
  2521. enabled on;
  2522. vcodec copy;
  2523. acodec libfdk_aac;
  2524. abitrate 45;
  2525. asample_rate 44100;
  2526. achannels 2;
  2527. aparams {
  2528. }
  2529. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2530. }
  2531. engine acopy {
  2532. enabled on;
  2533. vcodec libx264;
  2534. vbitrate 300;
  2535. vfps 20;
  2536. vwidth 768;
  2537. vheight 320;
  2538. vthreads 2;
  2539. vprofile baseline;
  2540. vpreset superfast;
  2541. vparams {
  2542. }
  2543. acodec copy;
  2544. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2545. }
  2546. engine copy {
  2547. enabled on;
  2548. vcodec copy;
  2549. acodec copy;
  2550. output rtmp://127.0.0.1:[port]/[app]/[stream]_[engine]?vhost=[vhost];
  2551. }
  2552. }
  2553. }
  2554. # transcode all app and stream of app
  2555. vhost app.transcode.srs.com {
  2556. # the streaming transcode configs.
  2557. # if app specified, transcode all streams of app.
  2558. transcode live {
  2559. enabled on;
  2560. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2561. engine {
  2562. enabled off;
  2563. }
  2564. }
  2565. }
  2566. # transcode specified stream.
  2567. vhost stream.transcode.srs.com {
  2568. # the streaming transcode configs.
  2569. # if stream specified, transcode the matched stream.
  2570. transcode live/livestream {
  2571. enabled on;
  2572. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  2573. engine {
  2574. enabled off;
  2575. }
  2576. }
  2577. }
  2578. #############################################################################################
  2579. # In the config file, the include file can be anywhere in order to enhance the readability
  2580. # of the config file and enable the reuse of part of the config file.
  2581. # When using include files, make sure that the included files themselves have the correct SRS syntax,
  2582. # that is, config directives and blocks, and then specify the paths to these files.
  2583. #
  2584. # @see https://github.com/ossrs/srs/issues/1399
  2585. #############################################################################################
  2586. include include.vhost.conf;
  2587. #############################################################################################
  2588. # The origin cluster section
  2589. #############################################################################################
  2590. http_api {
  2591. enabled on;
  2592. listen 9090;
  2593. }
  2594. vhost a.origin.cluster.srs.com {
  2595. cluster {
  2596. mode local;
  2597. origin_cluster on;
  2598. coworkers 127.0.0.1:9091;
  2599. }
  2600. }
  2601. http_api {
  2602. enabled on;
  2603. listen 9091;
  2604. }
  2605. vhost b.origin.cluster.srs.com {
  2606. cluster {
  2607. mode local;
  2608. origin_cluster on;
  2609. coworkers 127.0.0.1:9090;
  2610. }
  2611. }
  2612. #############################################################################################
  2613. # To prevent user to use full.conf
  2614. #############################################################################################
  2615. # To identify the full.conf
  2616. # @remark Should never use it directly, it's only a collections of all config items.
  2617. # Default: off
  2618. is_full on;