Blame view

trunk/conf/srs.conf 26.6 KB
1
# the listen ports, split by space.
winlin authored
2
listen              1935;
3 4 5 6
# the default chunk size is 128, max is 65536,
# some client does not support chunk size change,
# however, most clients supports it and it can improve 
# performance about 10%.
winlin authored
7
# default: 4096
8
chunk_size          65000;
winlin authored
9 10 11 12
# the logs dir.
# if enabled ffmpeg, each stracoding stream will create a log file.
# default: ./objs/logs
log_dir             ./objs/logs;
13 14 15 16
# the max connections.
# if exceed the max connections, server will drop the new connection.
# default: 2000
max_connections     2000;
17
# vhost list, the __defaultVhost__ is the default vhost
18
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
19
# for which cannot identify the required vhost.
20
# for default demo.
21
vhost __defaultVhost__ {
winlin authored
22
    enabled         on;
winlin authored
23
    gop_cache       on;
winlin authored
24
    queue_length    30;
25
    forward         127.0.0.1:19350;
winlin authored
26
    hls {
27
        enabled         on;
winlin authored
28 29 30 31
        hls_path        ./objs/nginx/html;
        hls_fragment    5;
        hls_window      30;
    }
winlin authored
32 33 34 35 36 37 38 39 40
    http_hooks {
        enabled         off;
        on_connect      http://127.0.0.1:8085/api/v1/clients;
        on_close        http://127.0.0.1:8085/api/v1/clients;
        on_publish      http://127.0.0.1:8085/api/v1/streams;
        on_unpublish    http://127.0.0.1:8085/api/v1/streams;
        on_play         http://127.0.0.1:8085/api/v1/sessions;
        on_stop         http://127.0.0.1:8085/api/v1/sessions;
    }
41
    transcode {
42 43
        enabled         on;
        ffmpeg          ./objs/ffmpeg/bin/ffmpeg;
winlin authored
44
        engine ld {
45
            enabled         on;
winlin authored
46
            vfilter {
winlin authored
47
                vf                  'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf';
winlin authored
48
            }
49 50 51
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
52 53
            vwidth          768;
            vheight         320;
winlin authored
54
            vthreads        1;
55 56
            vprofile        baseline;
            vpreset         superfast;
57 58
            vparams {
            }
59
            acodec          libaacplus;
60
            abitrate        45;
61
            asample_rate    44100;
62
            achannels       2;
63 64
            aparams {
            }
65
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
66
        }
winlin authored
67
        engine sd {
winlin authored
68
            enabled         on;
winlin authored
69 70 71
            vfilter {
                vf                  'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
            }
winlin authored
72 73 74
            vcodec          libx264;
            vbitrate        500;
            vfps            20;
winlin authored
75 76
            vwidth          768;
            vheight         320;
winlin authored
77 78 79 80 81 82 83 84 85 86 87
            vthreads        1;
            vprofile        main;
            vpreset         fast;
            vparams {
            }
            acodec          libaacplus;
            abitrate        40;
            asample_rate    44100;
            achannels       2;
            aparams {
            }
88
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
winlin authored
89
        }
90 91
    }
}
92 93 94 95
# for development
vhost dev {
    enabled         on;
    gop_cache       on;
96
    queue_length    10;
97
    forward         127.0.0.1:19350;
winlin authored
98
    hls {
winlin authored
99
        enabled         off;
winlin authored
100 101 102 103
        hls_path        ./objs/nginx/html;
        hls_fragment    5;
        hls_window      30;
    }
104
    http_hooks {
105
        enabled         off;
106
        on_connect      http://127.0.0.1:8085/api/v1/clients;
107 108 109 110 111 112
        on_close        http://127.0.0.1:8085/api/v1/clients;
        on_publish      http://127.0.0.1:8085/api/v1/streams;
        on_unpublish    http://127.0.0.1:8085/api/v1/streams;
        on_play         http://127.0.0.1:8085/api/v1/sessions;
        on_stop         http://127.0.0.1:8085/api/v1/sessions;
    }
113
    transcode {
114
        enabled     off;
115
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
116
        engine dev {
winlin authored
117
            enabled         on;
118 119 120 121 122 123 124 125 126 127 128 129 130
            vfilter {
            }
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
            vwidth          768;
            vheight         320;
            vthreads        1;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
131 132 133 134 135 136 137 138 139 140 141 142
            abitrate        45;
            asample_rate    44100;
            achannels       2;
            aparams {
            }
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
        engine dev_acodec {
            enabled         on;
            vcodec          copy;
            acodec          libaacplus;
            abitrate        45;
143 144 145 146
            asample_rate    44100;
            achannels       2;
            aparams {
            }
147
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
148 149 150
        }
    }
}
winlin authored
151 152
# the http hook callback vhost, srs will invoke the hooks for specified events.
vhost hooks.callback.vhost.com {
153
    http_hooks {
154 155 156
        # whether the http hooks enalbe.
        # default off.
        enabled         on;
157 158 159
        # when client connect to vhost/app, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
160 161
        #           "action": "on_connect",
        #           "client_id": 1985,
162 163 164 165 166 167 168 169 170
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
        #           "pageUrl": "http://www.test.com/live.html"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_connect http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_connect      http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239
        # when client close/disconnect to vhost/app/stream, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
        #           "action": "on_close",
        #           "client_id": 1985,
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_close http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_close        http://127.0.0.1:8085/api/v1/clients http://localhost:8085/api/v1/clients;
        # when client(encoder) publish to vhost/app/stream, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
        #           "action": "on_publish",
        #           "client_id": 1985,
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
        #           "stream": "livestream"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_publish http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_publish      http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
        # when client(encoder) stop publish to vhost/app/stream, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
        #           "action": "on_unpublish",
        #           "client_id": 1985,
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
        #           "stream": "livestream"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_unpublish http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_unpublish    http://127.0.0.1:8085/api/v1/streams http://localhost:8085/api/v1/streams;
        # when client start to play vhost/app/stream, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
        #           "action": "on_play",
        #           "client_id": 1985,
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
        #           "stream": "livestream"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_play http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_play         http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
        # when client stop to play vhost/app/stream, call the hook,
        # the request in the POST data string is a object encode by json:
        #       {
        #           "action": "on_stop",
        #           "client_id": 1985,
        #           "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
        #           "stream": "livestream"
        #       }
        # if valid, the hook must return HTTP code 200(Stauts OK) and response
        # an int value specifies the error code(0 corresponding to success):
        #       0
        # support multiple api hooks, format:
        #       on_stop http://xxx/api0 http://xxx/api1 http://xxx/apiN
        on_stop         http://127.0.0.1:8085/api/v1/sessions http://localhost:8085/api/v1/sessions;
240
    }
winlin authored
241
}
winlin authored
242 243 244 245 246
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
vhost mirror.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
247
        engine mirror {
winlin authored
248 249 250 251 252 253 254
            enabled         on;
            vfilter {
                vf                  'split [main][tmp]; [tmp] crop=iw:ih/2:0:0, vflip [flip]; [main][flip] overlay=0:H/2';
            }
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
255 256
            vwidth          768;
            vheight         320;
winlin authored
257 258 259 260 261 262
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
263
            abitrate        45;
winlin authored
264 265 266 267
            asample_rate    44100;
            achannels       2;
            aparams {
            }
268
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
winlin authored
269 270 271 272 273 274 275 276
        }
    }
}
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
vhost drawtext.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
277
        engine drawtext {
winlin authored
278 279
            enabled         on;
            vfilter {
winlin authored
280
                vf                  'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf';
winlin authored
281 282 283 284
            }
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
285 286
            vwidth          768;
            vheight         320;
winlin authored
287 288 289 290 291 292
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
293
            abitrate        45;
winlin authored
294 295 296 297
            asample_rate    44100;
            achannels       2;
            aparams {
            }
298
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
winlin authored
299 300 301 302 303 304 305 306
        }
    }
}
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
vhost crop.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
307
        engine crop {
winlin authored
308 309 310 311 312 313 314
            enabled         on;
            vfilter {
                vf                  'crop=in_w-20:in_h-160:10:80';
            }
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
315 316
            vwidth          768;
            vheight         320;
winlin authored
317 318 319 320 321 322
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
323
            abitrate        45;
winlin authored
324 325 326 327
            asample_rate    44100;
            achannels       2;
            aparams {
            }
328
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
winlin authored
329 330 331 332 333 334 335 336
        }
    }
}
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
vhost logo.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
337
        engine logo {
winlin authored
338 339 340 341 342 343 344
            enabled         on;
            vfilter {
                vf                  'crop=200:100:10:10';
            }
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
345 346
            vwidth          768;
            vheight         320;
winlin authored
347 348 349 350 351 352
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
353
            abitrate        45;
winlin authored
354 355 356 357
            asample_rate    44100;
            achannels       2;
            aparams {
            }
358
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
winlin authored
359 360 361
        }
    }
}
362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395
# audio transcode only.
# for example, FMLE publish audio codec in mp3, and donot support HLS output,
# we can transcode the audio to aac and copy video to the new stream with HLS.
vhost audio.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
        engine acodec {
            enabled         on;
            vcodec          copy;
            acodec          libaacplus;
            abitrate        45;
            asample_rate    44100;
            achannels       2;
            aparams {
            }
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
    }
}
# ffmpeg-copy(forward implements by ffmpeg).
# copy the video and audio to a new stream.
vhost copy.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
        engine copy {
            enabled         on;
            vcodec          copy;
            acodec          copy;
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
    }
}
396 397
# transcode all app and stream of vhost
vhost all.transcode.vhost.com {
398
    # the streaming transcode configs.
399
    transcode {
400 401
        # whether the transcode enabled.
        # if off, donot transcode.
winlin authored
402
        # default: off.
403
        enabled     on;
404 405
        # the ffmpeg 
        ffmpeg ./objs/ffmpeg/bin/ffmpeg;
406
        # the transcode engine for matched stream.
407 408
        # all matched stream will transcoded to the following stream.
        # the transcode set name(ie. hd) is optional and not used.
winlin authored
409
        engine ffsuper {
410
            # whether the engine is enabled
winlin authored
411
            # default: off.
412
            enabled         on;
winlin authored
413 414 415 416 417 418 419 420
            # ffmpeg filters, follows the main input.
            vfilter {
                # the logo input file.
                i               ./doc/ffmpeg-logo.png;
                # the ffmpeg complex filter.
                # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
                filter_complex      'overlay=10:10';
            }
421 422 423
            # video encoder name. can be:
            # libx264: use h.264(libx264) video encoder.
            # copy: donot encoder the video stream, copy it.
424 425 426 427 428 429
            vcodec          libx264;
            # video bitrate, in kbps
            vbitrate        1500;
            # video framerate.
            vfps            25;
            # video width, must be even numbers.
winlin authored
430
            vwidth          768;
431
            # video height, must be even numbers.
winlin authored
432
            vheight         320;
433 434 435 436 437 438 439 440 441 442 443
            # the max threads for ffmpeg to used.
            vthreads        12;
            # x264 profile, @see x264 -help, can be:
            # high,main,baseline
            vprofile        main;
            # x264 preset, @see x264 -help, can be: 
            # ultrafast,superfast,veryfast,faster,fast
            # medium,slow,slower,veryslow,placebo
            vpreset         medium;
            # other x264 or ffmpeg video params
            vparams {
winlin authored
444 445 446 447 448 449 450
                # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
                t               100;
                # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
                coder           1;
                b_strategy      2;
                bf              3;
                refs            10;
451
            }
452 453 454
            # audio encoder name. can be:
            # libaacplus: use aac(libaacplus) audio encoder.
            # copy: donot encoder the audio stream, copy it.
455 456 457 458 459 460 461 462 463 464
            acodec          libaacplus;
            # audio bitrate, in kbps. [16, 72] for libaacplus.
            abitrate        70;
            # audio sample rate. for flv/rtmp, it must be:
            # 44100,22050,11025,5512
            asample_rate    44100;
            # audio channel, 1 for mono, 2 for stereo.
            achannels       2;
            # other ffmpeg audio params
            aparams {
winlin authored
465 466
                # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
                profile:a   aac_low;
467 468 469 470 471 472
            }
            # output stream. variables:
            # [vhost] the input stream vhost.
            # [port] the intput stream port.
            # [app] the input stream app.
            # [stream] the input stream name.
473 474
            # [engine] the tanscode engine name.
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
475
        }
winlin authored
476
        engine ffhd {
477
            enabled         on;
478 479 480
            vcodec          libx264;
            vbitrate        1200;
            vfps            25;
winlin authored
481
            vwidth          1382;
482 483 484 485
            vheight         576;
            vthreads        6;
            vprofile        main;
            vpreset         medium;
486 487
            vparams {
            }
488 489 490 491
            acodec          libaacplus;
            abitrate        70;
            asample_rate    44100;
            achannels       2;
492 493
            aparams {
            }
winlin authored
494
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
495
        }
winlin authored
496
        engine ffsd {
497
            enabled         on;
498 499 500
            vcodec          libx264;
            vbitrate        800;
            vfps            25;
winlin authored
501
            vwidth          1152;
502 503 504 505
            vheight         480;
            vthreads        4;
            vprofile        main;
            vpreset         fast;
506 507
            vparams {
            }
508 509 510 511
            acodec          libaacplus;
            abitrate        60;
            asample_rate    44100;
            achannels       2;
512 513
            aparams {
            }
winlin authored
514
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
515
        }
winlin authored
516
        engine fffast {
517
            enabled     on;
518 519 520
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
521
            vwidth          768;
522 523 524 525
            vheight         320;
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
526 527
            vparams {
            }
528
            acodec          libaacplus;
529 530 531 532 533 534 535 536 537 538 539 540
            abitrate        45;
            asample_rate    44100;
            achannels       2;
            aparams {
            }
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
        engine vcopy {
            enabled     on;
            vcodec          copy;
            acodec          libaacplus;
            abitrate        45;
541 542 543 544
            asample_rate    44100;
            achannels       2;
            aparams {
            }
winlin authored
545
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
546
        }
547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567
        engine acopy {
            enabled     on;
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
            vwidth          768;
            vheight         320;
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          copy;
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
        engine copy {
            enabled     on;
            vcodec          copy;
            acodec          copy;
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
        }
568 569 570 571 572 573 574
    }
}
# transcode all stream using the empty ffmpeg demo, donothing.
vhost ffempty.transcode.vhost.com {
    transcode {
        enabled     on;
        ffmpeg ./research/ffempty/ffempty;
winlin authored
575
        engine empty {
576 577 578 579
            enabled         on;
            vcodec          libx264;
            vbitrate        300;
            vfps            20;
winlin authored
580
            vwidth          768;
581 582 583 584 585 586 587
            vheight         320;
            vthreads        2;
            vprofile        baseline;
            vpreset         superfast;
            vparams {
            }
            acodec          libaacplus;
588
            abitrate        45;
589
            asample_rate    44100;
590
            achannels       2;
591 592
            aparams {
            }
winlin authored
593
            output          rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
594 595
        }
    }
winlin authored
596
}
597 598 599 600 601 602 603
# transcode all app and stream of app
vhost app.transcode.vhost.com {
    # the streaming transcode configs.
    # if app specified, transcode all streams of app.
    transcode live {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
604
        engine {
605 606 607 608 609 610 611 612 613 614 615
            enabled     off;
        }
    }
}
# transcode specified stream.
vhost stream.transcode.vhost.com {
    # the streaming transcode configs.
    # if stream specified, transcode the matched stream.
    transcode live/livestream {
        enabled     on;
        ffmpeg      ./objs/ffmpeg/bin/ffmpeg;
winlin authored
616
        engine {
617 618 619 620
            enabled     off;
        }
    }
}
winlin authored
621
# the vhost which forward publish streams.
winlin authored
622
vhost same.vhost.forward.vhost.com {
winlin authored
623 624 625 626
    # forward all publish stream to the specified server.
    # this used to split/forward the current stream for cluster active-standby,
    # active-active for cdn to build high available fault tolerance system.
    # format: {ip}:{port} {ip_N}:{port_N}
627 628 629
    # or specify the vhost by:
    # format: {ip}:{port}?vhost={vhost} {ip_N}:{port_N}?vhost={vhost}
    # if vhost not specified, use the request vhost instead.
winlin authored
630
    forward         127.0.0.1:1936 127.0.0.1:1937;
631
}
winlin authored
632
# the vhost which forward publish streams to other vhosts.
winlin authored
633
vhost change.vhost.forward.vhost.com {
634
    forward         127.0.0.1:1936?vhost=forward2.vhost.com 127.0.0.1:1937?vhost=forward3.vhost.com;
winlin authored
635
}
636
# the vhost disabled.
winlin authored
637 638 639 640 641 642
vhost removed.vhost.com {
    # whether the vhost is enabled.
    # if off, all request access denied.
    # default: on
    enabled         off;
}
winlin authored
643
# the vhost with hls specified.
winlin authored
644 645 646 647 648
vhost with-hls.vhost.com {
    hls {
        # whether the hls is enabled.
        # if off, donot write hls(ts and m3u8) when publish.
        # default: off
649
        enabled         on;
winlin authored
650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668
        # the hls output path.
        # the app dir is auto created under the hls_path.
        # for example, for rtmp stream:
        #   rtmp://127.0.0.1/live/livestream
        #   http://127.0.0.1/live/livestream.m3u8
        # where hls_path is /hls, srs will create the following files:
        #   /hls/live       the app dir for all streams.
        #   /hls/live/livestream.m3u8   the HLS m3u8 file.
        #   /hls/live/livestream-1.ts   the HLS media/ts file.
        # in a word, the hls_path is for vhost.
        # default: ./objs/nginx/html
        hls_path        /data/nginx/html;
        # the hls fragment in seconds, the duration of a piece of ts.
        # default: 10
        hls_fragment    10;
        # the hls window in seconds, the number of ts in m3u8.
        # default: 60
        hls_window      60;
    }
winlin authored
669
}
670 671
# the vhost with hls disabled.
vhost no-hls.vhost.com {
winlin authored
672 673 674 675
    hls {
        # whether the hls is enabled.
        # if off, donot write hls(ts and m3u8) when publish.
        # default: off
676
        enabled         off;
winlin authored
677
    }
678
}
679
# the vhost for min delay, donot cache any stream.
winlin authored
680 681 682 683 684 685 686 687 688
vhost min.delay.com {
    # whether cache the last gop.
    # if on, cache the last gop and dispatch to client,
    #   to enable fast startup for client, client play immediately.
    # if off, send the latest media data to client,
    #   client need to wait for the next Iframe to decode and show the video.
    # set to off if requires min delay;
    # set to on if requires client fast startup.
    # default: on
689
    gop_cache       off;
winlin authored
690 691 692 693 694
    # the max live queue length in seconds.
    # if the messages in the queue exceed the max length, 
    # drop the old whole gop.
    # default: 30
    queue_length    10;
695
}
696
# the vhost for antisuck.
winlin authored
697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713
vhost refer.anti_suck.com {
    # the common refer for play and publish.
    # if the page url of client not in the refer, access denied.
    # if not specified this field, allow all.
    # default: not specified.
    refer           github.com github.io;
    # refer for publish clients specified.
    # the common refer is not overrided by this.
    # if not specified this field, allow all.
    # default: not specified.
    refer_publish   github.com github.io;
    # refer for play clients specified.
    # the common refer is not overrided by this.
    # if not specified this field, allow all.
    # default: not specified.
    refer_play      github.com github.io;
}
714 715 716 717 718 719 720 721 722
# config for the pithy print,
# which always print constant message specified by interval,
# whatever the clients in concurrency.
pithy_print {
    # shared print interval for all publish clients, in milliseconds.
    # if not specified, set to 1100.
    publish         2000;
    # shared print interval for all play clients, in milliseconds.
    # if not specified, set to 1300.
723 724 725 726
    play            3000;
    # shared print interval for all forwarders, in milliseconds.
    # if not specified, set to 2000.
    forwarder       3000;
winlin authored
727 728 729 730 731 732
    # shared print interval for all encoders, in milliseconds.
    # if not specified, set to 2000.
    encoder        3000;
    # shared print interval for all hls, in milliseconds.
    # if not specified, set to 2000.
    hls            3000;
733
}
734
735