mirror of https://github.com/ossrs/srs.git
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
926 lines
34 KiB
Plaintext
926 lines
34 KiB
Plaintext
# all config for srs
|
|
|
|
#############################################################################################
|
|
# RTMP sections
|
|
#############################################################################################
|
|
# the rtmp listen ports, split by space.
|
|
listen 1935;
|
|
# the pid file
|
|
# to ensure only one process can use a pid file
|
|
# and provides the current running process id, for script,
|
|
# for example, init.d script to manage the server.
|
|
# default: ./objs/srs.pid
|
|
pid ./objs/srs.pid;
|
|
# 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%.
|
|
# default: 60000
|
|
chunk_size 60000;
|
|
# the logs dir.
|
|
# if enabled ffmpeg, each stracoding stream will create a log file.
|
|
# default: ./objs
|
|
ff_log_dir ./objs;
|
|
# the log tank, console or file.
|
|
# if console, print log to console.
|
|
# if file, write log to file. requires srs_log_file if log to file.
|
|
# default: file.
|
|
srs_log_tank file;
|
|
# the log level, for all log tanks.
|
|
# can be: verbose, info, trace, warn, error
|
|
# default: trace
|
|
srs_log_level trace;
|
|
# when srs_log_tank is file, specifies the log file.
|
|
# default: ./objs/srs.log
|
|
srs_log_file ./objs/srs.log;
|
|
# the max connections.
|
|
# if exceed the max connections, server will drop the new connection.
|
|
# default: 2000
|
|
max_connections 1000;
|
|
# whether start as deamon
|
|
# @remark: donot support reload.
|
|
# default: on
|
|
daemon on;
|
|
|
|
#############################################################################################
|
|
# HTTP sections
|
|
#############################################################################################
|
|
# api of srs.
|
|
# the http api config, export for external program to manage srs.
|
|
# user can access http api of srs in browser directly, for instance, to access by:
|
|
# curl http://192.168.1.170:1985/api/v1/reload
|
|
# which will reload srs, like cmd killall -1 srs, but the js can also invoke the http api,
|
|
# where the cli can only be used in shell/terminate.
|
|
http_api {
|
|
# whether http api is enabled.
|
|
# default: off
|
|
enabled on;
|
|
# the http api port
|
|
# default: 1985
|
|
listen 1985;
|
|
}
|
|
# embeded http server in srs.
|
|
# the http streaming config, for HLS/HDS/DASH/HTTPProgressive
|
|
# global config for http streaming, user must config the http section for each vhost.
|
|
# the embed http server used to substitute nginx in ./objs/nginx,
|
|
# for example, srs runing in arm, can provides RTMP and HTTP service, only with srs installed.
|
|
# user can access the http server pages, generally:
|
|
# curl http://192.168.1.170:80/srs.html
|
|
# which will show srs version and welcome to srs.
|
|
# @remark, the http embeded stream need to config the vhost, for instance, the __defaultVhost__
|
|
# need to open the feature http of vhost.
|
|
http_stream {
|
|
# whether http streaming service is enabled.
|
|
# default: off
|
|
enabled on;
|
|
# the http streaming port
|
|
# @remark, if use lower port, for instance 80, user must start srs by root.
|
|
# default: 8080
|
|
listen 8080;
|
|
# the default dir for http root.
|
|
# default: ./objs/nginx/html
|
|
dir ./objs/nginx/html;
|
|
}
|
|
|
|
#############################################################################################
|
|
# RTMP/HTTP VHOST sections
|
|
#############################################################################################
|
|
# vhost list, the __defaultVhost__ is the default vhost
|
|
# for example, user use ip to access the stream: rtmp://192.168.1.2/live/livestream.
|
|
# for which cannot identify the required vhost.
|
|
vhost __defaultVhost__ {
|
|
}
|
|
|
|
# vhost for edge, edge and origin is the same vhost
|
|
vhost same.edge.srs.com {
|
|
# the mode of vhost, local or remote.
|
|
# local: vhost is origin vhost, which provides stream source.
|
|
# remote: vhost is edge vhost, which pull/push to origin.
|
|
# default: local
|
|
mode remote;
|
|
# for edge(remote mode), user must specifies the origin server
|
|
# format as: <server_name|ip>[:port]
|
|
# @remark user can specifies multiple origin for error backup, by space,
|
|
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
|
|
origin 127.0.0.1:1935 localhost:1935;
|
|
}
|
|
# vhost for edge, chnage vhost.
|
|
vhost change.edge.srs.com {
|
|
mode remote;
|
|
# TODO: FIXME: support extra params.
|
|
origin 127.0.0.1:1935 localhost:1935 {
|
|
# specify the vhost to override the vhost in client request.
|
|
vhost edge2.srs.com;
|
|
# specify the refer(pageUrl) to override the refer in client request.
|
|
refer http://srs/index.html;
|
|
}
|
|
}
|
|
|
|
# vhost for dvr
|
|
vhost dvr.srs.com {
|
|
# dvr RTMP stream to file,
|
|
# start to record to file when encoder publish,
|
|
# reap flv according by specified dvr_plan.
|
|
# http callbacks:
|
|
# @see http callback on_dvr_hss_reap_flv on http_hooks section.
|
|
dvr {
|
|
# whether enabled dvr features
|
|
# default: off
|
|
enabled on;
|
|
# the dvr output path.
|
|
# the app dir is auto created under the dvr_path.
|
|
# for example, for rtmp stream:
|
|
# rtmp://127.0.0.1/live/livestream
|
|
# http://127.0.0.1/live/livestream.m3u8
|
|
# where dvr_path is /dvr, srs will create the following files:
|
|
# /dvr/live the app dir for all streams.
|
|
# /dvr/live/livestream.{time}.flv the dvr flv file.
|
|
# @remark, the time use system timestamp in ms, user can use http callback to rename it.
|
|
# in a word, the dvr_path is for vhost.
|
|
# default: ./objs/nginx/html
|
|
dvr_path ./objs/nginx/html;
|
|
# the dvr plan. canbe:
|
|
# session reap flv when session end(unpublish).
|
|
# segment reap flv when flv duration exceed the specified dvr_duration.
|
|
# hss reap flv required by bravo(chnvideo.com) p2p system.
|
|
# default: session
|
|
dvr_plan session;
|
|
# the param for plan(segment), in seconds.
|
|
# default: 30
|
|
dvr_duration 30;
|
|
}
|
|
}
|
|
|
|
# vhost for ingest
|
|
vhost ingest.srs.com {
|
|
# ingest file/stream/device then push to SRS over RTMP.
|
|
# the name/id used to identify the ingest, must be unique in global.
|
|
# ingest id is used in reload or http api management.
|
|
ingest livestream {
|
|
# whether enabled ingest features
|
|
# default: off
|
|
enabled on;
|
|
# input file/stream/device
|
|
# @remark only support one input.
|
|
input {
|
|
# the type of input.
|
|
# can be file/stream/device, that is,
|
|
# file: ingest file specifies by url.
|
|
# stream: ingest stream specifeis by url.
|
|
# device: not support yet.
|
|
# default: file
|
|
type file;
|
|
# the url of file/stream.
|
|
url ./doc/source.200kbps.768x320.flv;
|
|
}
|
|
# the ffmpeg
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
# the transcode engine, @see all.transcode.srs.com
|
|
# @remark, the output is specified following.
|
|
engine {
|
|
# @see enabled of transcode engine.
|
|
# if disabled or vcodec/acodec not specified, use copy.
|
|
# default: off.
|
|
enabled off;
|
|
# output stream. variables:
|
|
# [vhost] current vhost which start the ingest.
|
|
# [port] system RTMP stream port.
|
|
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
|
|
}
|
|
}
|
|
}
|
|
|
|
# vhost for http
|
|
vhost http.srs.com {
|
|
# http vhost specified config
|
|
http {
|
|
# whether enabled the http streaming service for vhost.
|
|
# default: off
|
|
enabled on;
|
|
# the virtual directory root for this vhost to mount at
|
|
# for example, if mount to /hls, user access by http://server/hls
|
|
# default: /
|
|
mount /hls;
|
|
# main dir of vhost,
|
|
# to delivery HTTP stream of this vhost.
|
|
# default: ./objs/nginx/html
|
|
dir ./objs/nginx/html/hls;
|
|
}
|
|
}
|
|
|
|
# vhost for atc.
|
|
vhost atc.srs.com {
|
|
# vhost for atc for hls/hds/rtmp backup.
|
|
# generally, atc default to off, server delivery rtmp stream to client(flash) timestamp from 0.
|
|
# when atc is on, server delivery rtmp stream by absolute time.
|
|
# atc is used, for instance, encoder will copy stream to master and slave server,
|
|
# server use atc to delivery stream to edge/client, where stream time from master/slave server
|
|
# is always the same, client/tools can slice RTMP stream to HLS according to the same time,
|
|
# if the time not the same, the HLS stream cannot slice to support system backup.
|
|
#
|
|
# @see http://www.adobe.com/cn/devnet/adobe-media-server/articles/varnish-sample-for-failover.html
|
|
# @see http://www.baidu.com/#wd=hds%20hls%20atc
|
|
#
|
|
# default: off
|
|
atc on;
|
|
# whether enable the auto atc,
|
|
# if enabled, detect the bravo_atc="true" in onMetaData packet,
|
|
# set atc to on if matched.
|
|
# always ignore the onMetaData if atc_auto is off.
|
|
# default: on
|
|
atc_auto on;
|
|
}
|
|
|
|
# vhost for bandwidth check
|
|
# generally, the bandcheck vhost must be: bandcheck.srs.com,
|
|
# or need to modify the vhost of client.
|
|
vhost bandcheck.srs.com {
|
|
enabled on;
|
|
chunk_size 65000;
|
|
# bandwidth check config.
|
|
bandcheck {
|
|
# whether support bandwidth check,
|
|
# default: off.
|
|
enabled on;
|
|
# the key for server to valid,
|
|
# if invalid key, server disconnect and abort the bandwidth check.
|
|
key "35c9b402c12a7246868752e2878f7e0e";
|
|
# the interval in seconds for bandwidth check,
|
|
# server donot allow new test request.
|
|
# default: 30
|
|
interval 30;
|
|
# the max available check bandwidth in kbps.
|
|
# to avoid attack of bandwidth check.
|
|
# default: 1000
|
|
limit_kbps 4000;
|
|
}
|
|
}
|
|
|
|
# set the chunk size of vhost.
|
|
vhost chunksize.srs.com {
|
|
# the default chunk size is 128, max is 65536,
|
|
# some client does not support chunk size change,
|
|
# vhost chunk size will override the global value.
|
|
# default: global chunk size.
|
|
chunk_size 128;
|
|
}
|
|
|
|
# the http hook callback vhost, srs will invoke the hooks for specified events.
|
|
vhost hooks.callback.srs.com {
|
|
http_hooks {
|
|
# whether the http hooks enalbe.
|
|
# 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",
|
|
# "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;
|
|
# 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;
|
|
#
|
|
# for dvr(dvr_plan is hss).
|
|
# when dvr got flv header, call the hook,
|
|
# the request in the POST data string is a object encode by json:
|
|
# {
|
|
# "action": "on_dvr_hss_reap_flv_header",
|
|
# "vhost": "video.test.com", "app": "live",
|
|
# "stream": "livestream",
|
|
# "segment": {
|
|
# "cwd": "/usr/local/srs",
|
|
# "path": "./objs/nginx/html/live/livestream.header.flv"
|
|
# }
|
|
# }
|
|
# when dvr reap flv file, call the hook,
|
|
# the request in the POST data string is a object encode by json:
|
|
# {
|
|
# "action": "on_dvr_hss_reap_flv",
|
|
# "vhost": "video.test.com", "app": "live",
|
|
# "stream": "livestream",
|
|
# "segment": {
|
|
# "cwd": "/usr/local/srs",
|
|
# "path": "./objs/nginx/html/live/livestream.1398315892865.flv",
|
|
# "duration": 1001, "offset":0,
|
|
# "has_keyframe": true, "pts":1398315895958
|
|
# }
|
|
# }
|
|
# 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_dvr_hss_reap_flv http://127.0.0.1:8085/api/v1/dvrs http://localhost:8085/api/v1/dvrs;
|
|
}
|
|
}
|
|
|
|
# the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
|
|
vhost mirror.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine mirror {
|
|
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;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 45;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
}
|
|
}
|
|
# the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
|
|
vhost drawtext.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine drawtext {
|
|
enabled on;
|
|
vfilter {
|
|
vf 'drawtext=text=SimpleRtmpServer(SRS):x=10:y=10:fontcolor=#cccccc:fontfile=./doc/FreeSerifBold.ttf';
|
|
}
|
|
vcodec libx264;
|
|
vbitrate 300;
|
|
vfps 20;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 45;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
}
|
|
}
|
|
# the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
|
|
vhost crop.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine crop {
|
|
enabled on;
|
|
vfilter {
|
|
vf 'crop=in_w-20:in_h-160:10:80';
|
|
}
|
|
vcodec libx264;
|
|
vbitrate 300;
|
|
vfps 20;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 45;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
}
|
|
}
|
|
# the logo filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#overlay
|
|
vhost logo.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine logo {
|
|
enabled on;
|
|
vfilter {
|
|
i ./doc/ffmpeg-logo.png;
|
|
filter_complex 'overlay=10:10';
|
|
}
|
|
vcodec libx264;
|
|
vbitrate 300;
|
|
vfps 20;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 45;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
}
|
|
}
|
|
# 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.srs.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];
|
|
}
|
|
}
|
|
}
|
|
# disable video, transcode/copy audio.
|
|
# for example, publish pure audio stream.
|
|
vhost vn.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine vn {
|
|
enabled on;
|
|
vcodec vn;
|
|
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.srs.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];
|
|
}
|
|
}
|
|
}
|
|
# transcode all app and stream of vhost
|
|
vhost all.transcode.srs.com {
|
|
# the streaming transcode configs.
|
|
transcode {
|
|
# whether the transcode enabled.
|
|
# if off, donot transcode.
|
|
# default: off.
|
|
enabled on;
|
|
# the ffmpeg
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
# the transcode engine for matched stream.
|
|
# all matched stream will transcoded to the following stream.
|
|
# the transcode set name(ie. hd) is optional and not used.
|
|
engine ffsuper {
|
|
# whether the engine is enabled
|
|
# default: off.
|
|
enabled on;
|
|
# 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';
|
|
}
|
|
# video encoder name. can be:
|
|
# libx264: use h.264(libx264) video encoder.
|
|
# copy: donot encoder the video stream, copy it.
|
|
# vn: disable video output.
|
|
vcodec libx264;
|
|
# video bitrate, in kbps
|
|
vbitrate 1500;
|
|
# video framerate.
|
|
vfps 25;
|
|
# video width, must be even numbers.
|
|
vwidth 768;
|
|
# video height, must be even numbers.
|
|
vheight 320;
|
|
# 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 {
|
|
# 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;
|
|
}
|
|
# audio encoder name. can be:
|
|
# libaacplus: use aac(libaacplus) audio encoder.
|
|
# copy: donot encoder the audio stream, copy it.
|
|
# an: disable audio output.
|
|
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 {
|
|
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
|
|
profile:a aac_low;
|
|
}
|
|
# output stream. variables:
|
|
# [vhost] the input stream vhost.
|
|
# [port] the intput stream port.
|
|
# [app] the input stream app.
|
|
# [stream] the input stream name.
|
|
# [engine] the tanscode engine name.
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
engine ffhd {
|
|
enabled on;
|
|
vcodec libx264;
|
|
vbitrate 1200;
|
|
vfps 25;
|
|
vwidth 1382;
|
|
vheight 576;
|
|
vthreads 6;
|
|
vprofile main;
|
|
vpreset medium;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 70;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
engine ffsd {
|
|
enabled on;
|
|
vcodec libx264;
|
|
vbitrate 800;
|
|
vfps 25;
|
|
vwidth 1152;
|
|
vheight 480;
|
|
vthreads 4;
|
|
vprofile main;
|
|
vpreset fast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 60;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
engine fffast {
|
|
enabled on;
|
|
vcodec libx264;
|
|
vbitrate 300;
|
|
vfps 20;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
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;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
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];
|
|
}
|
|
}
|
|
}
|
|
# transcode all stream using the empty ffmpeg demo, donothing.
|
|
vhost ffempty.transcode.srs.com {
|
|
transcode {
|
|
enabled on;
|
|
ffmpeg ./objs/research/ffempty;
|
|
engine empty {
|
|
enabled on;
|
|
vcodec libx264;
|
|
vbitrate 300;
|
|
vfps 20;
|
|
vwidth 768;
|
|
vheight 320;
|
|
vthreads 2;
|
|
vprofile baseline;
|
|
vpreset superfast;
|
|
vparams {
|
|
}
|
|
acodec libaacplus;
|
|
abitrate 45;
|
|
asample_rate 44100;
|
|
achannels 2;
|
|
aparams {
|
|
}
|
|
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
|
}
|
|
}
|
|
}
|
|
# transcode all app and stream of app
|
|
vhost app.transcode.srs.com {
|
|
# the streaming transcode configs.
|
|
# if app specified, transcode all streams of app.
|
|
transcode live {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine {
|
|
enabled off;
|
|
}
|
|
}
|
|
}
|
|
# transcode specified stream.
|
|
vhost stream.transcode.srs.com {
|
|
# the streaming transcode configs.
|
|
# if stream specified, transcode the matched stream.
|
|
transcode live/livestream {
|
|
enabled on;
|
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
|
engine {
|
|
enabled off;
|
|
}
|
|
}
|
|
}
|
|
|
|
# the vhost which forward publish streams.
|
|
vhost same.vhost.forward.srs.com {
|
|
# 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}
|
|
# or specify the vhost by params, @see: change.vhost.forward.srs.com
|
|
# if vhost not specified, use the request vhost instead.
|
|
forward 127.0.0.1:1936 127.0.0.1:1937;
|
|
}
|
|
# TODO: FIXME: support extra params.
|
|
# [plan] the vhost which forward publish streams to other vhosts.
|
|
vhost change.vhost.forward.srs.com {
|
|
forward 127.0.0.1:1936 127.0.0.1:1937 {
|
|
# specify the vhost to override the vhost in client request.
|
|
vhost forward2.srs.com;
|
|
# specify the refer(pageUrl) to override the refer in client request.
|
|
refer http://srs/index.html;
|
|
}
|
|
forward 127.0.0.1:1938 {
|
|
vhost forward3.srs.com;
|
|
}
|
|
}
|
|
|
|
# the vhost disabled.
|
|
vhost removed.srs.com {
|
|
# whether the vhost is enabled.
|
|
# if off, all request access denied.
|
|
# default: on
|
|
enabled off;
|
|
}
|
|
|
|
# the vhost with hls specified.
|
|
vhost with-hls.srs.com {
|
|
hls {
|
|
# whether the hls is enabled.
|
|
# if off, donot write hls(ts and m3u8) when publish.
|
|
# default: off
|
|
enabled on;
|
|
# 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 ./objs/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;
|
|
}
|
|
}
|
|
# the vhost with hls disabled.
|
|
vhost no-hls.srs.com {
|
|
hls {
|
|
# whether the hls is enabled.
|
|
# if off, donot write hls(ts and m3u8) when publish.
|
|
# default: off
|
|
enabled off;
|
|
}
|
|
}
|
|
|
|
# the vhost for min delay, donot cache any stream.
|
|
vhost min.delay.com {
|
|
# whether cache the last gop.
|
|
# if on, cache the last gop and dispatch to client,
|
|
# to enabled 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
|
|
gop_cache off;
|
|
# 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;
|
|
}
|
|
|
|
# the vhost for antisuck.
|
|
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;
|
|
}
|
|
|
|
# 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 10000;
|
|
# shared print interval for all play clients, in milliseconds.
|
|
# if not specified, set to 1300.
|
|
play 10000;
|
|
# shared print interval for all forwarders, in milliseconds.
|
|
# if not specified, set to 2000.
|
|
forwarder 10000;
|
|
# shared print interval for all encoders, in milliseconds.
|
|
# if not specified, set to 2000.
|
|
encoder 10000;
|
|
# shared print interval for all ingesters, in milliseconds.
|
|
# if not specified, set to 2000.
|
|
ingester 10000;
|
|
# shared print interval for all hls, in milliseconds.
|
|
# if not specified, set to 2000.
|
|
hls 10000;
|
|
# shared print interval for all edge, in milliseconds.
|
|
# if not specified, set to 2000.
|
|
edge 10000;
|
|
}
|