Docker
Please run SRS with docker.
Live Streamingβ
SRS supports live streaming.
Run SRS using docker:
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 ossrs/srs:5
Note: The available images is here.
Use docker of FFmpeg to publish:
docker run --rm -it ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv \
-c copy -f flv rtmp://host.docker.internal/live/livestream
Or publish stream by FFmpeg or OBS :
ffmpeg -re -i ./doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
Note: The file
./doc/source.flv
is under the source repository of SRS.
Play stream by:
- RTMP (by VLC):
rtmp://localhost/live/livestream
- H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
- H5(HLS): http://localhost:8080/live/livestream.m3u8
WebRTCβ
SRS supports WebRTC for video chat.
Run SRS using docker:
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 \
ossrs/srs:5
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
If SRS runs on localhost, push stream to SRS by WebRTC: Publish
Note: If not localhost, browser(WebRTC) requires HTTPS, please see WebRTC using HTTPS for detail.
Play stream of SRS by WebRTC: Play
Note: If use different streams, you're able to do video chat application.
WebRTC for Live Streamingβ
SRS supports coverting live streaming to WebRTC.
Run SRS using docker:
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 \
ossrs/srs:5 ./objs/srs -c conf/rtmp2rtc.conf
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
Note: If convert RTMP to WebRTC, please use
rtmp2rtc.conf
Use docker of FFmpeg to publish:
docker run --rm -it ossrs/srs:encoder ffmpeg -stream_loop -1 -re -i doc/source.flv \
-c copy -f flv rtmp://host.docker.internal/live/livestream
Or publish stream by FFmpeg or OBS :
ffmpeg -re -i ./doc/source.flv -c copy -f flv rtmp://localhost/live/livestream
Note: The file
./doc/source.flv
is under the source repository of SRS.
Play stream by:
- WebRTC: webrtc://localhost/live/livestream
- H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
- H5(HLS): http://localhost:8080/live/livestream.m3u8
WebRTC using HTTPSβ
When pushing stream to SRS, if not localhost, for example, to view WebRTC on pad or mobile phone, when SRS is running on remote server.
Note: If only need to play WebRTC stream, HTTP is ok. If wants to push stream, and not localhost, you need HTTPS.
Run SRS using docker:
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 \
ossrs/srs:5 ./objs/srs -c conf/https.docker.conf
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
Remark: Please use your HTTPS key and cert file, please read HTTPS API and HTTPS Callback and HTTPS Live Streaming, however HTTPS proxy also works perfect with SRS such as Nginx.
Push stream to SRS by WebRTC: Publish
Play stream of SRS by WebRTC: Play
Note: For self-sign certificate, please type
thisisunsafe
to accept it.
Note: If use different streams, you're able to do video chat application.
SRT for Live Streamingβ
SRS supports publishing by SRT for live streaming, and play by SRT or other protocols.
First, start SRS with Docker:
docker run --rm -it -p 1935:1935 -p 1985:1985 -p 8080:8080 -p 10080:10080/udp \
registry.cn-hangzhou.aliyuncs.com/ossrs/srs:5 ./objs/srs -c conf/srt.conf
Publish stream by FFmpeg or OBS :
ffmpeg -re -i ./doc/source.flv -c copy -pes_payload_size 0 -f mpegts \
'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=publish'
ffplay 'srt://127.0.0.1:10080?streamid=#!::r=live/livestream,m=request'
Multiple Streamsβ
You're able to publish multiple streams to SRS, by using different URLs.
rtmp://ip/live/livesteam
rtmp://ip/live/livesteamN
rtmp://ip/liveN/livestreamN
srt://ip:10080?streamid=#!::r=anyM/streamN,m=publish
webrtc://localhost/anyM/streamN
http://ip:8080/anyM/streamN.flv
http://ip:8080/anyM/streamN.m3u8
https://ip:8080/anyM/streamN.flv
https://ip:8080/anyM/streamN.m3u8
Note: Please see RTMP URL for detail.