当前位置:网站首页>SRS deployment

SRS deployment

2022-04-23 19:46:00 fang·up·ad

This article , Let's introduce the use of SRS To deploy a set of streaming media servers , And use FFmpeg To push the flow ,VLC Laila flow .

1. download srs Source code

https://github.com/ossrs/srs/releases

2. Decompress the package

tar xvf srs-server-4.0-b10.tar.gz

3. establish build Catalog

$cd srs-server-4.0-b10/trunk/

$mkdir build

4.config & make & make install

$./configure --prefix=/opt/srs/srs-server-4.0-b10/trunk/build --full$make$make install

5.make Errors in the process and Solutions

In file included from ../../../objs/gtest/include/gtest/internal/gtest-port.h:197:0,                 from ../../../objs/gtest/include/gtest/internal/gtest-internal.h:40,                 from ../../../objs/gtest/include/gtest/gtest.h:57,                 from ../../../src/utest/srs_utest.hpp:36,                 
from ../../../src/utest/srs_utest.cpp:24:/usr/include/c++/7/sstream:300:7: error: ‘struct std::__cxx11::basic_stringbuf<_CharT, _Traits, _Alloc>::__xfer_bufptrs’ 
redeclared with different access struct __xfer_bufptrs


$./configure --prefix=/opt/srs/srs-server-4.0-b10/trunk/build --full --without-utest
$make
$make install

6. Add profile :/opt/srs/srs-server-4.0-b10/trunk/build/conf/my_hls.conf

listen              1935;
max_connections     1000;
daemon              on;
srs_log_tank        file;
srs_log_level        error;
srs_log_file        ./objs/srs.log;

http_server {
    enabled         on;
    listen          8081;
    dir             ./objs/nginx/html;
}

vhost __defaultVhost__ {
    hls {
        enabled         on;
        hls_fragment    10;
        hls_window      60;
        hls_path        ./objs/nginx/html;
        hls_m3u8_file   [app]/[stream].m3u8;
        hls_ts_file     [app]/[stream]-[seq].ts;
        hls_cleanup     on;
        hls_dispose     30;
        hls_on_error    continue;
        hls_storage     disk;
        hls_wait_keyframe       on;
        hls_acodec      aac;
        hls_vcodec      h264;
    }
}

7. start-up srs

(1)cd /opt/srs/srs-server-4.0-b10/trunk/build

(2)sudo ./objs/srs -c ./conf/my_hls.conf

(3)./etc/init.d/srs status  see srs state 

(4)tail -n 30 -f ./objs/srs.log  see srs journal 

 

8.ffmpeg Push flow

ffmpeg -stream_loop -1 -v verbose -re -i sample_yuancore_720p.mp4  -f flv rtmp://192.168.41.115:1935/rtmp_live/mystream
 
-stream_loop -1  Infinite cyclic push flow 
-v verbose  Detailed log 
-re  Original bitrate streaming 
-c:a copy -c:v copy  Omit   Push the stream according to the original code  

9. Generated m3u8 and ts File path

/opt/srs/srs-server-4.0-b10/trunk/build/objs/nginx/html/rtmp_live

10.VLC Pull flow (rtmp、http)

rtmp://192.168.41.115:1935/rtmp_live/mystream
http://192.168.41.115:8081/rtmp_live/index.m3u8

版权声明
本文为[fang·up·ad]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204231929411948.html