winlin

add forward sample

@@ -22,11 +22,15 @@ step 2: start srs <br/> @@ -22,11 +22,15 @@ step 2: start srs <br/>
22 <pre> 22 <pre>
23 ./objs/simple_rtmp_server -c conf/srs.conf 23 ./objs/simple_rtmp_server -c conf/srs.conf
24 </pre> 24 </pre>
25 -step 3(optional): start nginx for HLS <br/> 25 +step 3(optinal): start srs listen at 19350 for forward<br/>
  26 +<pre>
  27 +./objs/simple_rtmp_server -c conf/srs.19350.conf
  28 +</pre>
  29 +step 4(optional): start nginx for HLS <br/>
26 <pre> 30 <pre>
27 sudo ./objs/nginx/sbin/nginx 31 sudo ./objs/nginx/sbin/nginx
28 </pre> 32 </pre>
29 -step 4: publish live stream <br/> 33 +step 5: publish live stream <br/>
30 <pre> 34 <pre>
31 FMS URL: rtmp://127.0.0.1:1935/live 35 FMS URL: rtmp://127.0.0.1:1935/live
32 Stream: livestream 36 Stream: livestream
@@ -37,18 +41,25 @@ For example, use ffmpeg to publish: @@ -37,18 +41,25 @@ For example, use ffmpeg to publish:
37 sleep 1; \ 41 sleep 1; \
38 done 42 done
39 </pre> 43 </pre>
40 -step 5: play live stream <br/> 44 +step 6: play live stream <br/>
41 <pre> 45 <pre>
42 rtmp url: rtmp://127.0.0.1:1935/live/livestream 46 rtmp url: rtmp://127.0.0.1:1935/live/livestream
43 m3u8 url: http://127.0.0.1:80/live/livestream.m3u8 47 m3u8 url: http://127.0.0.1:80/live/livestream.m3u8
44 </pre> 48 </pre>
45 -step 6: play live stream auto transcoded<br/> 49 +step 7: play live stream auto transcoded<br/>
46 <pre> 50 <pre>
47 rtmp url: rtmp://127.0.0.1:1935/live/livestream_ld 51 rtmp url: rtmp://127.0.0.1:1935/live/livestream_ld
48 m3u8 url: http://127.0.0.1:80/live/livestream_ld.m3u8 52 m3u8 url: http://127.0.0.1:80/live/livestream_ld.m3u8
49 rtmp url: rtmp://127.0.0.1:1935/live/livestream_sd 53 rtmp url: rtmp://127.0.0.1:1935/live/livestream_sd
50 m3u8 url: http://127.0.0.1:80/live/livestream_sd.m3u8 54 m3u8 url: http://127.0.0.1:80/live/livestream_sd.m3u8
51 </pre> 55 </pre>
  56 +step 8: play live stream auto forwarded, the hls dir change to /forward<br/>
  57 +<pre>
  58 +rtmp url: rtmp://127.0.0.1:19350/live/livestream_ld
  59 +m3u8 url: http://127.0.0.1:80/forward/live/livestream_ld.m3u8
  60 +rtmp url: rtmp://127.0.0.1:19350/live/livestream_sd
  61 +m3u8 url: http://127.0.0.1:80/forward/live/livestream_sd.m3u8
  62 +</pre>
52 63
53 ### System Requirements 64 ### System Requirements
54 Supported operating systems and hardware: 65 Supported operating systems and hardware:
@@ -67,6 +67,9 @@ if [ $SRS_HLS = YES ]; then @@ -67,6 +67,9 @@ if [ $SRS_HLS = YES ]; then
67 # nginx default use nobody, so cannot read the ts/m3u8 created by srs. 67 # nginx default use nobody, so cannot read the ts/m3u8 created by srs.
68 cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk 68 cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
69 sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf 69 sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
  70 +
  71 + # create forward dir
  72 + mkdir -p ${SRS_OBJS}/nginx/html/forward
70 fi 73 fi
71 74
72 if [ $SRS_HLS = YES ]; then 75 if [ $SRS_HLS = YES ]; then
  1 +listen 19350;
  2 +chunk_size 65000;
  3 +vhost __defaultVhost__ {
  4 + enabled on;
  5 + gop_cache on;
  6 + hls on;
  7 + hls_path ./objs/nginx/html/forward;
  8 + hls_fragment 5;
  9 + hls_window 30;
  10 +}
  11 +
@@ -15,7 +15,7 @@ vhost __defaultVhost__ { @@ -15,7 +15,7 @@ vhost __defaultVhost__ {
15 hls_path ./objs/nginx/html; 15 hls_path ./objs/nginx/html;
16 hls_fragment 5; 16 hls_fragment 5;
17 hls_window 30; 17 hls_window 30;
18 - #forward 127.0.0.1:1936; 18 + forward 127.0.0.1:19350;
19 transcode { 19 transcode {
20 enabled on; 20 enabled on;
21 ffmpeg ./objs/ffmpeg/bin/ffmpeg; 21 ffmpeg ./objs/ffmpeg/bin/ffmpeg;
@@ -28,8 +28,8 @@ vhost __defaultVhost__ { @@ -28,8 +28,8 @@ vhost __defaultVhost__ {
28 vcodec libx264; 28 vcodec libx264;
29 vbitrate 300; 29 vbitrate 300;
30 vfps 20; 30 vfps 20;
31 - vwidth 768;  
32 - vheight 320; 31 + vwidth 1152;
  32 + vheight 480;
33 vthreads 1; 33 vthreads 1;
34 vprofile baseline; 34 vprofile baseline;
35 vpreset superfast; 35 vpreset superfast;
@@ -51,8 +51,8 @@ vhost __defaultVhost__ { @@ -51,8 +51,8 @@ vhost __defaultVhost__ {
51 vcodec libx264; 51 vcodec libx264;
52 vbitrate 500; 52 vbitrate 500;
53 vfps 20; 53 vfps 20;
54 - vwidth 768;  
55 - vheight 320; 54 + vwidth 1152;
  55 + vheight 480;
56 vthreads 1; 56 vthreads 1;
57 vprofile main; 57 vprofile main;
58 vpreset fast; 58 vpreset fast;
@@ -81,8 +81,8 @@ vhost mirror.transcode.vhost.com { @@ -81,8 +81,8 @@ vhost mirror.transcode.vhost.com {
81 vcodec libx264; 81 vcodec libx264;
82 vbitrate 300; 82 vbitrate 300;
83 vfps 20; 83 vfps 20;
84 - vwidth 480;  
85 - vheight 320; 84 + vwidth 1152;
  85 + vheight 480;
86 vthreads 2; 86 vthreads 2;
87 vprofile baseline; 87 vprofile baseline;
88 vpreset superfast; 88 vpreset superfast;
@@ -111,8 +111,8 @@ vhost drawtext.transcode.vhost.com { @@ -111,8 +111,8 @@ vhost drawtext.transcode.vhost.com {
111 vcodec libx264; 111 vcodec libx264;
112 vbitrate 300; 112 vbitrate 300;
113 vfps 20; 113 vfps 20;
114 - vwidth 480;  
115 - vheight 320; 114 + vwidth 1152;
  115 + vheight 480;
116 vthreads 2; 116 vthreads 2;
117 vprofile baseline; 117 vprofile baseline;
118 vpreset superfast; 118 vpreset superfast;
@@ -141,8 +141,8 @@ vhost crop.transcode.vhost.com { @@ -141,8 +141,8 @@ vhost crop.transcode.vhost.com {
141 vcodec libx264; 141 vcodec libx264;
142 vbitrate 300; 142 vbitrate 300;
143 vfps 20; 143 vfps 20;
144 - vwidth 480;  
145 - vheight 320; 144 + vwidth 1152;
  145 + vheight 480;
146 vthreads 2; 146 vthreads 2;
147 vprofile baseline; 147 vprofile baseline;
148 vpreset superfast; 148 vpreset superfast;
@@ -171,8 +171,8 @@ vhost logo.transcode.vhost.com { @@ -171,8 +171,8 @@ vhost logo.transcode.vhost.com {
171 vcodec libx264; 171 vcodec libx264;
172 vbitrate 300; 172 vbitrate 300;
173 vfps 20; 173 vfps 20;
174 - vwidth 480;  
175 - vheight 320; 174 + vwidth 1152;
  175 + vheight 480;
176 vthreads 2; 176 vthreads 2;
177 vprofile baseline; 177 vprofile baseline;
178 vpreset superfast; 178 vpreset superfast;
@@ -220,7 +220,7 @@ vhost all.transcode.vhost.com { @@ -220,7 +220,7 @@ vhost all.transcode.vhost.com {
220 # video framerate. 220 # video framerate.
221 vfps 25; 221 vfps 25;
222 # video width, must be even numbers. 222 # video width, must be even numbers.
223 - vwidth 1280; 223 + vwidth 1728;
224 # video height, must be even numbers. 224 # video height, must be even numbers.
225 vheight 720; 225 vheight 720;
226 # the max threads for ffmpeg to used. 226 # the max threads for ffmpeg to used.
@@ -268,7 +268,7 @@ vhost all.transcode.vhost.com { @@ -268,7 +268,7 @@ vhost all.transcode.vhost.com {
268 vcodec libx264; 268 vcodec libx264;
269 vbitrate 1200; 269 vbitrate 1200;
270 vfps 25; 270 vfps 25;
271 - vwidth 1024; 271 + vwidth 1382;
272 vheight 576; 272 vheight 576;
273 vthreads 6; 273 vthreads 6;
274 vprofile main; 274 vprofile main;
@@ -288,7 +288,7 @@ vhost all.transcode.vhost.com { @@ -288,7 +288,7 @@ vhost all.transcode.vhost.com {
288 vcodec libx264; 288 vcodec libx264;
289 vbitrate 800; 289 vbitrate 800;
290 vfps 25; 290 vfps 25;
291 - vwidth 720; 291 + vwidth 1152;
292 vheight 480; 292 vheight 480;
293 vthreads 4; 293 vthreads 4;
294 vprofile main; 294 vprofile main;
@@ -308,7 +308,7 @@ vhost all.transcode.vhost.com { @@ -308,7 +308,7 @@ vhost all.transcode.vhost.com {
308 vcodec libx264; 308 vcodec libx264;
309 vbitrate 300; 309 vbitrate 300;
310 vfps 20; 310 vfps 20;
311 - vwidth 480; 311 + vwidth 768;
312 vheight 320; 312 vheight 320;
313 vthreads 2; 313 vthreads 2;
314 vprofile baseline; 314 vprofile baseline;
@@ -335,7 +335,7 @@ vhost ffempty.transcode.vhost.com { @@ -335,7 +335,7 @@ vhost ffempty.transcode.vhost.com {
335 vcodec libx264; 335 vcodec libx264;
336 vbitrate 300; 336 vbitrate 300;
337 vfps 20; 337 vfps 20;
338 - vwidth 480; 338 + vwidth 768;
339 vheight 320; 339 vheight 320;
340 vthreads 2; 340 vthreads 2;
341 vprofile baseline; 341 vprofile baseline;
This file is too large to display.