mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add transcoding params to config
This commit is contained in:
parent
57064237d0
commit
a086e2bbfa
3 changed files with 132 additions and 2 deletions
|
@ -15,7 +15,129 @@ vhost __defaultVhost__ {
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
forward 127.0.0.1:1936;
|
#forward 127.0.0.1:1936;
|
||||||
|
transcode {
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
engine fd{
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 22050;
|
||||||
|
achannels 2;
|
||||||
|
aparams {}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_fast;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# transcode all app and stream of vhost
|
||||||
|
vhost all.transcode.vhost.com {
|
||||||
|
transcode {
|
||||||
|
# the ffmpeg
|
||||||
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
# all matched stream will transcoded to the following stream.
|
||||||
|
# the transcode set name(ie. hd) is optional and not used.
|
||||||
|
engine super{
|
||||||
|
# video encoder name
|
||||||
|
vcodec libx264;
|
||||||
|
# video bitrate, in kbps
|
||||||
|
vbitrate 1500;
|
||||||
|
# video framerate.
|
||||||
|
vfps 25;
|
||||||
|
# video width, must be even numbers.
|
||||||
|
vwidth 1280;
|
||||||
|
# video height, must be even numbers.
|
||||||
|
vheight 720;
|
||||||
|
# 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 {
|
||||||
|
}
|
||||||
|
# audio encoder name
|
||||||
|
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 {
|
||||||
|
}
|
||||||
|
# output stream. variables:
|
||||||
|
# [vhost] the input stream vhost.
|
||||||
|
# [port] the intput stream port.
|
||||||
|
# [app] the input stream app.
|
||||||
|
# [stream] the input stream name.
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_super;
|
||||||
|
}
|
||||||
|
engine hd{
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 1200;
|
||||||
|
vfps 25;
|
||||||
|
vwidth 1024;
|
||||||
|
vheight 576;
|
||||||
|
vthreads 6;
|
||||||
|
vprofile main;
|
||||||
|
vpreset medium;
|
||||||
|
vparams {}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 70;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_hd;
|
||||||
|
}
|
||||||
|
engine sd{
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 800;
|
||||||
|
vfps 25;
|
||||||
|
vwidth 720;
|
||||||
|
vheight 480;
|
||||||
|
vthreads 4;
|
||||||
|
vprofile main;
|
||||||
|
vpreset fast;
|
||||||
|
vparams {}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 60;
|
||||||
|
asample_rate 44100;
|
||||||
|
achannels 2;
|
||||||
|
aparams {}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_sd;
|
||||||
|
}
|
||||||
|
engine fast{
|
||||||
|
vcodec libx264;
|
||||||
|
vbitrate 300;
|
||||||
|
vfps 20;
|
||||||
|
vwidth 480;
|
||||||
|
vheight 320;
|
||||||
|
vthreads 2;
|
||||||
|
vprofile baseline;
|
||||||
|
vpreset superfast;
|
||||||
|
vparams {}
|
||||||
|
acodec libaacplus;
|
||||||
|
abitrate 30;
|
||||||
|
asample_rate 22050;
|
||||||
|
achannels 2;
|
||||||
|
aparams {}
|
||||||
|
output rtmp://[vhost]:[port]/[app]/[stream]_fast;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
# the vhost which forward publish streams.
|
# the vhost which forward publish streams.
|
||||||
vhost forward.vhost.com {
|
vhost forward.vhost.com {
|
||||||
|
@ -109,3 +231,4 @@ pithy_print {
|
||||||
forwarder 3000;
|
forwarder 3000;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@ bool is_common_space(char ch)
|
||||||
return (ch == ' ' || ch == '\t' || ch == CR || ch == LF);
|
return (ch == ' ' || ch == '\t' || ch == CR || ch == LF);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CONF_BUFFER_SIZE 4096
|
#define CONF_BUFFER_SIZE 1024 * 1024
|
||||||
|
|
||||||
SrsFileBuffer::SrsFileBuffer()
|
SrsFileBuffer::SrsFileBuffer()
|
||||||
{
|
{
|
||||||
|
@ -369,6 +369,12 @@ int SrsConfDirective::refill_buffer(SrsFileBuffer* buffer, bool d_quoted, bool s
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = FILE_SIZE(buffer->fd) - FILE_OFFSET(buffer->fd);
|
int size = FILE_SIZE(buffer->fd) - FILE_OFFSET(buffer->fd);
|
||||||
|
if (size > CONF_BUFFER_SIZE) {
|
||||||
|
ret = ERROR_SYSTEM_CONFIG_TOO_LARGE;
|
||||||
|
srs_error("config file too large, max=%d, actual=%d, ret=%d",
|
||||||
|
CONF_BUFFER_SIZE, size, ret);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
if (size <= 0) {
|
if (size <= 0) {
|
||||||
return ERROR_SYSTEM_CONFIG_EOF;
|
return ERROR_SYSTEM_CONFIG_EOF;
|
||||||
|
|
|
@ -84,6 +84,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
#define ERROR_SYSTEM_CONFIG_EOF 409
|
#define ERROR_SYSTEM_CONFIG_EOF 409
|
||||||
#define ERROR_SYSTEM_STREAM_BUSY 410
|
#define ERROR_SYSTEM_STREAM_BUSY 410
|
||||||
#define ERROR_SYSTEM_IP_INVALID 411
|
#define ERROR_SYSTEM_IP_INVALID 411
|
||||||
|
#define ERROR_SYSTEM_CONFIG_TOO_LARGE 412
|
||||||
|
|
||||||
// see librtmp.
|
// see librtmp.
|
||||||
// failed when open ssl create the dh
|
// failed when open ssl create the dh
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue