From 45724bfaec7a7c3bb7ae3a07f37891bfb1b287c8 Mon Sep 17 00:00:00 2001 From: winlin Date: Sat, 3 Jan 2015 14:46:29 +0800 Subject: [PATCH] update conf for transcode. --- trunk/conf/full.conf | 156 +++++++++++++++++----------- trunk/research/api-server/server.py | 2 +- trunk/scripts/git2unix.sh | 2 +- 3 files changed, 99 insertions(+), 61 deletions(-) mode change 100755 => 100644 trunk/conf/full.conf diff --git a/trunk/conf/full.conf b/trunk/conf/full.conf old mode 100755 new mode 100644 index 4efea0123..cf77a2401 --- a/trunk/conf/full.conf +++ b/trunk/conf/full.conf @@ -558,6 +558,102 @@ vhost same.vhost.forward.srs.com { forward 127.0.0.1:1936 127.0.0.1:1937; } +# the main comments for transcode +vhost example.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 example { + # whether the engine is enabled + # default: off. + enabled on; + # input format, 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. + 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 format, 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: + # [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]; + } + } +} # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction vhost mirror.transcode.srs.com { transcode { @@ -588,10 +684,8 @@ vhost mirror.transcode.srs.com { } } } -# # the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1 # remark: we remove the libfreetype which always cause build failed, you must add it manual if needed. -# ####################################################################################################### # the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop vhost crop.transcode.srs.com { @@ -708,97 +802,41 @@ vhost copy.transcode.srs.com { } } # transcode all app and stream of vhost +# the comments, read example.transcode.srs.com 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; - # input format, 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. 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 format, 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: - # [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 { diff --git a/trunk/research/api-server/server.py b/trunk/research/api-server/server.py index 8f0f51e61..028ab9e5b 100755 --- a/trunk/research/api-server/server.py +++ b/trunk/research/api-server/server.py @@ -154,7 +154,7 @@ class RESTClients(object): return code ''' -handle the streams requests: publish/unpublish stream. +handle the streams requests: publish/unpublish/dvr stream. ''' class RESTStreams(object): exposed = True diff --git a/trunk/scripts/git2unix.sh b/trunk/scripts/git2unix.sh index 4f78ada6f..9aeddfb00 100755 --- a/trunk/scripts/git2unix.sh +++ b/trunk/scripts/git2unix.sh @@ -15,7 +15,7 @@ ret=$?; if [[ 0 -ne $ret ]]; then exit $ret fi -files=`git status|egrep "(modified|new file)"|awk -F ':' '{print $2}'|awk '{print $1}'|egrep "(.hpp$|.cpp$|.cc$|.h$|.c$|.txt$|.sh$)"`; +files=`git status|egrep "(modified|new file)"|awk -F ':' '{print $2}'|awk '{print $1}'|egrep "(.hpp$|.cpp$|.cc$|.h$|.c$|.txt$|.sh|.conf$)"`; for file in $files; do dos2unix $file; echo $file|grep ".sh$" >/dev/null 2>&1; EOF_SH=$?