Clone
1
migrate_v4_EN_sample srt
winlin edited this page 2022-07-31 13:16:33 +08:00
This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

HOME > EN > SRT > SRT Sample

SRT deploy example

Delivery SRT by SRS:

Suppose the server ip is 192.168.1.170

Step 1, get SRS. For detail, read GIT

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

Or update the exists code:

git pull

Step 2, build SRS. For detail, read Build

./configure --srt=on && make

Remark: Recommend srs-docker to run SRS and FFMPEG.

Step 3, config srs. Please read SRT.

Save bellow as config, or use conf/srt.conf:

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

Note: About more parameters, please see SRT Parameters.

Note: More discussion about SRT, please read #1147.

Step 4, start srs.

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

Step 5, start encoder.

Use FFMPEG to publish stream:

    for((;;)); do \
        ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.flv \
        -c copy \
        -f mpegts "srt://192.168.1.170:10080?streamid=#!::r=live/livestream,m=publish"; \
        sleep 1; \
    done

The stream in SRS:

  • RTMP urlrtmp://192.168.1.170/live/livestream

Step 6, play RTMP stream.

RTMP url is: rtmp://192.168.1.170:1935/live/livestream

User can use vlc to play the RTMP stream.

Or, use online SRS player: srs-player

Note: Please replace all ip 192.168.1.170 to your server ip.

Winlin 2020.01