full.conf 75 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909
  1. # all config for srs
  2. #############################################################################################
  3. # RTMP sections
  4. #############################################################################################
  5. # the rtmp listen ports, split by space, each listen entry is <[ip:]port>
  6. # for example, 192.168.1.100:1935 10.10.10.100:1935
  7. # where the ip is optional, default to 0.0.0.0, that is 1935 equals to 0.0.0.0:1935
  8. listen 1935;
  9. # the pid file
  10. # to ensure only one process can use a pid file
  11. # and provides the current running process id, for script,
  12. # for example, init.d script to manage the server.
  13. # default: ./objs/srs.pid
  14. pid ./objs/srs.pid;
  15. # the default chunk size is 128, max is 65536,
  16. # some client does not support chunk size change,
  17. # however, most clients support it and it can improve
  18. # performance about 10%.
  19. # default: 60000
  20. chunk_size 60000;
  21. # the log dir for FFMPEG.
  22. # if enabled ffmpeg, each transcoding stream will create a log file.
  23. # /dev/null to disable the log.
  24. # default: ./objs
  25. ff_log_dir ./objs;
  26. # the log level for FFMPEG.
  27. # info warning error fatal panic quiet
  28. # trace debug verbose
  29. # default: info
  30. ff_log_level info;
  31. # the log tank, console or file.
  32. # if console, print log to console.
  33. # if file, write log to file. requires srs_log_file if log to file.
  34. # default: file.
  35. srs_log_tank file;
  36. # the log level, for all log tanks.
  37. # can be: verbose, info, trace, warn, error
  38. # default: trace
  39. srs_log_level trace;
  40. # when srs_log_tank is file, specifies the log file.
  41. # default: ./objs/srs.log
  42. srs_log_file ./objs/srs.log;
  43. # the max connections.
  44. # if exceed the max connections, server will drop the new connection.
  45. # default: 1000
  46. max_connections 1000;
  47. # whether start as daemon
  48. # @remark: do not support reload.
  49. # default: on
  50. daemon on;
  51. # whether use utc_time to generate the time struct,
  52. # if off, use localtime() to generate it,
  53. # if on, use gmtime() instead, which use UTC time.
  54. # default: off
  55. utc_time off;
  56. # config for the pithy print in ms,
  57. # which always print constant message specified by interval,
  58. # whatever the clients in concurrency.
  59. # default: 10000
  60. pithy_print_ms 10000;
  61. # the work dir for server, to chdir(work_dir) when not empty or "./"
  62. # user can config this directory to change the dir.
  63. # @reamrk do not support reload.
  64. # default: ./
  65. work_dir ./;
  66. # whether quit when parent process changed,
  67. # used for supervisor mode(not daemon), srs should always quit when
  68. # supervisor process exited.
  69. # @remark conflict with daemon, error when both daemon and asprocess are on.
  70. # @reamrk do not support reload.
  71. # default: off
  72. asprocess off;
  73. # Whether client empty IP is ok, for example, health checking by SLB.
  74. # If ok(on), we will ignore this connection without warnings or errors.
  75. # default: on
  76. empty_ip_ok on;
  77. # For gracefully quit, wait for a while then close listeners,
  78. # because K8S notify SRS with SIGQUIT and update Service simultaneously,
  79. # maybe there is some new connections incoming before Service updated.
  80. # @see https://github.com/ossrs/srs/issues/1595#issuecomment-587516567
  81. # default: 2300
  82. grace_start_wait 2300;
  83. # For gracefully quit, final wait for cleanup in milliseconds.
  84. # @see https://github.com/ossrs/srs/issues/1579#issuecomment-587414898
  85. # default: 3200
  86. grace_final_wait 3200;
  87. # Whether force gracefully quit, never fast quit.
  88. # By default, SIGTERM which means fast quit, is sent by K8S, so we need to
  89. # force SRS to treat SIGTERM as gracefully quit for gray release or canary.
  90. # @see https://github.com/ossrs/srs/issues/1579#issuecomment-587475077
  91. # default: off
  92. force_grace_quit off;
  93. # Whether disable daemon for docker.
  94. # If on, it will set daemon to off in docker, even daemon is on.
  95. # default: on
  96. disable_daemon_for_docker on;
  97. # Whether auto reload by watching the config file by inotify.
  98. # default: off
  99. inotify_auto_reload off;
  100. # Whether enable inotify_auto_reload for docker.
  101. # If on, it will set inotify_auto_reload to on in docker, even it's off.
  102. # default: on
  103. auto_reload_for_docker on;
  104. # Query the latest available version of SRS, write a log to notice user to upgrade.
  105. # @see https://github.com/ossrs/srs/issues/2424
  106. # Default: on
  107. query_latest_version on;
  108. #############################################################################################
  109. # heartbeat/stats sections
  110. #############################################################################################
  111. # heartbeat to api server
  112. # @remark, the ip report to server, is retrieve from system stat,
  113. # which need the config item stats.network.
  114. heartbeat {
  115. # whether heartbeat is enabled.
  116. # default: off
  117. enabled off;
  118. # the interval seconds for heartbeat,
  119. # recommend 0.3,0.6,0.9,1.2,1.5,1.8,2.1,2.4,2.7,3,...,6,9,12,....
  120. # default: 9.9
  121. interval 9.3;
  122. # when startup, srs will heartbeat to this api.
  123. # @remark: must be a restful http api url, where SRS will POST with following data:
  124. # {
  125. # "device_id": "my-srs-device",
  126. # "ip": "192.168.1.100"
  127. # }
  128. # default: http://127.0.0.1:8085/api/v1/servers
  129. url http://127.0.0.1:8085/api/v1/servers;
  130. # the id of device.
  131. device_id "my-srs-device";
  132. # whether report with summaries
  133. # if on, put /api/v1/summaries to the request data:
  134. # {
  135. # "summaries": summaries object.
  136. # }
  137. # @remark: optional config.
  138. # default: off
  139. summaries off;
  140. }
  141. # system statistics section.
  142. # the main cycle will retrieve the system stat,
  143. # for example, the cpu/mem/network/disk-io data,
  144. # the http api, for instance, /api/v1/summaries will show these data.
  145. # @remark the heartbeat depends on the network,
  146. # for example, the eth0 maybe the device which index is 0.
  147. stats {
  148. # the index of device ip.
  149. # we may retrieve more than one network device.
  150. # default: 0
  151. network 0;
  152. # the device name to stat the disk iops.
  153. # ignore the device of /proc/diskstats if not configured.
  154. disk sda sdb xvda xvdb;
  155. }
  156. #############################################################################################
  157. # HTTP sections
  158. #############################################################################################
  159. # api of srs.
  160. # the http api config, export for external program to manage srs.
  161. # user can access http api of srs in browser directly, for instance, to access by:
  162. # curl http://192.168.1.170:1985/api/v1/reload
  163. # which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api,
  164. # where the cli can only be used in shell/terminate.
  165. http_api {
  166. # whether http api is enabled.
  167. # default: off
  168. enabled on;
  169. # the http api listen entry is <[ip:]port>
  170. # for example, 192.168.1.100:1985
  171. # where the ip is optional, default to 0.0.0.0, that is 1985 equals to 0.0.0.0:1985
  172. # default: 1985
  173. listen 1985;
  174. # whether enable crossdomain request.
  175. # default: on
  176. crossdomain on;
  177. # the HTTP RAW API is more powerful api to change srs state and reload.
  178. raw_api {
  179. # whether enable the HTTP RAW API.
  180. # default: off
  181. enabled off;
  182. # whether enable rpc reload.
  183. # default: off
  184. allow_reload off;
  185. # whether enable rpc query.
  186. # default: off
  187. allow_query off;
  188. # whether enable rpc update.
  189. # default: off
  190. allow_update off;
  191. }
  192. }
  193. # embedded http server in srs.
  194. # the http streaming config, for HLS/HDS/DASH/HTTPProgressive
  195. # global config for http streaming, user must config the http section for each vhost.
  196. # the embed http server used to substitute nginx in ./objs/nginx,
  197. # for example, srs running in arm, can provides RTMP and HTTP service, only with srs installed.
  198. # user can access the http server pages, generally:
  199. # curl http://192.168.1.170:80/srs.html
  200. # which will show srs version and welcome to srs.
  201. # @remark, the http embedded stream need to config the vhost, for instance, the __defaultVhost__
  202. # need to open the feature http of vhost.
  203. http_server {
  204. # whether http streaming service is enabled.
  205. # default: off
  206. enabled on;
  207. # the http streaming listen entry is <[ip:]port>
  208. # for example, 192.168.1.100:8080
  209. # where the ip is optional, default to 0.0.0.0, that is 8080 equals to 0.0.0.0:8080
  210. # @remark, if use lower port, for instance 80, user must start srs by root.
  211. # default: 8080
  212. listen 8080;
  213. # the default dir for http root.
  214. # default: ./objs/nginx/html
  215. dir ./objs/nginx/html;
  216. # whether enable crossdomain request.
  217. # for both http static and stream server and apply on all vhosts.
  218. # default: on
  219. crossdomain on;
  220. }
  221. #############################################################################################
  222. # Streamer sections
  223. #############################################################################################
  224. # the streamer cast stream from other protocol to SRS over RTMP.
  225. # @see https://github.com/ossrs/srs/tree/develop#stream-architecture
  226. stream_caster {
  227. # whether stream caster is enabled.
  228. # default: off
  229. enabled off;
  230. # the caster type of stream, the casters:
  231. # mpegts_over_udp, MPEG-TS over UDP caster.
  232. # rtsp, Real Time Streaming Protocol (RTSP).
  233. # flv, FLV over HTTP by POST.
  234. caster mpegts_over_udp;
  235. # the output rtmp url.
  236. # for mpegts_over_udp caster, the typically output url:
  237. # rtmp://127.0.0.1/live/livestream
  238. # for rtsp caster, the typically output url:
  239. # rtmp://127.0.0.1/[app]/[stream]
  240. # for example, the rtsp url:
  241. # rtsp://192.168.1.173:8544/live/livestream.sdp
  242. # where the [app] is "live" and [stream] is "livestream", output is:
  243. # rtmp://127.0.0.1/live/livestream
  244. # for flv caster, the typically output url:
  245. # rtmp://127.0.0.1/[app]/[stream]
  246. # for example, POST to url:
  247. # http://127.0.0.1:8936/live/livestream.flv
  248. # where the [app] is "live" and [stream] is "livestream", output is:
  249. # rtmp://127.0.0.1/live/livestream
  250. output rtmp://127.0.0.1/live/livestream;
  251. # the listen port for stream caster.
  252. # for mpegts_over_udp caster, listen at udp port. for example, 8935.
  253. # for rtsp caster, listen at tcp port. for example, 554.
  254. # for flv caster, listen at tcp port. for example, 8936.
  255. # TODO: support listen at <[ip:]port>
  256. listen 8935;
  257. # for the rtsp caster, the rtp server local port over udp,
  258. # which reply the rtsp setup request message, the port will be used:
  259. # [rtp_port_min, rtp_port_max)
  260. rtp_port_min 57200;
  261. rtp_port_max 57300;
  262. }
  263. stream_caster {
  264. enabled off;
  265. caster mpegts_over_udp;
  266. output rtmp://127.0.0.1/live/livestream;
  267. listen 8935;
  268. }
  269. stream_caster {
  270. enabled off;
  271. caster rtsp;
  272. output rtmp://127.0.0.1/[app]/[stream];
  273. listen 554;
  274. rtp_port_min 57200;
  275. rtp_port_max 57300;
  276. }
  277. stream_caster {
  278. enabled off;
  279. caster flv;
  280. output rtmp://127.0.0.1/[app]/[stream];
  281. listen 8936;
  282. }
  283. #############################################################################################
  284. # RTMP/HTTP VHOST sections
  285. #############################################################################################
  286. # vhost list, the __defaultVhost__ is the default vhost
  287. # for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
  288. # for which cannot identify the required vhost.
  289. vhost __defaultVhost__ {
  290. }
  291. # the vhost scope configs.
  292. vhost scope.vhost.srs.com {
  293. # whether the vhost is enabled.
  294. # if off, all request access denied.
  295. # default: on
  296. enabled off;
  297. # whether enable min delay mode for vhost.
  298. # for min latency mode:
  299. # 1. disable the publish.mr for vhost.
  300. # 2. use timeout for cond wait for consumer queue.
  301. # @see https://github.com/ossrs/srs/issues/257
  302. # default: off
  303. min_latency off;
  304. # whether enable the TCP_NODELAY
  305. # if on, set the nodelay of fd by setsockopt
  306. # default: off
  307. tcp_nodelay off;
  308. # the default chunk size is 128, max is 65536,
  309. # some client does not support chunk size change,
  310. # vhost chunk size will override the global value.
  311. # default: global chunk size.
  312. chunk_size 128;
  313. # The input ack size, 0 to not set.
  314. # Generally, it's set by the message from peer,
  315. # but for some peer(encoder), it never send message but use a different ack size.
  316. # We can chnage the default ack size in server-side, to send acknowledge message,
  317. # or the encoder maybe blocked after publishing for some time.
  318. # Default: 0
  319. in_ack_size 0;
  320. # The output ack size, 0 to not set.
  321. # This is used to notify the peer(player) to send acknowledge to server.
  322. # Default: 2500000
  323. out_ack_size 2500000;
  324. }
  325. # set the chunk size of vhost.
  326. vhost chunksize.srs.com {
  327. # @see scope.vhost.srs.com
  328. chunk_size 128;
  329. }
  330. # the vhost disabled.
  331. vhost removed.srs.com {
  332. # @see scope.vhost.srs.com
  333. enabled off;
  334. }
  335. # vhost for stream cluster for RTMP/FLV
  336. vhost cluster.srs.com {
  337. # The config for cluster.
  338. cluster {
  339. # The cluster mode, local or remote.
  340. # local: It's an origin server, serve streams itself.
  341. # remote: It's an edge server, fetch or push stream to origin server.
  342. # default: local
  343. mode remote;
  344. # For edge(mode remote), user must specifies the origin server
  345. # format as: <server_name|ip>[:port]
  346. # @remark user can specifies multiple origin for error backup, by space,
  347. # for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
  348. origin 127.0.0.1:1935 localhost:1935;
  349. # For edge(mode remote), whether open the token traverse mode,
  350. # if token traverse on, all connections of edge will forward to origin to check(auth),
  351. # it's very important for the edge to do the token auth.
  352. # the better way is use http callback to do the token auth by the edge,
  353. # but if user prefer origin check(auth), the token_traverse if better solution.
  354. # default: off
  355. token_traverse off;
  356. # For edge(mode remote), the vhost to transform for edge,
  357. # to fetch from the specified vhost at origin,
  358. # if not specified, use the current vhost of edge in origin, the variable [vhost].
  359. # default: [vhost]
  360. vhost same.edge.srs.com;
  361. # For edge(mode remote), when upnode(forward to, edge push to, edge pull from) is srs,
  362. # it's strongly recommend to open the debug_srs_upnode,
  363. # when connect to upnode, it will take the debug info,
  364. # for example, the id, source id, pid.
  365. # please see: https://github.com/ossrs/srs/wiki/v1_CN_SrsLog
  366. # default: on
  367. debug_srs_upnode on;
  368. # For origin(mode local) cluster, turn on the cluster.
  369. # @remark Origin cluster only supports RTMP, use Edge to transmux RTMP to FLV.
  370. # default: off
  371. # TODO: FIXME: Support reload.
  372. origin_cluster off;
  373. # For origin (mode local) cluster, the co-worker's HTTP APIs.
  374. # This origin will connect to co-workers and communicate with them.
  375. # please read: https://github.com/ossrs/srs/wiki/v3_EN_OriginCluster
  376. # TODO: FIXME: Support reload.
  377. coworkers 127.0.0.1:9091 127.0.0.1:9092;
  378. }
  379. }
  380. # vhost for edge, edge and origin is the same vhost
  381. vhost same.edge.srs.com {
  382. # @see cluster.srs.com
  383. cluster {
  384. mode remote;
  385. origin 127.0.0.1:1935 localhost:1935;
  386. token_traverse off;
  387. }
  388. }
  389. # vhost for edge, edge transform vhost to fetch from another vhost.
  390. vhost transform.edge.srs.com {
  391. # @see cluster.srs.com
  392. cluster {
  393. mode remote;
  394. origin 127.0.0.1:1935;
  395. vhost same.edge.srs.com;
  396. }
  397. }
  398. # the vhost for srs debug info, whether send args in connect(tcUrl).
  399. vhost debug.srs.com {
  400. # @see cluster.srs.com
  401. cluster {
  402. debug_srs_upnode on;
  403. }
  404. }
  405. # the vhost which forward publish streams.
  406. vhost same.vhost.forward.srs.com {
  407. # forward stream to other servers.
  408. forward {
  409. # whether enable the forward.
  410. # default: off
  411. enabled on;
  412. # forward all publish stream to the specified server.
  413. # this used to split/forward the current stream for cluster active-standby,
  414. # active-active for cdn to build high available fault tolerance system.
  415. # format: {ip}:{port} {ip_N}:{port_N}
  416. destination 127.0.0.1:1936 127.0.0.1:1937;
  417. }
  418. }
  419. # the play specified configs
  420. vhost play.srs.com {
  421. # for play client, both RTMP and other stream clients,
  422. # for instance, the HTTP FLV stream clients.
  423. play {
  424. # whether cache the last gop.
  425. # if on, cache the last gop and dispatch to client,
  426. # to enabled fast startup for client, client play immediately.
  427. # if off, send the latest media data to client,
  428. # client need to wait for the next Iframe to decode and show the video.
  429. # set to off if requires min delay;
  430. # set to on if requires client fast startup.
  431. # default: on
  432. gop_cache off;
  433. # the max live queue length in seconds.
  434. # if the messages in the queue exceed the max length,
  435. # drop the old whole gop.
  436. # default: 30
  437. queue_length 10;
  438. # about the stream monotonically increasing:
  439. # 1. video timestamp is monotonically increasing,
  440. # 2. audio timestamp is monotonically increasing,
  441. # 3. video and audio timestamp is interleaved/mixed monotonically increasing.
  442. # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
  443. # however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
  444. # the time jitter algorithm:
  445. # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
  446. # 2. zero, only ensure stream start at zero, ignore timestamp jitter.
  447. # 3. off, disable the time jitter algorithm, like atc.
  448. # @remark for full, correct timestamp only when |delta| > 250ms.
  449. # @remark disabled when atc is on.
  450. # default: full
  451. time_jitter full;
  452. # vhost for atc for hls/hds/rtmp backup.
  453. # generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
  454. # when atc is on, server delivery rtmp stream by absolute time.
  455. # atc is used, for instance, encoder will copy stream to master and slave server,
  456. # server use atc to delivery stream to edge/client, where stream time from master/slave server
  457. # is always the same, client/tools can slice RTMP stream to HLS according to the same time,
  458. # if the time not the same, the HLS stream cannot slice to support system backup.
  459. #
  460. # @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
  461. # @see http://www.baidu.com/#wd=hds%20hls%20atc
  462. #
  463. # @remark when atc is on, auto off the time_jitter
  464. # default: off
  465. atc off;
  466. # whether use the interleaved/mixed algorithm to correct the timestamp.
  467. # if on, always ensure the timestamp of audio+video is interleaved/mixed monotonically increase.
  468. # if off, use time_jitter to correct the timestamp if required.
  469. # @remark to use mix_correct, atc should on(or time_jitter should off).
  470. # default: off
  471. mix_correct off;
  472. # whether enable the auto atc,
  473. # if enabled, detect the bravo_atc="true" in onMetaData packet,
  474. # set atc to on if matched.
  475. # always ignore the onMetaData if atc_auto is off.
  476. # default: off
  477. atc_auto off;
  478. # set the MW(merged-write) latency in ms.
  479. # SRS always set mw on, so we just set the latency value.
  480. # the latency of stream >= mw_latency + mr_latency
  481. # the value recomment is [300, 1800]
  482. # default: 350
  483. mw_latency 350;
  484. # the minimal packets send interval in ms,
  485. # used to control the ndiff of stream by srs_rtmp_dump,
  486. # for example, some device can only accept some stream which
  487. # delivery packets in constant interval(not cbr).
  488. # @remark 0 to disable the minimal interval.
  489. # @remark >0 to make the srs to send message one by one.
  490. # @remark user can get the right packets interval in ms by srs_rtmp_dump.
  491. # default: 0
  492. send_min_interval 10.0;
  493. # whether reduce the sequence header,
  494. # for some client which cannot got duplicated sequence header,
  495. # while the sequence header is not changed yet.
  496. # default: off
  497. reduce_sequence_header on;
  498. }
  499. }
  500. # vhost for time jitter
  501. vhost jitter.srs.com {
  502. # @see play.srs.com
  503. # to use time_jitter full, the default config.
  504. play {
  505. }
  506. # to use mix_correct.
  507. play {
  508. time_jitter off;
  509. mix_correct on;
  510. }
  511. play {
  512. atc on;
  513. mix_correct on;
  514. }
  515. # to use atc
  516. play {
  517. atc on;
  518. }
  519. }
  520. # vhost for atc.
  521. vhost atc.srs.com {
  522. # @see play.srs.com
  523. play {
  524. atc on;
  525. atc_auto on;
  526. }
  527. }
  528. # the MR(merged-read) setting for publisher.
  529. # the MW(merged-write) settings for player.
  530. vhost mrw.srs.com {
  531. # @see scope.vhost.srs.com
  532. min_latency off;
  533. # @see play.srs.com
  534. play {
  535. mw_latency 350;
  536. }
  537. # @see publish.srs.com
  538. publish {
  539. mr on;
  540. mr_latency 350;
  541. }
  542. }
  543. # the vhost for min delay, do not cache any stream.
  544. vhost min.delay.com {
  545. # @see scope.vhost.srs.com
  546. min_latency on;
  547. # @see scope.vhost.srs.com
  548. tcp_nodelay on;
  549. # @see play.srs.com
  550. play {
  551. mw_latency 100;
  552. gop_cache off;
  553. queue_length 10;
  554. }
  555. # @see publish.srs.com
  556. publish {
  557. mr off;
  558. }
  559. }
  560. # whether disable the sps parse, for the resolution of video.
  561. vhost no.parse.sps.com {
  562. # @see publish.srs.com
  563. publish {
  564. parse_sps on;
  565. }
  566. }
  567. # the vhost to control the stream delivery feature
  568. vhost stream.control.com {
  569. # @see scope.vhost.srs.com
  570. min_latency on;
  571. # @see scope.vhost.srs.com
  572. tcp_nodelay on;
  573. # @see play.srs.com
  574. play {
  575. mw_latency 100;
  576. queue_length 10;
  577. send_min_interval 10.0;
  578. reduce_sequence_header on;
  579. }
  580. # @see publish.srs.com
  581. publish {
  582. mr off;
  583. firstpkt_timeout 20000;
  584. normal_timeout 7000;
  585. }
  586. }
  587. # the publish specified configs
  588. vhost publish.srs.com {
  589. # the config for FMLE/Flash publisher, which push RTMP to SRS.
  590. publish {
  591. # about MR, read https://github.com/ossrs/srs/issues/241
  592. # when enabled the mr, SRS will read as large as possible.
  593. # default: off
  594. mr off;
  595. # the latency in ms for MR(merged-read),
  596. # the performance+ when latency+, and memory+,
  597. # memory(buffer) = latency * kbps / 8
  598. # for example, latency=500ms, kbps=3000kbps, each publish connection will consume
  599. # memory = 500 * 3000 / 8 = 187500B = 183KB
  600. # when there are 2500 publisher, the total memory of SRS at least:
  601. # 183KB * 2500 = 446MB
  602. # the recommended value is [300, 2000]
  603. # default: 350
  604. mr_latency 350;
  605. # the 1st packet timeout in ms for encoder.
  606. # default: 20000
  607. firstpkt_timeout 20000;
  608. # the normal packet timeout in ms for encoder.
  609. # default: 5000
  610. normal_timeout 7000;
  611. # whether parse the sps when publish stream.
  612. # we can got the resolution of video for stat api.
  613. # but we may failed to cause publish failed.
  614. # default: on
  615. parse_sps on;
  616. }
  617. }
  618. # the vhost for anti-suck.
  619. vhost refer.anti_suck.com {
  620. # refer hotlink-denial.
  621. refer {
  622. # whether enable the refer hotlink-denial.
  623. # default: off.
  624. enabled on;
  625. # the common refer for play and publish.
  626. # if the page url of client not in the refer, access denied.
  627. # if not specified this field, allow all.
  628. # default: not specified.
  629. all github.com github.io;
  630. # refer for publish clients specified.
  631. # the common refer is not overridden by this.
  632. # if not specified this field, allow all.
  633. # default: not specified.
  634. publish github.com github.io;
  635. # refer for play clients specified.
  636. # the common refer is not overridden by this.
  637. # if not specified this field, allow all.
  638. # default: not specified.
  639. play github.com github.io;
  640. }
  641. }
  642. # vhost for bwt(bandwidth check)
  643. # generally, the bandcheck vhost must be: bandcheck.srs.com,
  644. # or need to modify the vhost of client.
  645. vhost bandcheck.srs.com {
  646. enabled on;
  647. chunk_size 65000;
  648. # bandwidth check config.
  649. bandcheck {
  650. # whether support bandwidth check,
  651. # default: off.
  652. enabled on;
  653. # the key for server to valid,
  654. # if invalid key, server disconnect and abort the bandwidth check.
  655. key "35c9b402c12a7246868752e2878f7e0e";
  656. # the interval in seconds for bandwidth check,
  657. # server do not allow new test request.
  658. # default: 30
  659. interval 30;
  660. # the max available check bandwidth in kbps.
  661. # to avoid attack of bandwidth check.
  662. # default: 1000
  663. limit_kbps 4000;
  664. }
  665. }
  666. # the security to allow or deny clients.
  667. vhost security.srs.com {
  668. # security for host to allow or deny clients.
  669. # @see https://github.com/ossrs/srs/issues/211
  670. security {
  671. # whether enable the security for vhost.
  672. # default: off
  673. enabled on;
  674. # the security list, each item format as:
  675. # allow|deny publish|play all|<ip>
  676. # for example:
  677. # allow publish all;
  678. # deny publish all;
  679. # allow publish 127.0.0.1;
  680. # deny publish 127.0.0.1;
  681. # allow play all;
  682. # deny play all;
  683. # allow play 127.0.0.1;
  684. # deny play 127.0.0.1;
  685. # SRS apply the following simple strategies one by one:
  686. # 1. allow all if security disabled.
  687. # 2. default to deny all when security enabled.
  688. # 3. allow if matches allow strategy.
  689. # 4. deny if matches deny strategy.
  690. allow play all;
  691. allow publish all;
  692. }
  693. }
  694. # vhost for http static and flv vod stream for each vhost.
  695. vhost http.static.srs.com {
  696. # http static vhost specified config
  697. http_static {
  698. # whether enabled the http static service for vhost.
  699. # default: off
  700. enabled on;
  701. # the url to mount to,
  702. # typical mount to [vhost]/
  703. # the variables:
  704. # [vhost] current vhost for http server.
  705. # @remark the [vhost] is optional, used to mount at specified vhost.
  706. # @remark the http of __defaultVhost__ will override the http_server section.
  707. # for example:
  708. # mount to [vhost]/
  709. # access by http://ossrs.net:8080/xxx.html
  710. # mount to [vhost]/hls
  711. # access by http://ossrs.net:8080/hls/xxx.html
  712. # mount to /
  713. # access by http://ossrs.net:8080/xxx.html
  714. # or by http://192.168.1.173:8080/xxx.html
  715. # mount to /hls
  716. # access by http://ossrs.net:8080/hls/xxx.html
  717. # or by http://192.168.1.173:8080/hls/xxx.html
  718. # @remark the port of http is specified by http_server section.
  719. # default: [vhost]/
  720. mount [vhost]/hls;
  721. # main dir of vhost,
  722. # to delivery HTTP stream of this vhost.
  723. # default: ./objs/nginx/html
  724. dir ./objs/nginx/html/hls;
  725. }
  726. }
  727. # vhost for http flv/aac/mp3 live stream for each vhost.
  728. vhost http.remux.srs.com {
  729. # http flv/mp3/aac/ts stream vhost specified config
  730. http_remux {
  731. # whether enable the http live streaming service for vhost.
  732. # default: off
  733. enabled on;
  734. # the fast cache for audio stream(mp3/aac),
  735. # to cache more audio and send to client in a time to make android(weixin) happy.
  736. # @remark the flv/ts stream ignore it
  737. # @remark 0 to disable fast cache for http audio stream.
  738. # default: 0
  739. fast_cache 30;
  740. # the stream mount for rtmp to remux to live streaming.
  741. # typical mount to [vhost]/[app]/[stream].flv
  742. # the variables:
  743. # [vhost] current vhost for http live stream.
  744. # [app] current app for http live stream.
  745. # [stream] current stream for http live stream.
  746. # @remark the [vhost] is optional, used to mount at specified vhost.
  747. # the extension:
  748. # .flv mount http live flv stream, use default gop cache.
  749. # .ts mount http live ts stream, use default gop cache.
  750. # .mp3 mount http live mp3 stream, ignore video and audio mp3 codec required.
  751. # .aac mount http live aac stream, ignore video and audio aac codec required.
  752. # for example:
  753. # mount to [vhost]/[app]/[stream].flv
  754. # access by http://ossrs.net:8080/live/livestream.flv
  755. # mount to /[app]/[stream].flv
  756. # access by http://ossrs.net:8080/live/livestream.flv
  757. # or by http://192.168.1.173:8080/live/livestream.flv
  758. # mount to [vhost]/[app]/[stream].mp3
  759. # access by http://ossrs.net:8080/live/livestream.mp3
  760. # mount to [vhost]/[app]/[stream].aac
  761. # access by http://ossrs.net:8080/live/livestream.aac
  762. # mount to [vhost]/[app]/[stream].ts
  763. # access by http://ossrs.net:8080/live/livestream.ts
  764. # @remark the port of http is specified by http_server section.
  765. # default: [vhost]/[app]/[stream].flv
  766. mount [vhost]/[app]/[stream].flv;
  767. }
  768. }
  769. # the http hook callback vhost, srs will invoke the hooks for specified events.
  770. vhost hooks.callback.srs.com {
  771. http_hooks {
  772. # whether the http hooks enable.
  773. # default off.
  774. enabled on;
  775. # when client connect to vhost/app, call the hook,
  776. # the request in the POST data string is a object encode by json:
  777. # {
  778. # "action": "on_connect",
  779. # "client_id": 1985,
  780. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  781. # "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a",
  782. # "pageUrl": "http://www.test.com/live.html"
  783. # }
  784. # if valid, the hook must return HTTP code 200(Status OK) and response
  785. # an int value specifies the error code(0 corresponding to success):
  786. # 0
  787. # support multiple api hooks, format:
  788. # on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN
  789. on_connect http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
  790. # when client close/disconnect to vhost/app/stream, call the hook,
  791. # the request in the POST data string is a object encode by json:
  792. # {
  793. # "action": "on_close",
  794. # "client_id": 1985,
  795. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  796. # "send_bytes": 10240, "recv_bytes": 10240
  797. # }
  798. # if valid, the hook must return HTTP code 200(Status OK) and response
  799. # an int value specifies the error code(0 corresponding to success):
  800. # 0
  801. # support multiple api hooks, format:
  802. # on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN
  803. on_close http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
  804. # when client(encoder) publish to vhost/app/stream, call the hook,
  805. # the request in the POST data string is a object encode by json:
  806. # {
  807. # "action": "on_publish",
  808. # "client_id": 1985,
  809. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  810. # "stream": "livestream", "param":"?token=xxx&salt=yyy"
  811. # }
  812. # if valid, the hook must return HTTP code 200(Status OK) and response
  813. # an int value specifies the error code(0 corresponding to success):
  814. # 0
  815. # support multiple api hooks, format:
  816. # on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
  817. on_publish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  818. # when client(encoder) stop publish to vhost/app/stream, call the hook,
  819. # the request in the POST data string is a object encode by json:
  820. # {
  821. # "action": "on_unpublish",
  822. # "client_id": 1985,
  823. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  824. # "stream": "livestream", "param":"?token=xxx&salt=yyy"
  825. # }
  826. # if valid, the hook must return HTTP code 200(Status OK) and response
  827. # an int value specifies the error code(0 corresponding to success):
  828. # 0
  829. # support multiple api hooks, format:
  830. # on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
  831. on_unpublish http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
  832. # when client start to play vhost/app/stream, call the hook,
  833. # the request in the POST data string is a object encode by json:
  834. # {
  835. # "action": "on_play",
  836. # "client_id": 1985,
  837. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  838. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  839. # "pageUrl": "http://www.test.com/live.html"
  840. # }
  841. # if valid, the hook must return HTTP code 200(Status OK) and response
  842. # an int value specifies the error code(0 corresponding to success):
  843. # 0
  844. # support multiple api hooks, format:
  845. # on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
  846. on_play http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  847. # when client stop to play vhost/app/stream, call the hook,
  848. # the request in the POST data string is a object encode by json:
  849. # {
  850. # "action": "on_stop",
  851. # "client_id": 1985,
  852. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  853. # "stream": "livestream", "param":"?token=xxx&salt=yyy"
  854. # }
  855. # if valid, the hook must return HTTP code 200(Status OK) and response
  856. # an int value specifies the error code(0 corresponding to success):
  857. # 0
  858. # support multiple api hooks, format:
  859. # on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
  860. on_stop http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
  861. # when srs reap a dvr file, call the hook,
  862. # the request in the POST data string is a object encode by json:
  863. # {
  864. # "action": "on_dvr",
  865. # "client_id": 1985,
  866. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  867. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  868. # "cwd": "/usr/local/srs",
  869. # "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
  870. # }
  871. # if valid, the hook must return HTTP code 200(Status OK) and response
  872. # an int value specifies the error code(0 corresponding to success):
  873. # 0
  874. on_dvr http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
  875. # when srs reap a ts file of hls, call the hook,
  876. # the request in the POST data string is a object encode by json:
  877. # {
  878. # "action": "on_hls",
  879. # "client_id": 1985,
  880. # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
  881. # "stream": "livestream", "param":"?token=xxx&salt=yyy",
  882. # "duration": 9.36, // in seconds
  883. # "cwd": "/usr/local/srs",
  884. # "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
  885. # "url": "live/livestream/2015-04-23/01/476584165.ts",
  886. # "m3u8": "./objs/nginx/html/live/livestream/live.m3u8",
  887. # "m3u8_url": "live/livestream/live.m3u8",
  888. # "seq_no": 100
  889. # }
  890. # if valid, the hook must return HTTP code 200(Status OK) and response
  891. # an int value specifies the error code(0 corresponding to success):
  892. # 0
  893. on_hls http://127.0.0.1:8085/api/v1/hls http://localhost:8085/api/v1/hls;
  894. # when srs reap a ts file of hls, call this hook,
  895. # used to push file to cdn network, by get the ts file from cdn network.
  896. # so we use HTTP GET and use the variable following:
  897. # [app], replace with the app.
  898. # [stream], replace with the stream.
  899. # [param], replace with the param.
  900. # [ts_url], replace with the ts url.
  901. # ignore any return data of server.
  902. # @remark random select a url to report, not report all.
  903. on_hls_notify http://127.0.0.1:8085/api/v1/hls/[app]/[stream]/[ts_url][param];
  904. }
  905. }
  906. # the vhost for exec, fork process when publish stream.
  907. vhost exec.srs.com {
  908. # the exec used to fork process when got some event.
  909. exec {
  910. # whether enable the exec.
  911. # default: off.
  912. enabled off;
  913. # when publish stream, exec the process with variables:
  914. # [vhost] the input stream vhost.
  915. # [port] the input stream port.
  916. # [app] the input stream app.
  917. # [stream] the input stream name.
  918. # [engine] the transcode engine name.
  919. # other variables for exec only:
  920. # [url] the rtmp url which trigger the publish.
  921. # [tcUrl] the client request tcUrl.
  922. # [swfUrl] the client request swfUrl.
  923. # [pageUrl] the client request pageUrl.
  924. # we also support datetime variables.
  925. # [2006], replace this const to current year.
  926. # [01], replace this const to current month.
  927. # [02], replace this const to current date.
  928. # [15], replace this const to current hour.
  929. # [04], replace this const to current minute.
  930. # [05], replace this const to current second.
  931. # [999], replace this const to current millisecond.
  932. # [timestamp],replace this const to current UNIX timestamp in ms.
  933. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  934. # @remark empty to ignore this exec.
  935. publish ./objs/ffmpeg/bin/ffmpeg -f flv -i [url] -c copy -y ./[stream].flv;
  936. }
  937. }
  938. # The vhost for MPEG-DASH.
  939. vhost dash.srs.com {
  940. dash {
  941. # Whether DASH is enabled.
  942. # Transmux RTMP to DASH if on.
  943. # Default: off
  944. enabled on;
  945. # The duration of segment in seconds.
  946. # Default: 30
  947. dash_fragment 30;
  948. # The period to update the MPD in seconds.
  949. # Default: 150
  950. dash_update_period 150;
  951. # The depth of timeshift buffer in seconds.
  952. # Default: 300
  953. dash_timeshift 300;
  954. # The base/home dir/path for dash.
  955. # All init and segment files will write under this dir.
  956. dash_path ./objs/nginx/html;
  957. # The DASH MPD file path.
  958. # We supports some variables to generate the filename.
  959. # [vhost], the vhost of stream.
  960. # [app], the app of stream.
  961. # [stream], the stream name of stream.
  962. # Default: [app]/[stream].mpd
  963. dash_mpd_file [app]/[stream].mpd;
  964. }
  965. }
  966. # the vhost with hls specified.
  967. vhost hls.srs.com {
  968. hls {
  969. # whether the hls is enabled.
  970. # if off, do not write hls(ts and m3u8) when publish.
  971. # default: off
  972. enabled on;
  973. # the hls fragment in seconds, the duration of a piece of ts.
  974. # default: 10
  975. hls_fragment 10;
  976. # the hls m3u8 target duration ratio,
  977. # EXT-X-TARGETDURATION = hls_td_ratio * hls_fragment // init
  978. # EXT-X-TARGETDURATION = max(ts_duration, EXT-X-TARGETDURATION) // for each ts
  979. # @see https://github.com/ossrs/srs/issues/304#issuecomment-74000081
  980. # default: 1.5
  981. hls_td_ratio 1.5;
  982. # the audio overflow ratio.
  983. # for pure audio, the duration to reap the segment.
  984. # for example, the hls_fragment is 10s, hls_aof_ratio is 2.0,
  985. # the segment will reap to 20s for pure audio.
  986. # default: 2.0
  987. hls_aof_ratio 2.0;
  988. # the hls window in seconds, the number of ts in m3u8.
  989. # default: 60
  990. hls_window 60;
  991. # the error strategy. can be:
  992. # ignore, disable the hls.
  993. # disconnect, require encoder republish.
  994. # continue, ignore failed try to continue output hls.
  995. # @see https://github.com/ossrs/srs/issues/264
  996. # default: continue
  997. hls_on_error continue;
  998. # the hls output path.
  999. # the m3u8 file is configured by hls_path/hls_m3u8_file, the default is:
  1000. # ./objs/nginx/html/[app]/[stream].m3u8
  1001. # the ts file is configured by hls_path/hls_ts_file, the default is:
  1002. # ./objs/nginx/html/[app]/[stream]-[seq].ts
  1003. # @remark the hls_path is compatible with srs v1 config.
  1004. # default: ./objs/nginx/html
  1005. hls_path ./objs/nginx/html;
  1006. # the hls m3u8 file name.
  1007. # we supports some variables to generate the filename.
  1008. # [vhost], the vhost of stream.
  1009. # [app], the app of stream.
  1010. # [stream], the stream name of stream.
  1011. # default: [app]/[stream].m3u8
  1012. hls_m3u8_file [app]/[stream].m3u8;
  1013. # the hls ts file name.
  1014. # we supports some variables to generate the filename.
  1015. # [vhost], the vhost of stream.
  1016. # [app], the app of stream.
  1017. # [stream], the stream name of stream.
  1018. # [2006], replace this const to current year.
  1019. # [01], replace this const to current month.
  1020. # [02], replace this const to current date.
  1021. # [15], replace this const to current hour.
  1022. # [04], replace this const to current minute.
  1023. # [05], replace this const to current second.
  1024. # [999], replace this const to current millisecond.
  1025. # [timestamp],replace this const to current UNIX timestamp in ms.
  1026. # [seq], the sequence number of ts.
  1027. # [duration], replace this const to current ts duration.
  1028. # @see https://github.com/ossrs/srs/wiki/v2_CN_DVR#custom-path
  1029. # @see https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#hls-config
  1030. # default: [app]/[stream]-[seq].ts
  1031. hls_ts_file [app]/[stream]-[seq].ts;
  1032. # whether use floor for the hls_ts_file path generation.
  1033. # if on, use floor(timestamp/hls_fragment) as the variable [timestamp],
  1034. # and use enhanced algorithm to calc deviation for segment.
  1035. # @remark when floor on, recommend the hls_segment>=2*gop.
  1036. # default: off
  1037. hls_ts_floor off;
  1038. # the hls entry prefix, which is base url of ts url.
  1039. # for example, the prefix is:
  1040. # http://your-server/
  1041. # then, the ts path in m3u8 will be like:
  1042. # http://your-server/live/livestream-0.ts
  1043. # http://your-server/live/livestream-1.ts
  1044. # ...
  1045. # optional, default to empty string.
  1046. hls_entry_prefix http://your-server;
  1047. # the default audio codec of hls.
  1048. # when codec changed, write the PAT/PMT table, but maybe ok util next ts.
  1049. # so user can set the default codec for mp3.
  1050. # the available audio codec:
  1051. # aac, mp3, an
  1052. # default: aac
  1053. hls_acodec aac;
  1054. # the default video codec of hls.
  1055. # when codec changed, write the PAT/PMT table, but maybe ok util next ts.
  1056. # so user can set the default codec for pure audio(without video) to vn.
  1057. # the available video codec:
  1058. # h264, vn
  1059. # default: h264
  1060. hls_vcodec h264;
  1061. # whether cleanup the old expired ts files.
  1062. # default: on
  1063. hls_cleanup on;
  1064. # If there is no incoming packets, dispose HLS in this timeout in seconds,
  1065. # which removes all HLS files including m3u8 and ts files.
  1066. # @remark 0 to disable dispose for publisher.
  1067. # @remark apply for publisher timeout only, while "etc/init.d/srs stop" always dispose hls.
  1068. # default: 0
  1069. hls_dispose 0;
  1070. # the max size to notify hls,
  1071. # to read max bytes from ts of specified cdn network,
  1072. # @remark only used when on_hls_notify is config.
  1073. # default: 64
  1074. hls_nb_notify 64;
  1075. # whether wait keyframe to reap segment,
  1076. # if off, reap segment when duration exceed the fragment,
  1077. # if on, reap segment when duration exceed and got keyframe.
  1078. # default: on
  1079. hls_wait_keyframe on;
  1080. # whether using AES encryption.
  1081. # default: off
  1082. hls_keys on;
  1083. # the number of clear ts which one key can encrypt.
  1084. # default: 5
  1085. hls_fragments_per_key 5;
  1086. # the hls key file name.
  1087. # we supports some variables to generate the filename.
  1088. # [vhost], the vhost of stream.
  1089. # [app], the app of stream.
  1090. # [stream], the stream name of stream.
  1091. # [seq], the sequence number of key corresponding to the ts.
  1092. hls_key_file [app]/[stream]-[seq].key;
  1093. # the key output path.
  1094. # the key file is configed by hls_path/hls_key_file, the default is:
  1095. # ./objs/nginx/html/[app]/[stream]-[seq].key
  1096. hls_key_file_path ./objs/nginx/html;
  1097. # the key root URL, use this can support https.
  1098. # @remark It's optional.
  1099. hls_key_url https://localhost:8080;
  1100. # Special control controls.
  1101. ###########################################
  1102. # Whether calculate the DTS of audio frame directly.
  1103. # If on, guess the specific DTS by AAC samples, please read https://github.com/ossrs/srs/issues/547#issuecomment-294350544
  1104. # If off, directly turn the FLV timestamp to DTS, which might cause corrupt audio stream.
  1105. # @remark Recommend to set to off, unless your audio stream sample-rate and timestamp is not correct.
  1106. # Default: on
  1107. hls_dts_directly on;
  1108. # on_hls, never config in here, should config in http_hooks.
  1109. # for the hls http callback, @see http_hooks.on_hls of vhost hooks.callback.srs.com
  1110. # @read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#http-callback
  1111. # @read https://github.com/ossrs/srs/wiki/v2_EN_DeliveryHLS#http-callback
  1112. # on_hls_notify, never config in here, should config in http_hooks.
  1113. # we support the variables to generate the notify url:
  1114. # [app], replace with the app.
  1115. # [stream], replace with the stream.
  1116. # [param], replace with the param.
  1117. # [ts_url], replace with the ts url.
  1118. # for the hls http callback, @see http_hooks.on_hls_notify of vhost hooks.callback.srs.com
  1119. # @read https://github.com/ossrs/srs/wiki/v2_CN_DeliveryHLS#on-hls-notify
  1120. # @read https://github.com/ossrs/srs/wiki/v2_EN_DeliveryHLS#on-hls-notify
  1121. }
  1122. }
  1123. # the vhost with hls disabled.
  1124. vhost no-hls.srs.com {
  1125. hls {
  1126. # whether the hls is enabled.
  1127. # if off, do not write hls(ts and m3u8) when publish.
  1128. # default: off
  1129. enabled off;
  1130. }
  1131. }
  1132. # the vhost with adobe hds
  1133. vhost hds.srs.com {
  1134. hds {
  1135. # whether hds enabled
  1136. # default: off
  1137. enabled on;
  1138. # the hds fragment in seconds.
  1139. # default: 10
  1140. hds_fragment 10;
  1141. # the hds window in seconds, erase the segment when exceed the window.
  1142. # default: 60
  1143. hds_window 60;
  1144. # the path to store the hds files.
  1145. # default: ./objs/nginx/html
  1146. hds_path ./objs/nginx/html;
  1147. }
  1148. }
  1149. # vhost for dvr
  1150. vhost dvr.srs.com {
  1151. # DVR RTMP stream to file,
  1152. # start to record to file when encoder publish,
  1153. # reap flv/mp4 according by specified dvr_plan.
  1154. dvr {
  1155. # whether enabled dvr features
  1156. # default: off
  1157. enabled on;
  1158. # the filter for dvr to apply to.
  1159. # all, dvr all streams of all apps.
  1160. # <app>/<stream>, apply to specified stream of app.
  1161. # for example, to dvr the following two streams:
  1162. # live/stream1 live/stream2
  1163. # default: all
  1164. dvr_apply all;
  1165. # the dvr plan. canbe:
  1166. # session reap flv/mp4 when session end(unpublish).
  1167. # segment reap flv/mp4 when flv duration exceed the specified dvr_duration.
  1168. # @remark The plan append is removed in SRS3+, for it's no use.
  1169. # default: session
  1170. dvr_plan session;
  1171. # the dvr output path, *.flv or *.mp4.
  1172. # we supports some variables to generate the filename.
  1173. # [vhost], the vhost of stream.
  1174. # [app], the app of stream.
  1175. # [stream], the stream name of stream.
  1176. # [2006], replace this const to current year.
  1177. # [01], replace this const to current month.
  1178. # [02], replace this const to current date.
  1179. # [15], replace this const to current hour.
  1180. # [04], replace this const to current minute.
  1181. # [05], replace this const to current second.
  1182. # [999], replace this const to current millisecond.
  1183. # [timestamp],replace this const to current UNIX timestamp in ms.
  1184. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  1185. # for example, for url rtmp://ossrs.net/live/livestream and time 2015-01-03 10:57:30.776
  1186. # 1. No variables, the rule of SRS1.0(auto add [stream].[timestamp].flv as filename):
  1187. # dvr_path ./objs/nginx/html;
  1188. # =>
  1189. # dvr_path ./objs/nginx/html/live/livestream.1420254068776.flv;
  1190. # 2. Use stream and date as dir name, time as filename:
  1191. # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]/[15].[04].[05].[999].flv;
  1192. # =>
  1193. # dvr_path /data/ossrs.net/live/livestream/2015/01/03/10.57.30.776.flv;
  1194. # 3. Use stream and year/month as dir name, date and time as filename:
  1195. # dvr_path /data/[vhost]/[app]/[stream]/[2006]/[01]/[02]-[15].[04].[05].[999].flv;
  1196. # =>
  1197. # dvr_path /data/ossrs.net/live/livestream/2015/01/03-10.57.30.776.flv;
  1198. # 4. Use vhost/app and year/month as dir name, stream/date/time as filename:
  1199. # dvr_path /data/[vhost]/[app]/[2006]/[01]/[stream]-[02]-[15].[04].[05].[999].flv;
  1200. # =>
  1201. # dvr_path /data/ossrs.net/live/2015/01/livestream-03-10.57.30.776.flv;
  1202. # 5. DVR to mp4:
  1203. # dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].mp4;
  1204. # =>
  1205. # dvr_path ./objs/nginx/html/live/livestream.1420254068776.mp4;
  1206. # @see https://github.com/ossrs/srs/wiki/v3_CN_DVR#custom-path
  1207. # @see https://github.com/ossrs/srs/wiki/v3_EN_DVR#custom-path
  1208. # segment,session apply it.
  1209. # default: ./objs/nginx/html/[app]/[stream].[timestamp].flv
  1210. dvr_path ./objs/nginx/html/[app]/[stream].[timestamp].flv;
  1211. # the duration for dvr file, reap if exceed, in seconds.
  1212. # segment apply it.
  1213. # session,append ignore.
  1214. # default: 30
  1215. dvr_duration 30;
  1216. # whether wait keyframe to reap segment,
  1217. # if off, reap segment when duration exceed the dvr_duration,
  1218. # if on, reap segment when duration exceed and got keyframe.
  1219. # segment apply it.
  1220. # session,append ignore.
  1221. # default: on
  1222. dvr_wait_keyframe on;
  1223. # about the stream monotonically increasing:
  1224. # 1. video timestamp is monotonically increasing,
  1225. # 2. audio timestamp is monotonically increasing,
  1226. # 3. video and audio timestamp is interleaved monotonically increasing.
  1227. # it's specified by RTMP specification, @see 3. Byte Order, Alignment, and Time Format
  1228. # however, some encoder cannot provides this feature, please set this to off to ignore time jitter.
  1229. # the time jitter algorithm:
  1230. # 1. full, to ensure stream start at zero, and ensure stream monotonically increasing.
  1231. # 2. zero, only ensure stream start at zero, ignore timestamp jitter.
  1232. # 3. off, disable the time jitter algorithm, like atc.
  1233. # apply for all dvr plan.
  1234. # default: full
  1235. time_jitter full;
  1236. # on_dvr, never config in here, should config in http_hooks.
  1237. # for the dvr http callback, @see http_hooks.on_dvr of vhost hooks.callback.srs.com
  1238. # @read https://github.com/ossrs/srs/wiki/v2_CN_DVR#http-callback
  1239. # @read https://github.com/ossrs/srs/wiki/v2_EN_DVR#http-callback
  1240. }
  1241. }
  1242. # vhost for ingest
  1243. vhost ingest.srs.com {
  1244. # ingest file/stream/device then push to SRS over RTMP.
  1245. # the name/id used to identify the ingest, must be unique in global.
  1246. # ingest id is used in reload or http api management.
  1247. # @remark vhost can contains multiple ingest
  1248. ingest livestream {
  1249. # whether enabled ingest features
  1250. # default: off
  1251. enabled on;
  1252. # input file/stream/device
  1253. # @remark only support one input.
  1254. input {
  1255. # the type of input.
  1256. # can be file/stream/device, that is,
  1257. # file: ingest file specified by url.
  1258. # stream: ingest stream specified by url.
  1259. # device: not support yet.
  1260. # default: file
  1261. type file;
  1262. # the url of file/stream.
  1263. url ./doc/source.200kbps.768x320.flv;
  1264. }
  1265. # the ffmpeg
  1266. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1267. # the transcode engine, @see all.transcode.srs.com
  1268. # @remark, the output is specified following.
  1269. engine {
  1270. # @see enabled of transcode engine.
  1271. # if disabled or vcodec/acodec not specified, use copy.
  1272. # default: off.
  1273. enabled off;
  1274. # output stream. variables:
  1275. # [vhost] current vhost which start the ingest.
  1276. # [port] system RTMP stream port.
  1277. # we also support datetime variables.
  1278. # [2006], replace this const to current year.
  1279. # [01], replace this const to current month.
  1280. # [02], replace this const to current date.
  1281. # [15], replace this const to current hour.
  1282. # [04], replace this const to current minute.
  1283. # [05], replace this const to current second.
  1284. # [999], replace this const to current millisecond.
  1285. # [timestamp],replace this const to current UNIX timestamp in ms.
  1286. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  1287. output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
  1288. }
  1289. }
  1290. }
  1291. # the vhost for ingest with transcode engine.
  1292. vhost transcode.ingest.srs.com {
  1293. ingest livestream {
  1294. enabled on;
  1295. input {
  1296. type file;
  1297. url ./doc/source.200kbps.768x320.flv;
  1298. }
  1299. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1300. engine {
  1301. enabled off;
  1302. perfile {
  1303. re;
  1304. rtsp_transport tcp;
  1305. }
  1306. iformat flv;
  1307. vfilter {
  1308. i ./doc/ffmpeg-logo.png;
  1309. filter_complex 'overlay=10:10';
  1310. }
  1311. vcodec libx264;
  1312. vbitrate 1500;
  1313. vfps 25;
  1314. vwidth 768;
  1315. vheight 320;
  1316. vthreads 12;
  1317. vprofile main;
  1318. vpreset medium;
  1319. vparams {
  1320. t 100;
  1321. coder 1;
  1322. b_strategy 2;
  1323. bf 3;
  1324. refs 10;
  1325. }
  1326. acodec libfdk_aac;
  1327. abitrate 70;
  1328. asample_rate 44100;
  1329. achannels 2;
  1330. aparams {
  1331. profile:a aac_low;
  1332. }
  1333. oformat flv;
  1334. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream];
  1335. }
  1336. }
  1337. }
  1338. # the main comments for transcode
  1339. vhost example.transcode.srs.com {
  1340. # the streaming transcode configs.
  1341. # @remark vhost can contains multiple transcode
  1342. transcode {
  1343. # whether the transcode enabled.
  1344. # if off, donot transcode.
  1345. # default: off.
  1346. enabled on;
  1347. # the ffmpeg
  1348. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1349. # the transcode engine for matched stream.
  1350. # all matched stream will transcoded to the following stream.
  1351. # the transcode set name(ie. hd) is optional and not used.
  1352. # we will build the parameters to fork ffmpeg:
  1353. # ffmpeg <perfile>
  1354. # -i <iformat>
  1355. # <vfilter>
  1356. # -vcodec <vcodec> -b:v <vbitrate> -r <vfps> -s <vwidth>x<vheight> -profile:v <vprofile> -preset <vpreset>
  1357. # <vparams>
  1358. # -acodec <acodec> -b:a <abitrate> -ar <asample_rate> -ac <achannels>
  1359. # <aparams>
  1360. # -f <oformat>
  1361. # -y <output>
  1362. engine example {
  1363. # whether the engine is enabled
  1364. # default: off.
  1365. enabled on;
  1366. # pre-file options, before "-i"
  1367. perfile {
  1368. re;
  1369. rtsp_transport tcp;
  1370. }
  1371. # input format "-i", can be:
  1372. # off, do not specifies the format, ffmpeg will guess it.
  1373. # flv, for flv or RTMP stream.
  1374. # other format, for example, mp4/aac whatever.
  1375. # default: flv
  1376. iformat flv;
  1377. # ffmpeg filters, between "-i" and "-vcodec"
  1378. # follows the main input.
  1379. vfilter {
  1380. # the logo input file.
  1381. i ./doc/ffmpeg-logo.png;
  1382. # the ffmpeg complex filter.
  1383. # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
  1384. filter_complex 'overlay=10:10';
  1385. }
  1386. # video encoder name, "ffmpeg -vcodec"
  1387. # can be:
  1388. # libx264: use h.264(libx264) video encoder.
  1389. # png: use png to snapshot thumbnail.
  1390. # copy: donot encoder the video stream, copy it.
  1391. # vn: disable video output.
  1392. vcodec libx264;
  1393. # video bitrate, in kbps, "ffmepg -b:v"
  1394. # @remark 0 to use source video bitrate.
  1395. # default: 0
  1396. vbitrate 1500;
  1397. # video framerate, "ffmepg -r"
  1398. # @remark 0 to use source video fps.
  1399. # default: 0
  1400. vfps 25;
  1401. # video width, must be even numbers, "ffmepg -s"
  1402. # @remark 0 to use source video width.
  1403. # default: 0
  1404. vwidth 768;
  1405. # video height, must be even numbers, "ffmepg -s"
  1406. # @remark 0 to use source video height.
  1407. # default: 0
  1408. vheight 320;
  1409. # the max threads for ffmpeg to used, "ffmepg -thread"
  1410. # default: 1
  1411. vthreads 12;
  1412. # x264 profile, "ffmepg -profile:v"
  1413. # @see x264 -help, can be:
  1414. # high,main,baseline
  1415. vprofile main;
  1416. # x264 preset, "ffmpeg -preset"
  1417. # @see x264 -help, can be:
  1418. # ultrafast,superfast,veryfast,faster,fast
  1419. # medium,slow,slower,veryslow,placebo
  1420. vpreset medium;
  1421. # other x264 or ffmpeg video params, between "-preset" and "-acodec"
  1422. vparams {
  1423. # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
  1424. t 100;
  1425. # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
  1426. coder 1;
  1427. b_strategy 2;
  1428. bf 3;
  1429. refs 10;
  1430. }
  1431. # audio encoder name, "ffmpeg -acodec"
  1432. # can be:
  1433. # libfdk_aac: use aac(libfdk_aac) audio encoder.
  1434. # copy: donot encoder the audio stream, copy it.
  1435. # an: disable audio output.
  1436. acodec libfdk_aac;
  1437. # audio bitrate, in kbps, "ffmpeg -b:a"
  1438. # [16, 72] for libfdk_aac.
  1439. # @remark 0 to use source audio bitrate.
  1440. # default: 0
  1441. abitrate 70;
  1442. # audio sample rate, "ffmpeg -ar"
  1443. # for flv/rtmp, it must be:
  1444. # 44100,22050,11025,5512
  1445. # @remark 0 to use source audio sample rate.
  1446. # default: 0
  1447. asample_rate 44100;
  1448. # audio channel, "ffmpeg -ac"
  1449. # 1 for mono, 2 for stereo.
  1450. # @remark 0 to use source audio channels.
  1451. # default: 0
  1452. achannels 2;
  1453. # other ffmpeg audio params, between "-ac" and "-f"/"-y"
  1454. aparams {
  1455. # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
  1456. # @remark SRS supported aac profile for HLS is: aac_low, aac_he, aac_he_v2
  1457. profile:a aac_low;
  1458. bsf:a aac_adtstoasc;
  1459. }
  1460. # output format, "ffmpeg -f" can be:
  1461. # off, do not specifies the format, ffmpeg will guess it.
  1462. # flv, for flv or RTMP stream.
  1463. # image2, for vcodec png to snapshot thumbnail.
  1464. # other format, for example, mp4/aac whatever.
  1465. # default: flv
  1466. oformat flv;
  1467. # output stream, "ffmpeg -y", variables:
  1468. # [vhost] the input stream vhost.
  1469. # [port] the input stream port.
  1470. # [app] the input stream app.
  1471. # [stream] the input stream name.
  1472. # [engine] the transcode engine name.
  1473. # we also support datetime variables.
  1474. # [2006], replace this const to current year.
  1475. # [01], replace this const to current month.
  1476. # [02], replace this const to current date.
  1477. # [15], replace this const to current hour.
  1478. # [04], replace this const to current minute.
  1479. # [05], replace this const to current second.
  1480. # [999], replace this const to current millisecond.
  1481. # [timestamp],replace this const to current UNIX timestamp in ms.
  1482. # @remark we use golang time format "2006-01-02 15:04:05.999" as "[2006]-[01]-[02]_[15].[04].[05]_[999]"
  1483. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1484. }
  1485. }
  1486. }
  1487. # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
  1488. vhost mirror.transcode.srs.com {
  1489. transcode {
  1490. enabled on;
  1491. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1492. engine mirror {
  1493. enabled on;
  1494. vfilter {
  1495. vf 'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
  1496. }
  1497. vcodec libx264;
  1498. vbitrate 300;
  1499. vfps 20;
  1500. vwidth 768;
  1501. vheight 320;
  1502. vthreads 2;
  1503. vprofile baseline;
  1504. vpreset superfast;
  1505. vparams {
  1506. }
  1507. acodec libfdk_aac;
  1508. abitrate 45;
  1509. asample_rate 44100;
  1510. achannels 2;
  1511. aparams {
  1512. }
  1513. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1514. }
  1515. }
  1516. }
  1517. # the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
  1518. # remark: we remove the libfreetype which always cause build failed, you must add it manual if needed.
  1519. #######################################################################################################
  1520. # the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
  1521. vhost crop.transcode.srs.com {
  1522. transcode {
  1523. enabled on;
  1524. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1525. engine crop {
  1526. enabled on;
  1527. vfilter {
  1528. vf 'crop=in_w-20:in_h-160:10:80';
  1529. }
  1530. vcodec libx264;
  1531. vbitrate 300;
  1532. vfps 20;
  1533. vwidth 768;
  1534. vheight 320;
  1535. vthreads 2;
  1536. vprofile baseline;
  1537. vpreset superfast;
  1538. vparams {
  1539. }
  1540. acodec libfdk_aac;
  1541. abitrate 45;
  1542. asample_rate 44100;
  1543. achannels 2;
  1544. aparams {
  1545. }
  1546. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1547. }
  1548. }
  1549. }
  1550. # the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
  1551. vhost logo.transcode.srs.com {
  1552. transcode {
  1553. enabled on;
  1554. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1555. engine logo {
  1556. enabled on;
  1557. vfilter {
  1558. i ./doc/ffmpeg-logo.png;
  1559. filter_complex 'overlay=10:10';
  1560. }
  1561. vcodec libx264;
  1562. vbitrate 300;
  1563. vfps 20;
  1564. vwidth 768;
  1565. vheight 320;
  1566. vthreads 2;
  1567. vprofile baseline;
  1568. vpreset superfast;
  1569. vparams {
  1570. }
  1571. acodec libfdk_aac;
  1572. abitrate 45;
  1573. asample_rate 44100;
  1574. achannels 2;
  1575. aparams {
  1576. }
  1577. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1578. }
  1579. }
  1580. }
  1581. # audio transcode only.
  1582. # for example, FMLE publish audio codec in mp3, and do not support HLS output,
  1583. # we can transcode the audio to aac and copy video to the new stream with HLS.
  1584. vhost audio.transcode.srs.com {
  1585. transcode {
  1586. enabled on;
  1587. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1588. engine acodec {
  1589. enabled on;
  1590. vcodec copy;
  1591. acodec libfdk_aac;
  1592. abitrate 45;
  1593. asample_rate 44100;
  1594. achannels 2;
  1595. aparams {
  1596. }
  1597. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1598. }
  1599. }
  1600. }
  1601. # disable video, transcode/copy audio.
  1602. # for example, publish pure audio stream.
  1603. vhost vn.transcode.srs.com {
  1604. transcode {
  1605. enabled on;
  1606. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1607. engine vn {
  1608. enabled on;
  1609. vcodec vn;
  1610. acodec libfdk_aac;
  1611. abitrate 45;
  1612. asample_rate 44100;
  1613. achannels 2;
  1614. aparams {
  1615. }
  1616. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1617. }
  1618. }
  1619. }
  1620. # ffmpeg-copy(forward implements by ffmpeg).
  1621. # copy the video and audio to a new stream.
  1622. vhost copy.transcode.srs.com {
  1623. transcode {
  1624. enabled on;
  1625. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1626. engine copy {
  1627. enabled on;
  1628. vcodec copy;
  1629. acodec copy;
  1630. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1631. }
  1632. }
  1633. }
  1634. # transcode all app and stream of vhost
  1635. # the comments, read example.transcode.srs.com
  1636. vhost all.transcode.srs.com {
  1637. transcode {
  1638. enabled on;
  1639. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1640. engine ffsuper {
  1641. enabled on;
  1642. iformat flv;
  1643. vfilter {
  1644. i ./doc/ffmpeg-logo.png;
  1645. filter_complex 'overlay=10:10';
  1646. }
  1647. vcodec libx264;
  1648. vbitrate 1500;
  1649. vfps 25;
  1650. vwidth 768;
  1651. vheight 320;
  1652. vthreads 12;
  1653. vprofile main;
  1654. vpreset medium;
  1655. vparams {
  1656. t 100;
  1657. coder 1;
  1658. b_strategy 2;
  1659. bf 3;
  1660. refs 10;
  1661. }
  1662. acodec libfdk_aac;
  1663. abitrate 70;
  1664. asample_rate 44100;
  1665. achannels 2;
  1666. aparams {
  1667. profile:a aac_low;
  1668. }
  1669. oformat flv;
  1670. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1671. }
  1672. engine ffhd {
  1673. enabled on;
  1674. vcodec libx264;
  1675. vbitrate 1200;
  1676. vfps 25;
  1677. vwidth 1382;
  1678. vheight 576;
  1679. vthreads 6;
  1680. vprofile main;
  1681. vpreset medium;
  1682. vparams {
  1683. }
  1684. acodec libfdk_aac;
  1685. abitrate 70;
  1686. asample_rate 44100;
  1687. achannels 2;
  1688. aparams {
  1689. }
  1690. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1691. }
  1692. engine ffsd {
  1693. enabled on;
  1694. vcodec libx264;
  1695. vbitrate 800;
  1696. vfps 25;
  1697. vwidth 1152;
  1698. vheight 480;
  1699. vthreads 4;
  1700. vprofile main;
  1701. vpreset fast;
  1702. vparams {
  1703. }
  1704. acodec libfdk_aac;
  1705. abitrate 60;
  1706. asample_rate 44100;
  1707. achannels 2;
  1708. aparams {
  1709. }
  1710. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1711. }
  1712. engine fffast {
  1713. enabled on;
  1714. vcodec libx264;
  1715. vbitrate 300;
  1716. vfps 20;
  1717. vwidth 768;
  1718. vheight 320;
  1719. vthreads 2;
  1720. vprofile baseline;
  1721. vpreset superfast;
  1722. vparams {
  1723. }
  1724. acodec libfdk_aac;
  1725. abitrate 45;
  1726. asample_rate 44100;
  1727. achannels 2;
  1728. aparams {
  1729. }
  1730. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1731. }
  1732. engine vcopy {
  1733. enabled on;
  1734. vcodec copy;
  1735. acodec libfdk_aac;
  1736. abitrate 45;
  1737. asample_rate 44100;
  1738. achannels 2;
  1739. aparams {
  1740. }
  1741. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1742. }
  1743. engine acopy {
  1744. enabled on;
  1745. vcodec libx264;
  1746. vbitrate 300;
  1747. vfps 20;
  1748. vwidth 768;
  1749. vheight 320;
  1750. vthreads 2;
  1751. vprofile baseline;
  1752. vpreset superfast;
  1753. vparams {
  1754. }
  1755. acodec copy;
  1756. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1757. }
  1758. engine copy {
  1759. enabled on;
  1760. vcodec copy;
  1761. acodec copy;
  1762. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1763. }
  1764. }
  1765. }
  1766. # transcode all stream using the empty ffmpeg demo, do nothing.
  1767. vhost ffempty.transcode.srs.com {
  1768. transcode {
  1769. enabled on;
  1770. ffmpeg ./objs/research/ffempty;
  1771. engine empty {
  1772. enabled on;
  1773. vcodec libx264;
  1774. vbitrate 300;
  1775. vfps 20;
  1776. vwidth 768;
  1777. vheight 320;
  1778. vthreads 2;
  1779. vprofile baseline;
  1780. vpreset superfast;
  1781. vparams {
  1782. }
  1783. acodec libfdk_aac;
  1784. abitrate 45;
  1785. asample_rate 44100;
  1786. achannels 2;
  1787. aparams {
  1788. }
  1789. output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  1790. }
  1791. }
  1792. }
  1793. # transcode all app and stream of app
  1794. vhost app.transcode.srs.com {
  1795. # the streaming transcode configs.
  1796. # if app specified, transcode all streams of app.
  1797. transcode live {
  1798. enabled on;
  1799. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1800. engine {
  1801. enabled off;
  1802. }
  1803. }
  1804. }
  1805. # transcode specified stream.
  1806. vhost stream.transcode.srs.com {
  1807. # the streaming transcode configs.
  1808. # if stream specified, transcode the matched stream.
  1809. transcode live/livestream {
  1810. enabled on;
  1811. ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  1812. engine {
  1813. enabled off;
  1814. }
  1815. }
  1816. }
  1817. #############################################################################################
  1818. # The origin cluster section
  1819. #############################################################################################
  1820. http_api {
  1821. enabled on;
  1822. listen 9090;
  1823. }
  1824. vhost a.origin.cluster.srs.com {
  1825. cluster {
  1826. mode local;
  1827. origin_cluster on;
  1828. coworkers 127.0.0.1:9091;
  1829. }
  1830. }
  1831. http_api {
  1832. enabled on;
  1833. listen 9091;
  1834. }
  1835. vhost b.origin.cluster.srs.com {
  1836. cluster {
  1837. mode local;
  1838. origin_cluster on;
  1839. coworkers 127.0.0.1:9090;
  1840. }
  1841. }