当前位置: 首页 > 文档资料 > SRS Wiki 中文文档 >

SRT deploy example

优质
小牛编辑
114浏览
2023-12-01

SRS支持SRT的详细步骤。
了解更多的srt,请访问srt wiki

假设服务器的IP是:192.168.1.170

第一步,获取SRS。详细参考GIT获取代码

git clone https://github.com/ossrs/srs
cd srs/trunk

或者使用git更新已有代码:

git pull

第二步,编译SRS。详细参考Build

./configure && make

备注:推荐使用srs-docker启动SRS和运行FFMPEG。

第三步,编写SRS配置文件。详细参考SRT

将以下内容保存为文件,譬如conf/srt.conf,服务器启动时指定该配置文件(srs的conf文件夹有该文件)。

# conf/srt.conf
listen              1935;
max_connections     1000;
daemon              off;
srs_log_tank        console;
srt_server {
    enabled on;
    listen 10080;
}
vhost __defaultVhost__ {
}

Note: 关于SRT更多的详细配置参数,参考SRT Parameters

Note: 关于SRT的讨论可以参考#1147

第四步,启动SRS。

./objs/srs -c conf/srt.conf

第五步,启动推流编码器。

使用FFMPEG命令推流:

    for((;;)); do \
        ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
        -vcodec copy -acodec copy \
        -f mpegts "srt://127.0.0.1:10080?streamid=#!::h=live/livestream,m=publish"; \
        sleep 1; \
    done

生成的流地址为:

  • RTMP流地址为:rtmp://192.168.1.170/live/livestream

第六步,观看RTMP流。

RTMP流地址为:rtmp://192.168.1.170/live/livestream

可以使用VLC观看。

或者使用在线SRS播放器播放:srs-player