winlin

update conf for transcode.

@@ -558,6 +558,102 @@ vhost same.vhost.forward.srs.com { @@ -558,6 +558,102 @@ vhost same.vhost.forward.srs.com {
558 forward 127.0.0.1:1936 127.0.0.1:1937; 558 forward 127.0.0.1:1936 127.0.0.1:1937;
559 } 559 }
560 560
  561 +# the main comments for transcode
  562 +vhost example.transcode.srs.com {
  563 + # the streaming transcode configs.
  564 + transcode {
  565 + # whether the transcode enabled.
  566 + # if off, donot transcode.
  567 + # default: off.
  568 + enabled on;
  569 + # the ffmpeg
  570 + ffmpeg ./objs/ffmpeg/bin/ffmpeg;
  571 + # the transcode engine for matched stream.
  572 + # all matched stream will transcoded to the following stream.
  573 + # the transcode set name(ie. hd) is optional and not used.
  574 + engine example {
  575 + # whether the engine is enabled
  576 + # default: off.
  577 + enabled on;
  578 + # input format, can be:
  579 + # off, do not specifies the format, ffmpeg will guess it.
  580 + # flv, for flv or RTMP stream.
  581 + # other format, for example, mp4/aac whatever.
  582 + # default: flv
  583 + iformat flv;
  584 + # ffmpeg filters, follows the main input.
  585 + vfilter {
  586 + # the logo input file.
  587 + i ./doc/ffmpeg-logo.png;
  588 + # the ffmpeg complex filter.
  589 + # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html
  590 + filter_complex 'overlay=10:10';
  591 + }
  592 + # video encoder name. can be:
  593 + # libx264: use h.264(libx264) video encoder.
  594 + # copy: donot encoder the video stream, copy it.
  595 + # vn: disable video output.
  596 + vcodec libx264;
  597 + # video bitrate, in kbps
  598 + vbitrate 1500;
  599 + # video framerate.
  600 + vfps 25;
  601 + # video width, must be even numbers.
  602 + vwidth 768;
  603 + # video height, must be even numbers.
  604 + vheight 320;
  605 + # the max threads for ffmpeg to used.
  606 + vthreads 12;
  607 + # x264 profile, @see x264 -help, can be:
  608 + # high,main,baseline
  609 + vprofile main;
  610 + # x264 preset, @see x264 -help, can be:
  611 + # ultrafast,superfast,veryfast,faster,fast
  612 + # medium,slow,slower,veryslow,placebo
  613 + vpreset medium;
  614 + # other x264 or ffmpeg video params
  615 + vparams {
  616 + # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html
  617 + t 100;
  618 + # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264
  619 + coder 1;
  620 + b_strategy 2;
  621 + bf 3;
  622 + refs 10;
  623 + }
  624 + # audio encoder name. can be:
  625 + # libaacplus: use aac(libaacplus) audio encoder.
  626 + # copy: donot encoder the audio stream, copy it.
  627 + # an: disable audio output.
  628 + acodec libaacplus;
  629 + # audio bitrate, in kbps. [16, 72] for libaacplus.
  630 + abitrate 70;
  631 + # audio sample rate. for flv/rtmp, it must be:
  632 + # 44100,22050,11025,5512
  633 + asample_rate 44100;
  634 + # audio channel, 1 for mono, 2 for stereo.
  635 + achannels 2;
  636 + # other ffmpeg audio params
  637 + aparams {
  638 + # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders
  639 + profile:a aac_low;
  640 + }
  641 + # output format, can be:
  642 + # off, do not specifies the format, ffmpeg will guess it.
  643 + # flv, for flv or RTMP stream.
  644 + # other format, for example, mp4/aac whatever.
  645 + # default: flv
  646 + oformat flv;
  647 + # output stream. variables:
  648 + # [vhost] the input stream vhost.
  649 + # [port] the intput stream port.
  650 + # [app] the input stream app.
  651 + # [stream] the input stream name.
  652 + # [engine] the tanscode engine name.
  653 + output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
  654 + }
  655 + }
  656 +}
561 # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction 657 # the mirror filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#Filtering-Introduction
562 vhost mirror.transcode.srs.com { 658 vhost mirror.transcode.srs.com {
563 transcode { 659 transcode {
@@ -588,10 +684,8 @@ vhost mirror.transcode.srs.com { @@ -588,10 +684,8 @@ vhost mirror.transcode.srs.com {
588 } 684 }
589 } 685 }
590 } 686 }
591 -#  
592 # the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1 687 # the drawtext filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#drawtext-1
593 # remark: we remove the libfreetype which always cause build failed, you must add it manual if needed. 688 # remark: we remove the libfreetype which always cause build failed, you must add it manual if needed.
594 -#  
595 ####################################################################################################### 689 #######################################################################################################
596 # the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop 690 # the crop filter of ffmpeg, @see: http://ffmpeg.org/ffmpeg-filters.html#crop
597 vhost crop.transcode.srs.com { 691 vhost crop.transcode.srs.com {
@@ -708,97 +802,41 @@ vhost copy.transcode.srs.com { @@ -708,97 +802,41 @@ vhost copy.transcode.srs.com {
708 } 802 }
709 } 803 }
710 # transcode all app and stream of vhost 804 # transcode all app and stream of vhost
  805 +# the comments, read example.transcode.srs.com
711 vhost all.transcode.srs.com { 806 vhost all.transcode.srs.com {
712 - # the streaming transcode configs.  
713 transcode { 807 transcode {
714 - # whether the transcode enabled.  
715 - # if off, donot transcode.  
716 - # default: off.  
717 enabled on; 808 enabled on;
718 - # the ffmpeg  
719 ffmpeg ./objs/ffmpeg/bin/ffmpeg; 809 ffmpeg ./objs/ffmpeg/bin/ffmpeg;
720 - # the transcode engine for matched stream.  
721 - # all matched stream will transcoded to the following stream.  
722 - # the transcode set name(ie. hd) is optional and not used.  
723 engine ffsuper { 810 engine ffsuper {
724 - # whether the engine is enabled  
725 - # default: off.  
726 enabled on; 811 enabled on;
727 - # input format, can be:  
728 - # off, do not specifies the format, ffmpeg will guess it.  
729 - # flv, for flv or RTMP stream.  
730 - # other format, for example, mp4/aac whatever.  
731 - # default: flv  
732 iformat flv; 812 iformat flv;
733 - # ffmpeg filters, follows the main input.  
734 vfilter { 813 vfilter {
735 - # the logo input file.  
736 i ./doc/ffmpeg-logo.png; 814 i ./doc/ffmpeg-logo.png;
737 - # the ffmpeg complex filter.  
738 - # for filters, @see: http://ffmpeg.org/ffmpeg-filters.html  
739 filter_complex 'overlay=10:10'; 815 filter_complex 'overlay=10:10';
740 } 816 }
741 - # video encoder name. can be:  
742 - # libx264: use h.264(libx264) video encoder.  
743 - # copy: donot encoder the video stream, copy it.  
744 - # vn: disable video output.  
745 vcodec libx264; 817 vcodec libx264;
746 - # video bitrate, in kbps  
747 vbitrate 1500; 818 vbitrate 1500;
748 - # video framerate.  
749 vfps 25; 819 vfps 25;
750 - # video width, must be even numbers.  
751 vwidth 768; 820 vwidth 768;
752 - # video height, must be even numbers.  
753 vheight 320; 821 vheight 320;
754 - # the max threads for ffmpeg to used.  
755 vthreads 12; 822 vthreads 12;
756 - # x264 profile, @see x264 -help, can be:  
757 - # high,main,baseline  
758 vprofile main; 823 vprofile main;
759 - # x264 preset, @see x264 -help, can be:  
760 - # ultrafast,superfast,veryfast,faster,fast  
761 - # medium,slow,slower,veryslow,placebo  
762 vpreset medium; 824 vpreset medium;
763 - # other x264 or ffmpeg video params  
764 vparams { 825 vparams {
765 - # ffmpeg options, @see: http://ffmpeg.org/ffmpeg.html  
766 t 100; 826 t 100;
767 - # 264 params, @see: http://ffmpeg.org/ffmpeg-codecs.html#libx264  
768 coder 1; 827 coder 1;
769 b_strategy 2; 828 b_strategy 2;
770 bf 3; 829 bf 3;
771 refs 10; 830 refs 10;
772 } 831 }
773 - # audio encoder name. can be:  
774 - # libaacplus: use aac(libaacplus) audio encoder.  
775 - # copy: donot encoder the audio stream, copy it.  
776 - # an: disable audio output.  
777 acodec libaacplus; 832 acodec libaacplus;
778 - # audio bitrate, in kbps. [16, 72] for libaacplus.  
779 abitrate 70; 833 abitrate 70;
780 - # audio sample rate. for flv/rtmp, it must be:  
781 - # 44100,22050,11025,5512  
782 asample_rate 44100; 834 asample_rate 44100;
783 - # audio channel, 1 for mono, 2 for stereo.  
784 achannels 2; 835 achannels 2;
785 - # other ffmpeg audio params  
786 aparams { 836 aparams {
787 - # audio params, @see: http://ffmpeg.org/ffmpeg-codecs.html#Audio-Encoders  
788 profile:a aac_low; 837 profile:a aac_low;
789 } 838 }
790 - # output format, can be:  
791 - # off, do not specifies the format, ffmpeg will guess it.  
792 - # flv, for flv or RTMP stream.  
793 - # other format, for example, mp4/aac whatever.  
794 - # default: flv  
795 oformat flv; 839 oformat flv;
796 - # output stream. variables:  
797 - # [vhost] the input stream vhost.  
798 - # [port] the intput stream port.  
799 - # [app] the input stream app.  
800 - # [stream] the input stream name.  
801 - # [engine] the tanscode engine name.  
802 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine]; 840 output rtmp://127.0.0.1:[port]/[app]?vhost=[vhost]/[stream]_[engine];
803 } 841 }
804 engine ffhd { 842 engine ffhd {
@@ -154,7 +154,7 @@ class RESTClients(object): @@ -154,7 +154,7 @@ class RESTClients(object):
154 return code 154 return code
155 155
156 ''' 156 '''
157 -handle the streams requests: publish/unpublish stream. 157 +handle the streams requests: publish/unpublish/dvr stream.
158 ''' 158 '''
159 class RESTStreams(object): 159 class RESTStreams(object):
160 exposed = True 160 exposed = True
@@ -15,7 +15,7 @@ ret=$?; if [[ 0 -ne $ret ]]; then @@ -15,7 +15,7 @@ ret=$?; if [[ 0 -ne $ret ]]; then
15 exit $ret 15 exit $ret
16 fi 16 fi
17 17
18 -files=`git status|egrep "(modified|new file)"|awk -F ':' '{print $2}'|awk '{print $1}'|egrep "(.hpp$|.cpp$|.cc$|.h$|.c$|.txt$|.sh$)"`; 18 +files=`git status|egrep "(modified|new file)"|awk -F ':' '{print $2}'|awk '{print $1}'|egrep "(.hpp$|.cpp$|.cc$|.h$|.c$|.txt$|.sh|.conf$)"`;
19 for file in $files; do 19 for file in $files; do
20 dos2unix $file; 20 dos2unix $file;
21 echo $file|grep ".sh$" >/dev/null 2>&1; EOF_SH=$? 21 echo $file|grep ".sh$" >/dev/null 2>&1; EOF_SH=$?