mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
for #319, allow multiple ingest and transcode.
This commit is contained in:
parent
873aa7bf9f
commit
b1b76a4a80
3 changed files with 113 additions and 26 deletions
|
@ -1119,6 +1119,7 @@ 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.
|
||||
# @remark vhost can contains multiple ingest
|
||||
ingest livestream {
|
||||
# whether enabled ingest features
|
||||
# default: off
|
||||
|
@ -1200,6 +1201,7 @@ vhost transcode.ingest.srs.com {
|
|||
# the main comments for transcode
|
||||
vhost example.transcode.srs.com {
|
||||
# the streaming transcode configs.
|
||||
# @remark vhost can contains multiple transcode
|
||||
transcode {
|
||||
# whether the transcode enabled.
|
||||
# if off, donot transcode.
|
||||
|
@ -1214,13 +1216,14 @@ vhost example.transcode.srs.com {
|
|||
# whether the engine is enabled
|
||||
# default: off.
|
||||
enabled on;
|
||||
# input format, can be:
|
||||
# input format, "ffmpeg -i", can be:
|
||||
# off, do not specifies the format, ffmpeg will guess it.
|
||||
# flv, for flv or RTMP stream.
|
||||
# other format, for example, mp4/aac whatever.
|
||||
# default: flv
|
||||
iformat flv;
|
||||
# ffmpeg filters, follows the main input.
|
||||
# ffmpeg filters, between "-i" and "-vcodec"
|
||||
# follows the main input.
|
||||
vfilter {
|
||||
# the logo input file.
|
||||
i ./doc/ffmpeg-logo.png;
|
||||
|
@ -1228,38 +1231,41 @@ vhost example.transcode.srs.com {
|
|||
# for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
|
||||
filter_complex 'overlay=10:10';
|
||||
}
|
||||
# video encoder name. can be:
|
||||
# video encoder name, "ffmpeg -vcodec"
|
||||
# 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
|
||||
# video bitrate, in kbps, "ffmepg -b:v"
|
||||
# @remark 0 to use source video bitrate.
|
||||
# default: 0
|
||||
vbitrate 1500;
|
||||
# video framerate.
|
||||
# video framerate, "ffmepg -r"
|
||||
# @remark 0 to use source video fps.
|
||||
# default: 0
|
||||
vfps 25;
|
||||
# video width, must be even numbers.
|
||||
# video width, must be even numbers, "ffmepg -s"
|
||||
# @remark 0 to use source video width.
|
||||
# default: 0
|
||||
vwidth 768;
|
||||
# video height, must be even numbers.
|
||||
# video height, must be even numbers, "ffmepg -s"
|
||||
# @remark 0 to use source video height.
|
||||
# default: 0
|
||||
vheight 320;
|
||||
# the max threads for ffmpeg to used.
|
||||
# the max threads for ffmpeg to used, "ffmepg -thread"
|
||||
# default: 1
|
||||
vthreads 12;
|
||||
# x264 profile, @see x264 -help, can be:
|
||||
# x264 profile, "ffmepg -profile:v"
|
||||
# @see x264 -help, can be:
|
||||
# high,main,baseline
|
||||
vprofile main;
|
||||
# x264 preset, @see x264 -help, can be:
|
||||
# x264 preset, "ffmpeg -preset"
|
||||
# @see x264 -help, can be:
|
||||
# ultrafast,superfast,veryfast,faster,fast
|
||||
# medium,slow,slower,veryslow,placebo
|
||||
vpreset medium;
|
||||
# other x264 or ffmpeg video params
|
||||
# other x264 or ffmpeg video params, between "-preset" and "-acodec"
|
||||
vparams {
|
||||
# ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
|
||||
t 100;
|
||||
|
@ -1269,38 +1275,42 @@ vhost example.transcode.srs.com {
|
|||
bf 3;
|
||||
refs 10;
|
||||
}
|
||||
# audio encoder name. can be:
|
||||
# audio encoder name, "ffmpeg -acodec"
|
||||
# can be:
|
||||
# libfdk_aac: use aac(libfdk_aac) audio encoder.
|
||||
# copy: donot encoder the audio stream, copy it.
|
||||
# an: disable audio output.
|
||||
acodec libfdk_aac;
|
||||
# audio bitrate, in kbps. [16, 72] for libfdk_aac.
|
||||
# audio bitrate, in kbps, "ffmpeg -b:a"
|
||||
# [16, 72] for libfdk_aac.
|
||||
# @remark 0 to use source audio bitrate.
|
||||
# default: 0
|
||||
abitrate 70;
|
||||
# audio sample rate. for flv/rtmp, it must be:
|
||||
# audio sample rate, "ffmpeg -ar"
|
||||
# for flv/rtmp, it must be:
|
||||
# 44100,22050,11025,5512
|
||||
# @remark 0 to use source audio sample rate.
|
||||
# default: 0
|
||||
asample_rate 44100;
|
||||
# audio channel, 1 for mono, 2 for stereo.
|
||||
# audio channel, "ffmpeg -ac"
|
||||
# 1 for mono, 2 for stereo.
|
||||
# @remark 0 to use source audio channels.
|
||||
# default: 0
|
||||
achannels 2;
|
||||
# other ffmpeg audio params
|
||||
# other ffmpeg audio params, between "-ac" and "-f"/"-y"
|
||||
aparams {
|
||||
# audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
|
||||
# @remark SRS supported aac profile for HLS is: aac_low, aac_he, aac_he_v2
|
||||
profile:a aac_low;
|
||||
bsf:a aac_adtstoasc;
|
||||
}
|
||||
# output format, can be:
|
||||
# output format, "ffmpeg -f" can be:
|
||||
# off, do not specifies the format, ffmpeg will guess it.
|
||||
# flv, for flv or RTMP stream.
|
||||
# other format, for example, mp4/aac whatever.
|
||||
# default: flv
|
||||
oformat flv;
|
||||
# output stream. variables:
|
||||
# output stream, "ffmpeg -y", variables:
|
||||
# [vhost] the input stream vhost.
|
||||
# [port] the intput stream port.
|
||||
# [app] the input stream app.
|
||||
|
|
|
@ -189,7 +189,72 @@ vhost vhost.srs.com {
|
|||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||
engine {
|
||||
enabled off;
|
||||
output rtmp://127.0.0.1:[port]/live?vhost=[vhost]/livestream;
|
||||
iformat flv;
|
||||
vfilter {
|
||||
s 30;
|
||||
ss 300;
|
||||
}
|
||||
vcodec libx264;
|
||||
vbitrate 1500;
|
||||
vfps 25;
|
||||
vwidth 768;
|
||||
vheight 320;
|
||||
vthreads 12;
|
||||
vprofile main;
|
||||
vpreset medium;
|
||||
vparams {
|
||||
t 100;
|
||||
coder 1;
|
||||
b_strategy 2;
|
||||
bf 3;
|
||||
refs 10;
|
||||
}
|
||||
acodec libfdk_aac;
|
||||
abitrate 70;
|
||||
asample_rate 44100;
|
||||
achannels 2;
|
||||
aparams {
|
||||
profile:a aac_low;
|
||||
}
|
||||
oformat flv;
|
||||
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream];
|
||||
}
|
||||
}
|
||||
|
||||
transcode live {
|
||||
enabled off;
|
||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||
engine ffsuper {
|
||||
enabled off;
|
||||
iformat flv;
|
||||
vfilter {
|
||||
s 30;
|
||||
ss 300;
|
||||
}
|
||||
vcodec libx264;
|
||||
vbitrate 1500;
|
||||
vfps 25;
|
||||
vwidth 768;
|
||||
vheight 320;
|
||||
vthreads 12;
|
||||
vprofile main;
|
||||
vpreset medium;
|
||||
vparams {
|
||||
t 100;
|
||||
coder 1;
|
||||
b_strategy 2;
|
||||
bf 3;
|
||||
refs 10;
|
||||
}
|
||||
acodec libfdk_aac;
|
||||
abitrate 70;
|
||||
asample_rate 44100;
|
||||
achannels 2;
|
||||
aparams {
|
||||
profile:a aac_low;
|
||||
}
|
||||
oformat flv;
|
||||
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -200,8 +265,8 @@ vhost vhost.srs.com {
|
|||
enabled off;
|
||||
iformat flv;
|
||||
vfilter {
|
||||
i ./doc/ffmpeg-logo.png;
|
||||
filter_complex overlay=10:10;
|
||||
s 30;
|
||||
ss 300;
|
||||
}
|
||||
vcodec libx264;
|
||||
vbitrate 1500;
|
||||
|
|
|
@ -2096,14 +2096,26 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
|
|||
}
|
||||
|
||||
// transcode
|
||||
if ((dir = vhost->get("transcode")) != NULL) {
|
||||
SrsAmf0Object* transcode = SrsAmf0Any::object();
|
||||
obj->set("transcode", transcode);
|
||||
SrsAmf0StrictArray* transcodes = NULL;
|
||||
for (int i = 0; i < (int)vhost->directives.size(); i++) {
|
||||
dir = vhost->directives.at(i);
|
||||
if (dir->name != "transcode") {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!transcodes) {
|
||||
transcodes = SrsAmf0Any::strict_array();
|
||||
obj->set("transcodes", transcodes);
|
||||
}
|
||||
|
||||
SrsAmf0Object* transcode = SrsAmf0Any::object();
|
||||
transcodes->append(transcode);
|
||||
|
||||
transcode->set("apply", dir->dumps_arg0_to_str());
|
||||
transcode->set("enabled", SrsAmf0Any::boolean(get_transcode_enabled(dir)));
|
||||
|
||||
SrsAmf0StrictArray* engines = SrsAmf0Any::strict_array();
|
||||
obj->set("engines", engines);
|
||||
transcode->set("engines", engines);
|
||||
|
||||
for (int i = 0; i < (int)dir->directives.size(); i++) {
|
||||
SrsConfDirective* sdir = dir->directives.at(i);
|
||||
|
@ -2151,7 +2163,7 @@ int SrsConfig::dumps_engine(SrsConfDirective* dir, SrsAmf0Object* engine)
|
|||
|
||||
SrsConfDirective* conf = NULL;
|
||||
|
||||
engine->set("name", dir->dumps_arg0_to_str());
|
||||
engine->set("id", dir->dumps_arg0_to_str());
|
||||
engine->set("enabled", SrsAmf0Any::boolean(get_engine_enabled(dir)));
|
||||
|
||||
if ((conf = dir->get("iformat")) != NULL) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue