天天看点

多实例srs:srs-srs-dolphin srs-dolphin

原文地址:https://github.com/ossrs/srs-dolphin

复制黏贴用法

srs-dolphin

The dolphin is a MultipleProcess SRS SRS container, which start multiple SRS in edge mode in seperate process.

About

The dolphin is the most simple MultipleProcess arch for RTMP/HTTP-FLV of SRS.

The srs-sharp is a similar project, but srs-sharp is a HTTP FLV reverse proxy, its performance is great and is's ok for HTTP FLV stream. The bellow table is a comparation between srs-sharp and srs-dolphin:

Project Goal Protocol Performance Deploy
srs-sharp HTTP-FLV HTTP 10k, 300%CPU Manual(*)
srs-dolphin RTMP/HTTP-FLV TCP 20k, 320%CPU Auto(*)

Remark:

  1. Manual Deploy of srs-sharp: User should manually deply the SRS edge, then start srs-sharp to proxy the ports of SRS.
  2. Auto Deploy of srs-dolphin: User only need to start srs-dophin, which will auto manage the SRS.

Usage

Step 1: Prepare SRS:

cd ~ && git clone https://github.com/simple-rtmp-server/srs.git &&
cd ~/srs/trunk && ./configure --with-ffmpeg && make && ./objs/srs -c conf/srs.conf
           

Remark: We clone the SRS and Dolphin to user home, user can specify others.

Step 2: Clone the srs-dolphin:

cd ~ && git clone https://github.com/simple-rtmp-server/srs-dolphin.git
           

Step 3: Build and run the srs-dolphin:

cd ~/srs-dolphin/trunk && make && 
./objs/srs_dolphin -w 4 -p 19350 -x 8088 \
    -b ~/srs/trunk/objs/srs -c conf/dolphin.conf \
    -s 1936,1937,1938,1939 -y 8081,8082,8083,8084
           

Remark: User can specifies the SRS in other valid path.

Remark: The conf/dolphin.conf is a default conf for SRS by dolphin, user can use others.

Remark: Use the command to test your config for SRS in dolphin mode 

~/srs/trunk/objs/srs -c conf/dolphin.conf -p 19350 -x 8088

, it's ok when your SRS start normally.

Step 4: Publish stream

cd ~/srs/trunk &&
for ((;;)); do
    ./objs/ffmpeg/bin/ffmpeg -re -i ./doc/source.200kbps.768x320.flv \
        -vcodec copy -acodec copy -f flv -y rtmp://127.0.0.1:1935/live/livestream
done
           

Step 5: Play stream

Origin SRS RTMP stream: rtmp://127.0.0.1:1935/live/livestream
Edge Dolphin RTMP stream: rtmp://127.0.0.1:19350/live/livestream
Edge Dolphin HTTP-FLV stream: http://127.0.0.1:8088/live/livestream.flv
           

Remark: User can use SB to do the benchmark.

Features

  1. Multiple Processes for SRS edge.
  2. Delivery stream in RTMP.
  3. Delivery stream in HTTP FLV.
  4. [dev] Support HTTP API for Multiple Processes.
  5. [dev] Muktiple Processes for SRS origin.
  6. [dev] Auto fork new process when worker or SRS exit.
  7. [dev] Load balance proxy for RTMP and HTTP-FLV.

Winlin 2015.5

srs