mirror of
https://github.com/ossrs/srs.git
synced 2025-03-09 15:49:59 +00:00
add forward sample
This commit is contained in:
parent
5cc1ad6da8
commit
5502344e85
5 changed files with 47 additions and 22 deletions
19
README.md
19
README.md
|
@ -22,11 +22,15 @@ step 2: start srs <br/>
|
||||||
<pre>
|
<pre>
|
||||||
./objs/simple_rtmp_server -c conf/srs.conf
|
./objs/simple_rtmp_server -c conf/srs.conf
|
||||||
</pre>
|
</pre>
|
||||||
step 3(optional): start nginx for HLS <br/>
|
step 3(optinal): start srs listen at 19350 for forward<br/>
|
||||||
|
<pre>
|
||||||
|
./objs/simple_rtmp_server -c conf/srs.19350.conf
|
||||||
|
</pre>
|
||||||
|
step 4(optional): start nginx for HLS <br/>
|
||||||
<pre>
|
<pre>
|
||||||
sudo ./objs/nginx/sbin/nginx
|
sudo ./objs/nginx/sbin/nginx
|
||||||
</pre>
|
</pre>
|
||||||
step 4: publish live stream <br/>
|
step 5: publish live stream <br/>
|
||||||
<pre>
|
<pre>
|
||||||
FMS URL: rtmp://127.0.0.1:1935/live
|
FMS URL: rtmp://127.0.0.1:1935/live
|
||||||
Stream: livestream
|
Stream: livestream
|
||||||
|
@ -37,18 +41,25 @@ For example, use ffmpeg to publish:
|
||||||
sleep 1; \
|
sleep 1; \
|
||||||
done
|
done
|
||||||
</pre>
|
</pre>
|
||||||
step 5: play live stream <br/>
|
step 6: play live stream <br/>
|
||||||
<pre>
|
<pre>
|
||||||
rtmp url: rtmp://127.0.0.1:1935/live/livestream
|
rtmp url: rtmp://127.0.0.1:1935/live/livestream
|
||||||
m3u8 url: http://127.0.0.1:80/live/livestream.m3u8
|
m3u8 url: http://127.0.0.1:80/live/livestream.m3u8
|
||||||
</pre>
|
</pre>
|
||||||
step 6: play live stream auto transcoded<br/>
|
step 7: play live stream auto transcoded<br/>
|
||||||
<pre>
|
<pre>
|
||||||
rtmp url: rtmp://127.0.0.1:1935/live/livestream_ld
|
rtmp url: rtmp://127.0.0.1:1935/live/livestream_ld
|
||||||
m3u8 url: http://127.0.0.1:80/live/livestream_ld.m3u8
|
m3u8 url: http://127.0.0.1:80/live/livestream_ld.m3u8
|
||||||
rtmp url: rtmp://127.0.0.1:1935/live/livestream_sd
|
rtmp url: rtmp://127.0.0.1:1935/live/livestream_sd
|
||||||
m3u8 url: http://127.0.0.1:80/live/livestream_sd.m3u8
|
m3u8 url: http://127.0.0.1:80/live/livestream_sd.m3u8
|
||||||
</pre>
|
</pre>
|
||||||
|
step 8: play live stream auto forwarded, the hls dir change to /forward<br/>
|
||||||
|
<pre>
|
||||||
|
rtmp url: rtmp://127.0.0.1:19350/live/livestream_ld
|
||||||
|
m3u8 url: http://127.0.0.1:80/forward/live/livestream_ld.m3u8
|
||||||
|
rtmp url: rtmp://127.0.0.1:19350/live/livestream_sd
|
||||||
|
m3u8 url: http://127.0.0.1:80/forward/live/livestream_sd.m3u8
|
||||||
|
</pre>
|
||||||
|
|
||||||
### System Requirements
|
### System Requirements
|
||||||
Supported operating systems and hardware:
|
Supported operating systems and hardware:
|
||||||
|
|
|
@ -67,6 +67,9 @@ if [ $SRS_HLS = YES ]; then
|
||||||
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
|
# nginx default use nobody, so cannot read the ts/m3u8 created by srs.
|
||||||
cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
|
cp ${SRS_OBJS}/nginx/conf/nginx.conf ${SRS_OBJS}/nginx/conf/nginx.conf.bk
|
||||||
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
|
sed -i "s/^.user nobody;/user `whoami`;/g" ${SRS_OBJS}/nginx/conf/nginx.conf
|
||||||
|
|
||||||
|
# create forward dir
|
||||||
|
mkdir -p ${SRS_OBJS}/nginx/html/forward
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $SRS_HLS = YES ]; then
|
if [ $SRS_HLS = YES ]; then
|
||||||
|
|
11
trunk/conf/srs.19350.conf
Executable file
11
trunk/conf/srs.19350.conf
Executable file
|
@ -0,0 +1,11 @@
|
||||||
|
listen 19350;
|
||||||
|
chunk_size 65000;
|
||||||
|
vhost __defaultVhost__ {
|
||||||
|
enabled on;
|
||||||
|
gop_cache on;
|
||||||
|
hls on;
|
||||||
|
hls_path ./objs/nginx/html/forward;
|
||||||
|
hls_fragment 5;
|
||||||
|
hls_window 30;
|
||||||
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ vhost __defaultVhost__ {
|
||||||
hls_path ./objs/nginx/html;
|
hls_path ./objs/nginx/html;
|
||||||
hls_fragment 5;
|
hls_fragment 5;
|
||||||
hls_window 30;
|
hls_window 30;
|
||||||
#forward 127.0.0.1:1936;
|
forward 127.0.0.1:19350;
|
||||||
transcode {
|
transcode {
|
||||||
enabled on;
|
enabled on;
|
||||||
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
ffmpeg ./objs/ffmpeg/bin/ffmpeg;
|
||||||
|
@ -28,8 +28,8 @@ vhost __defaultVhost__ {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 768;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 1;
|
vthreads 1;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
vpreset superfast;
|
vpreset superfast;
|
||||||
|
@ -51,8 +51,8 @@ vhost __defaultVhost__ {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 500;
|
vbitrate 500;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 768;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 1;
|
vthreads 1;
|
||||||
vprofile main;
|
vprofile main;
|
||||||
vpreset fast;
|
vpreset fast;
|
||||||
|
@ -81,8 +81,8 @@ vhost mirror.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
vpreset superfast;
|
vpreset superfast;
|
||||||
|
@ -111,8 +111,8 @@ vhost drawtext.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
vpreset superfast;
|
vpreset superfast;
|
||||||
|
@ -141,8 +141,8 @@ vhost crop.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
vpreset superfast;
|
vpreset superfast;
|
||||||
|
@ -171,8 +171,8 @@ vhost logo.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 1152;
|
||||||
vheight 320;
|
vheight 480;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
vpreset superfast;
|
vpreset superfast;
|
||||||
|
@ -220,7 +220,7 @@ vhost all.transcode.vhost.com {
|
||||||
# video framerate.
|
# video framerate.
|
||||||
vfps 25;
|
vfps 25;
|
||||||
# video width, must be even numbers.
|
# video width, must be even numbers.
|
||||||
vwidth 1280;
|
vwidth 1728;
|
||||||
# video height, must be even numbers.
|
# video height, must be even numbers.
|
||||||
vheight 720;
|
vheight 720;
|
||||||
# the max threads for ffmpeg to used.
|
# the max threads for ffmpeg to used.
|
||||||
|
@ -268,7 +268,7 @@ vhost all.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 1200;
|
vbitrate 1200;
|
||||||
vfps 25;
|
vfps 25;
|
||||||
vwidth 1024;
|
vwidth 1382;
|
||||||
vheight 576;
|
vheight 576;
|
||||||
vthreads 6;
|
vthreads 6;
|
||||||
vprofile main;
|
vprofile main;
|
||||||
|
@ -288,7 +288,7 @@ vhost all.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 800;
|
vbitrate 800;
|
||||||
vfps 25;
|
vfps 25;
|
||||||
vwidth 720;
|
vwidth 1152;
|
||||||
vheight 480;
|
vheight 480;
|
||||||
vthreads 4;
|
vthreads 4;
|
||||||
vprofile main;
|
vprofile main;
|
||||||
|
@ -308,7 +308,7 @@ vhost all.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 768;
|
||||||
vheight 320;
|
vheight 320;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
|
@ -335,7 +335,7 @@ vhost ffempty.transcode.vhost.com {
|
||||||
vcodec libx264;
|
vcodec libx264;
|
||||||
vbitrate 300;
|
vbitrate 300;
|
||||||
vfps 20;
|
vfps 20;
|
||||||
vwidth 480;
|
vwidth 768;
|
||||||
vheight 320;
|
vheight 320;
|
||||||
vthreads 2;
|
vthreads 2;
|
||||||
vprofile baseline;
|
vprofile baseline;
|
||||||
|
|
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue