編譯時開啟ffmpeg功能:
[[email protected] trunk]# ./configure --disable-all --with-ssl --with-hls --with-nginx --with-ffmpeg --with-transcode --with-dvr --with-ingest && make
轉碼可以添加很多功能,比如添加水印(文字、圖檔、logo),但是需要注意的是如果是高分辨率轉碼,可能占用的cpu較高,如400%甚至1000%
而srs1.0與srs2.0之間的差別,我發現的僅有fdk-aac代替aacplus。
srs1.0:
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ff {
enabled on;
vfilter {
i ./doc/qyt-logo.png;
filter_complex 'overlay=10:10';
}
vcodec libx264;
vbitrate 512;
vfps 15;
vwidth 1280;
vheight 720;
vthreads 16;
vprofile main;
vpreset medium;
vparams {
#t 100;
#coder 1;
#b_strategy 2;
#bf 3;
#refs 10;
}
acodec libaacplus;
abitrate 70;
asample_rate 44100;
achannels 2;
aparams {
#profile:a aac_low;
}
#output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
output rtmp://127.0.0.1/live/[stream];
}
}
srs2.0:
transcode {
enabled on;
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
engine ff {
enabled off;
iformat flv;
vfilter {
i ./doc/ffmpeg-logo.png;
filter_complex 'overlay=10:10';
}
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;
bsf:a aac_adtstoasc;
}
oformat flv;
output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream];
}
}