SRS Streaming Server Linux Docker

SRS Streaming Server Linux Docker

1. Pull the official image

docker pull registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4

2. Mirror image export (if it is local machine, skip directly to point 4)

docker save registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 | gzip > srs.tar.gz

3. Mirror image import

docker load < srs.tar.gz

4. Run

CANDIDATE="192.168.1.10"
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 \
    --env CANDIDATE=$CANDIDATE -p 8000:8000/udp \
    registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 ./objs/srs -c conf/rtc.conf

CANDIDATE 若是在服务器上则设置外网地址
--rm 直接运行,要安装容器则把这个换成-dt
1935服务监听端口(TCP)
8080服务控制台端口(TCP,测试用,正式环境可关闭)
1985服务httpAPI,控制台连接SRS使用(TCP)
8000 UDP端口(若服务器不通外网必须打通)
./objs/srs -c conf/rtc.conf 启动命令 其中 -c 代表指定启动文件
5. For streaming test, you need to install ffmpeg
to download and install the package: http://www.ffmpeg.org/download.html
Put it into the virtual machine to decompress
and install yasm

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

Unzip and install

tar xvf yasm-1.3.0.tar.gz & cd yasm-1.3.0.tar.gz & ./configure
make
make install

Enter the ffmpeg decompression directory and execute respectively

./configure
make
make install

After the execution is complete, the terminal input

ffmpeg

Normal output is enough
insert image description here
to test streaming (static video can be used)

fmpeg -re -stream-loop -i ./video.mp4 -c copy -f flv -y rtmp://localhost:1935/live/livestream

Then access the srs service console or player through the ip+8080 browser, and the normal playback is successfully built, and the port uses http_api.
insert image description here

Official document: https://ossrs.net/lts/zh-cn/docs/v4/doc/getting-started

Guess you like

Origin blog.csdn.net/weixin_44167504/article/details/126887461