Skip to content

aesirteam/srs-docker

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SRS

The docker images for SRS.

Usage

For SRS3 and tags.

Run SRS in docker by:

docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:3

After SRS is running, you can:

  • Publish stream to SRS by ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv rtmp://127.0.0.1/live/livestream
  • Play stream from SRS by ffmpeg -f flv -i rtmp://127.0.0.1/live/livestream -f flv -y /dev/null
  • Access the console by http://127.0.0.1:1985/console

The env of docker is bellow:

  • config file: /usr/local/srs/conf/srs.conf
  • log file: /usr/local/srs/objs/srs.log

To overwrite the config by /path/of/yours.conf and gather log to /path/of/yours.log:

docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 \
    -v /path/of/yours.conf:/usr/local/srs/conf/srs.conf \
    -v /path/of/yours.log:/usr/local/srs/objs/srs.log \
    ossrs/srs:3

Note: You should create the log file by mkdir -p /path/of && touch /path/of/yours.log, then start SRS.

Note: How to write the correct config file, please read wiki(CN/EN).

Aliyun

To use docker images in AliyunCR, please use registry.cn-hangzhou.aliyuncs.com/ossrs/srs.

For example:

docker run registry.cn-hangzhou.aliyuncs.com/ossrs/srs:3

Note: Strongly recommend to use AliyunCR, because it's is much faster and has all tags.

Origin Cluster

Download config and script files:

git clone https://github.com/ossrs/srs-docker.git &&
cd srs-docker/3.0

Start origin serverA:

HostIP=`./auto/get_host_ip.sh` &&
docker run -p 19350:19350 -p 9090:9090 --add-host=docker:${HostIP} \
    -v `pwd`/conf/origin.cluster.serverA.conf:/usr/local/srs/conf/srs.conf \
    ossrs/srs:3

Start origin serverB:

HostIP=`./auto/get_host_ip.sh` &&
docker run -p 19351:19351 -p 9091:9091 --add-host=docker:${HostIP} \
    -v `pwd`/conf/origin.cluster.serverB.conf:/usr/local/srs/conf/srs.conf \
    ossrs/srs:3

Start edge server:

HostIP=`./auto/get_host_ip.sh` &&
docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 --add-host=docker:${HostIP} \
    -v `pwd`/conf/origin.cluster.edge.conf:/usr/local/srs/conf/srs.conf \
    ossrs/srs:3

Publish stream to edge server(or any origin server):

ffmpeg -re -i doc/source.200kbps.768x320.flv -c copy -f flv rtmp://127.0.0.1/live/livestream

Play stream from edge:

ffmpeg -f flv -i rtmp://127.0.0.1/live/livestream -f flv -y /dev/null

If now streaming to serverA, we can stop it then restart the publisher, then the edge will choose serverB and stream to it.

FFMPEG

For #1523, we copy the FFMEPG from ossrs/srs:dev, and put to /usr/local/srs/objs/ffmpeg/bin/ffmpeg which is the default value of configs.

You can replace it by docker -v, for example:

docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 \
    -v /path/of/ffmpeg:/usr/local/srs/objs/ffmpeg/bin/ffmpeg \
    ossrs/srs:3

Remark: You can replace config, log and tools by specifying -v for each one.

Windows

For windows PowerShell, we start a demo stream, ingested by FFMPEG:

docker run -p 1935:1935 -p 1985:1985 -p 8080:8080 `
    -v $pwd/doc/source.200kbps.768x320.flv:/usr/local/srs/doc/source.200kbps.768x320.flv `
    -v $pwd/conf/windows.conf:/usr/local/srs/conf/srs.conf `
    ossrs/srs:3

Then, we can play the demo stream by:

Debug

For debuggging:

  • Check files of docker: docker run -it ossrs/srs bash
  • Use specified versions: docker run -it ossrs/srs:v3.0-a2 bash
  • To use other config file: docker run -v /path:/usr/local/srs/conf ossrs/srs:3 ./objs/srs -c other.conf
  • Use gdb to debug SRS, please use dev.

Winlin 2019.11

About

The dockerized SRS.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 72.0%
  • JavaScript 25.5%
  • Shell 1.9%
  • Other 0.6%