full.conf 114 KB

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