SRS Docker#
SRS is a simple, high efficiency and realtime video server, supports RTMP, WebRTC, HLS, HTTP-FLV and SRT.
Docker#
SRS 4.x#
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 ./objs/srs -c conf/docker.conf
then publish stream by:
ffmpeg -re -i ./doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
# Or by FFmpeg docker
docker run --rm -it registry.cn-hangzhou.aliyuncs.com/ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv \
-c copy -f flv rtmp://host.docker.internal/live/livestream
RTMP (by VLC): rtmp://localhost/live/livestream
H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
H5(HLS): http://localhost:8080/live/livestream.m3u8
SRS 3.x#
docker run -d --name srs -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:3
Docker Compose#
srs.yml
Config#
docker run --rm -p 1935:1935 -p 1985:1985 -p 8080:8080 \
-v /path/of/yours.conf:/usr/local/srs/conf/srs.conf \
ossrs/srs:3
Snapshot#
HttpCallback: http://localhost:8085/live/livestream-best.png
Transcoder
RTSP#
+-----------+ +----------------------+ +--------+
| IP Camera +--->--RTSP-->--+ SRS Ingester(FFmpeg) +--->--RTMP-->---+ SRS +
+-----------+ +----------------------+ +--------+
注意:IPC(IP Camera)和SRS Ingester(FFmpeg)一般在内网,FFmpeg推流到内网或公网的SRS。
GB28181: 反向网关#
|
+-----------+ | +---------------+
| IP Camera +-->--GB28181-+->---+ SRS Server +
+-----------+ (UDP) | +---------------+
|
公网 反向网关 内网
NVR#
NVR可以用RTSP协议从IPC拉流,然后录制,或者转成RTMP后推给SRS
WebRTC#
CANDIDATE="192.168.1.10"
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 -p 1990:1990 -p 8088:8088 \
--env CANDIDATE=$CANDIDATE -p 8000:8000/udp \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:4 ./objs/srs -c conf/docker.conf
Note: 请将CANDIDATE设置为服务器的外网地址,详细请阅读WebRTC: CANDIDATE。
WebRTC for Live Streaming#
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/rtmp2rtc.conf
Runtime Environment#
C++