123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- listen 1935;
- max_connections 1000;
- srs_log_tank file;
- srs_log_file ./objs/srs.log;
- daemon off;
- http_api {
- enabled on;
- listen 1985;
- raw_api {
- # whether enable the HTTP RAW API.
- # default: off
- enabled on;
- # whether enable rpc reload.
- # default: off
- allow_reload on;
- # whether enable rpc query.
- # default: off
- allow_query on;
- # whether enable rpc update.
- # default: off
- allow_update on;
- }
- }
- http_server {
- enabled on;
- listen 8080;
- dir ./objs/nginx/html;
- }
- stats {
- network 0;
- disk sda sdb xvda xvdb;
- }
- stream_caster {
- enabled on;
- caster gb28181;
- # 转发流到rtmp服务器地址与端口
- # TODO: https://github.com/ossrs/srs/pull/1679/files#r400875104
- # [stream] is VideoChannelCodecID(视频通道编码ID) for sip
- # 自动创建的道通[stream] 是‘chid[ssrc]’ [ssrc]是rtp的ssrc
- # [ssrc] rtp中的ssrc
- output rtmp://127.0.0.1:1935/live/[ssrc];
- # 接收设备端rtp流的多路复用端口
- listen 9000;
- # rtp接收监听端口范围,最小值
- rtp_port_min 58200;
- # rtp接收监听端口范围,最大值
- rtp_port_max 58300;
- # 是否等待关键帧之后,再转发,
- # off:不需等待,直接转发
- # on:等第一个关键帧后,再转发
- wait_keyframe on;
- # rtp包空闲等待时间,如果指定时间没有收到任何包
- # rtp监听连接自动停止,发送BYE命令
- rtp_idle_timeout 30;
- # 是否转发音频流
- # 目前只支持aac格式,所以需要设备支持aac格式
- # on:转发音频
- # off:不转发音频,只有视频
- # *注意*!!!:flv 只支持11025 22050 44100 三种
- # 如果设备端没有三种中任何一个,转发时为自动选择一种格式
- # 同时也会将adts的头封装在flv aac raw数据中
- # 这样的话播放器为自动通过adts头自动选择采样频率
- # 像ffplay, vlc都可以,但是flash是没有声音,
- # 因为flash,只支持11025 22050 44100
- audio_enable on;
- # 是否开启rtp缓冲
- # 开启之后能有效解决rtp乱序等问题
- jitterbuffer_enable on;
- # 服务器主机号,可以域名或ip地址
- # 也就是设备端将媒体发送的地址,如果是服务器是内外网
- # 需要写外网地址,
- # 调用api创建stream session时返回ip地址也是host
- # $CANDIDATE 是系统环境变量,从环境变量获取地址,如果没有配置,用*
- # *代表指定stats network 的网卡号地址,如果没有配置network,默认则是第0号网卡地址
- # TODO: https://github.com/ossrs/srs/pull/1679/files#r400917594
- host host.docker.internal;
- #根据收到ps rtp包自带创建rtmp媒体通道,不需要api接口创建
- #rtmp地址参数[stream] 就是通道id 格式chid[ssrc]
- auto_create_channel on;
- sip {
- # 是否启用srs内部sip信令
- # 为on信令走srs, off 只转发ps流
- enabled off;
- # sip监听udp端口
- listen 5060;
- # SIP server ID(SIP服务器ID).
- # 设备端配置编号需要与该值一致,否则无法注册
- serial 34020000002000000001;
- # SIP server domain(SIP服务器域)
- realm 3402000000;
- # 服务端发送ack后,接收回应的超时时间,单位为秒
- # 如果指定时间没有回应,认为失败
- ack_timeout 30;
- # 设备心跳维持时间,如果指定时间内(秒)没有接收一个心跳
- # 认为设备离线
- keepalive_timeout 120;
- # 注册之后是否自动给设备端发送invite
- # on: 是 off 不是,需要通过api控制
- auto_play on;
- # 设备将流发送的端口,是否固定
- # on 发送流到多路复用端口 如9000
- # off 自动从rtp_mix_port - rtp_max_port 之间的值中
- # 选一个可以用的端口
- invite_port_fixed on;
- # 向设备或下级域查询设备列表的间隔,单位(秒)
- # 默认60秒
- query_catalog_interval 60;
- }
- }
- vhost __defaultVhost__ {
- hls {
- enabled off;
- }
- http_remux {
- enabled on;
- mount [vhost]/[app]/[stream].flv;
- }
- rtc {
- enabled on;
- bframe discard;
- }
- http_hooks {
- # whether the http hooks enable.
- # default off.
- enabled on;
- # when client connect to vhost/app, call the hook,
- # the request in the POST data string is a object encode by json:
- # {
- # "action": "on_connect",
- # "client_id": 1985,
- # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
- # "tcUrl": "rtmp://video.test.com/live?key=d2fa801d08e3f90ed1e1670e6e52651a",
- # "pageUrl": "http://www.test.com/live.html"
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_connect https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_connect http://host.docker.internal:8844/media/srs/notify/on_connect;
- # 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",
- # "send_bytes": 10240, "recv_bytes": 10240
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_close https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_close http://host.docker.internal:8844/media/srs/notify/on_close;
- # 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", "param":"?token=xxx&salt=yyy"
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_publish https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_publish http://host.docker.internal:8844/media/srs/notify/on_publish;
- # 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", "param":"?token=xxx&salt=yyy"
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_unpublish https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_unpublish http://host.docker.internal:8844/media/srs/notify/on_unpublish;
- # 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", "param":"?token=xxx&salt=yyy",
- # "pageUrl": "http://www.test.com/live.html"
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_play https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_play http://host.docker.internal:8844/media/srs/notify/on_play;
- # 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", "param":"?token=xxx&salt=yyy"
- # }
- # if valid, the hook must return HTTP code 200(Status 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
- # @remark For SRS4, the HTTPS url is supported, for example:
- # on_stop https://xxx/api0 https://xxx/api1 https://xxx/apiN
- on_stop http://host.docker.internal:8844/media/srs/notify/on_stop;
- # when srs reap a dvr file, call the hook,
- # the request in the POST data string is a object encode by json:
- # {
- # "action": "on_dvr",
- # "client_id": 1985,
- # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
- # "stream": "livestream", "param":"?token=xxx&salt=yyy",
- # "cwd": "/usr/local/srs",
- # "file": "./objs/nginx/html/live/livestream.1420254068776.flv"
- # }
- # if valid, the hook must return HTTP code 200(Status OK) and response
- # an int value specifies the error code(0 corresponding to success):
- # 0
- on_dvr http://host.docker.internal:8844/media/srs/notify/on_dvr;
- # when srs reap a ts file of hls, call the hook,
- # the request in the POST data string is a object encode by json:
- # {
- # "action": "on_hls",
- # "client_id": 1985,
- # "ip": "192.168.1.10", "vhost": "video.test.com", "app": "live",
- # "stream": "livestream", "param":"?token=xxx&salt=yyy",
- # "duration": 9.36, // in seconds
- # "cwd": "/usr/local/srs",
- # "file": "./objs/nginx/html/live/livestream/2015-04-23/01/476584165.ts",
- # "url": "live/livestream/2015-04-23/01/476584165.ts",
- # "m3u8": "./objs/nginx/html/live/livestream/live.m3u8",
- # "m3u8_url": "live/livestream/live.m3u8",
- # "seq_no": 100
- # }
- # if valid, the hook must return HTTP code 200(Status OK) and response
- # an int value specifies the error code(0 corresponding to success):
- # 0
- on_hls http://host.docker.internal:8844/media/srs/notify/on_hls;
- # when srs reap a ts file of hls, call this hook,
- # used to push file to cdn network, by get the ts file from cdn network.
- # so we use HTTP GET and use the variable following:
- # [app], replace with the app.
- # [stream], replace with the stream.
- # [param], replace with the param.
- # [ts_url], replace with the ts url.
- # ignore any return data of server.
- # @remark random select a url to report, not report all.
- on_hls_notify http://host.docker.internal:8844/media/srs/notify/hls_[app]_[stream]_[ts_url]/[param];
- }
- }
|