full.conf 59 KB

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