Skip to content

v2_EN_SampleHttpFlv

winlin edited this page Jan 6, 2022 · 36 revisions

HOME > EN > HTTP FLV

SRS HTTP FLV deploy example

About the HTTP FLV of SRS, read HTTP FLV

How to use multiple process for HTTP FLV? You can use HTTP reverse proxy, and SRS start the go-sharp project, which can proxy in load balance mode and detect the status of SRS. For go-sharp, read go-sharp

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 && make

Step 3, config srs. For detail, read HTTP FLV

Save bellow as config, or use conf/http.flv.live.conf:

# conf/http.flv.live.conf
listen              1935;
max_connections     1000;
http_server {
    enabled         on;
    listen          8080;
    dir             ./objs/nginx/html;
}
vhost __defaultVhost__ {
    http_remux {
        enabled     on;
        mount       [vhost]/[app]/[stream].flv;
        hstrs       on;
    }
}

Step 4, start srs. For detail, read HTTP FLV

./objs/srs -c conf/http.flv.live.conf

Step 5, start encoder. For detail, read read HTTP FLV

Use FFMPEG to publish stream:

    for((;;)); do \
        ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
        -vcodec copy -acodec copy \
        -f flv -y rtmp://192.168.1.170/live/livestream; \
        sleep 1; \
    done

Or use FMLE to publish:

FMS URL: rtmp://192.168.1.170/live
Stream: livestream

The streams on SRS:

  • RTMP: rtmp://192.168.1.170/live/livestream
  • HTTP FLV: http://192.168.1.170:8080/live/livestream.flv

Step 6, play RTMP. For detail, read HTTP FLV

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.

Step 7, play HTTP FLV. For detail, read HTTP FLV

HTTP FLV url: http://192.168.1.170:8080/live/livestream.flv, User can use vlc to play the HLS stream. Or, use online SRS player(you must input the flv url): jwplayer-flv

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

Winlin 2014.11

Welcome to SRS wiki!

SRS 5.0 wiki

Please select your language:

SRS 4.0 wiki

Please select your language:

SRS 3.0 wiki

Please select your language:

SRS 2.0 wiki

Please select your language:

SRS 1.0 wiki

Please select your language:

Clone this wiki locally