winlin

add build ffmpeg script

@@ -15,7 +15,7 @@ step 1: build srs <br/> @@ -15,7 +15,7 @@ step 1: build srs <br/>
15 <pre> 15 <pre>
16 tar xf simple-rtmp-server-*.*.tar.gz 16 tar xf simple-rtmp-server-*.*.tar.gz
17 cd simple-rtmp-server-*.*/trunk 17 cd simple-rtmp-server-*.*/trunk
18 -./configure --with-ssl --with-hls 18 +./configure --with-ssl --with-hls --with-ffmpeg
19 make 19 make
20 </pre> 20 </pre>
21 step 2: start srs <br/> 21 step 2: start srs <br/>
@@ -117,6 +117,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw @@ -117,6 +117,7 @@ usr sys idl wai hiq siq| read writ| recv send| in out | int csw
117 * nginx v1.5.0: 139524 lines <br/> 117 * nginx v1.5.0: 139524 lines <br/>
118 118
119 ### History 119 ### History
  120 +* v0.7, 2013-11-29, support --with/without -ffmpeg.
120 * v0.7, 2013-11-29, add ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2. 121 * v0.7, 2013-11-29, add ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2.
121 * v0.6, 2013-11-29, v0.6 released. 16094 lines. 122 * v0.6, 2013-11-29, v0.6 released. 16094 lines.
122 * v0.6, 2013-11-29, add performance summary, 1800 clients, 900Mbps, CPU 90.2%, 41MB. 123 * v0.6, 2013-11-29, add performance summary, 1800 clients, 900Mbps, CPU 90.2%, 41MB.
@@ -47,20 +47,21 @@ if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build htt @@ -47,20 +47,21 @@ if [[ ! -f ${SRS_OBJS}/http-parser-2.1/libhttp_parser.a ]]; then echo "build htt
47 # nginx for HLS, nginx-1.5.0 47 # nginx for HLS, nginx-1.5.0
48 ##################################################################################### 48 #####################################################################################
49 if [ $SRS_HLS = YES ]; then 49 if [ $SRS_HLS = YES ]; then
50 - if [[ -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]]; then 50 + if [[ -f ${SRS_OBJS}/nginx/sbin/nginx ]]; then
51 echo "nginx-1.5.7 is ok."; 51 echo "nginx-1.5.7 is ok.";
52 else 52 else
53 echo "build nginx-1.5.7"; 53 echo "build nginx-1.5.7";
54 ( 54 (
  55 + pwd_dir=`pwd` &&
55 rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} && 56 rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} &&
56 unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 && 57 unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
57 ./configure --prefix=`pwd`/_release && make && make install && 58 ./configure --prefix=`pwd`/_release && make && make install &&
58 - ln -sf `pwd`/_release ../nginx 59 + ln -sf ${pwd_dir}/nginx-1.5.7/_release nginx
59 ) 60 )
60 fi 61 fi
61 # check status 62 # check status
62 ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi 63 ret=$?; if [[ $ret -ne 0 ]]; then echo "build nginx-1.5.7 failed, ret=$ret"; exit $ret; fi
63 - if [ ! -f ${SRS_OBJS}/nginx-1.5.7/_release/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi 64 + if [ ! -f ${SRS_OBJS}/nginx/sbin/nginx ]; then echo "build nginx-1.5.7 failed."; exit -1; fi
64 65
65 # use current user to config nginx, 66 # use current user to config nginx,
66 # srs will write ts/m3u8 file use current user, 67 # srs will write ts/m3u8 file use current user,
@@ -83,3 +84,30 @@ if [ $SRS_SSL = YES ]; then @@ -83,3 +84,30 @@ if [ $SRS_SSL = YES ]; then
83 else 84 else
84 echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H 85 echo "#undef SRS_SSL" >> $SRS_AUTO_HEADERS_H
85 fi 86 fi
  87 +
  88 +#####################################################################################
  89 +# live transcoding, ffmpeg-2.1, x264-core138, lame-3.99.5, libaacplus-2.0.2.
  90 +#####################################################################################
  91 +if [ $SRS_FFMPEG = YES ]; then
  92 + if [[ -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]]; then
  93 + echo "ffmpeg-2.1 is ok.";
  94 + else
  95 + echo "build ffmpeg-2.1";
  96 + (
  97 + pwd_dir=`pwd` && exit 0;
  98 + rm -rf ${SRS_OBJS}/nginx-1.5.7 && cd ${SRS_OBJS} &&
  99 + unzip -q ../3rdparty/nginx-1.5.7.zip && cd nginx-1.5.7 &&
  100 + ./configure --prefix=`pwd`/_release && make && make install &&
  101 + ln -sf ${pwd_dir}/nginx-1.5.7/_release nginx
  102 + )
  103 + fi
  104 + # check status
  105 + ret=$?; if [[ $ret -ne 0 ]]; then echo "build ffmpeg-2.1 failed, ret=$ret"; exit $ret; fi
  106 + if [ ! -f ${SRS_OBJS}/ffmpeg/bin/ffmpeg ]; then echo "build ffmpeg-2.1 failed."; exit -1; fi
  107 +fi
  108 +
  109 +if [ $SRS_FFMPEG = YES ]; then
  110 + echo "#define SRS_FFMPEG" >> $SRS_AUTO_HEADERS_H
  111 +else
  112 + echo "#undef SRS_FFMPEG" >> $SRS_AUTO_HEADERS_H
  113 +fi
@@ -4,10 +4,12 @@ help=no @@ -4,10 +4,12 @@ help=no
4 4
5 SRS_HLS=RESERVED 5 SRS_HLS=RESERVED
6 SRS_SSL=RESERVED 6 SRS_SSL=RESERVED
  7 +SRS_FFMPEG=RESERVED
7 8
8 # TODO: remove the default to yes. 9 # TODO: remove the default to yes.
9 SRS_HLS=YES 10 SRS_HLS=YES
10 SRS_SSL=YES 11 SRS_SSL=YES
  12 +SRS_FFMPEG=YES
11 13
12 opt= 14 opt=
13 15
@@ -25,9 +27,11 @@ do @@ -25,9 +27,11 @@ do
25 27
26 --with-ssl) SRS_SSL=YES ;; 28 --with-ssl) SRS_SSL=YES ;;
27 --with-hls) SRS_HLS=YES ;; 29 --with-hls) SRS_HLS=YES ;;
  30 + --with-ffmpeg) SRS_FFMPEG=YES ;;
28 31
29 --without-ssl) SRS_SSL=NO ;; 32 --without-ssl) SRS_SSL=NO ;;
30 --without-hls) SRS_HLS=NO ;; 33 --without-hls) SRS_HLS=NO ;;
  34 + --without-ffmpeg) SRS_FFMPEG=NO ;;
31 35
32 *) 36 *)
33 echo "$0: error: invalid option \"$option\"" 37 echo "$0: error: invalid option \"$option\""
@@ -65,6 +69,10 @@ if [ $SRS_HLS = RESERVED ]; then @@ -65,6 +69,10 @@ if [ $SRS_HLS = RESERVED ]; then
65 echo "you must specifies the hls, see: ./configure --help"; 69 echo "you must specifies the hls, see: ./configure --help";
66 __check_ok=NO 70 __check_ok=NO
67 fi 71 fi
  72 +if [ $SRS_FFMPEG = RESERVED ]; then
  73 + echo "you must specifies the ffmpeg, see: ./configure --help";
  74 + __check_ok=NO
  75 +fi
68 if [ $__check_ok = NO ]; then 76 if [ $__check_ok = NO ]; then
69 exit 1; 77 exit 1;
70 fi 78 fi