Build
You can build SRS from source code, but docker is highly recommend.
Live Streaming
SRS supports live streaming.
Get SRS source, recommend Ubuntu20:
git clone -b 4.0release https://github.com/ossrs/srs.git
Build SRS in srs/trunk
:
cd srs/trunk
./configure
make
Run SRS server:
./objs/srs -c conf/srs.conf
Check SRS by http://localhost:8080/ or:
# Check the process status
./etc/init.d/srs status
# Check the SRS logs
tail -n 30 -f ./objs/srs.log
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.
Get SRS source, recommend Ubuntu20:
git clone -b 4.0release https://github.com/ossrs/srs.git
Build SRS in srs/trunk
:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
./objs/srs -c conf/srs.conf
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
Check SRS by http://localhost:8080/ or:
# Check the process status
./etc/init.d/srs status
# Check the SRS logs
tail -n 30 -f ./objs/srs.log
Push stream to SRS by WebRTC: Publish
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 converting live streaming to WebRTC.
Get SRS source, recommend Ubuntu20:
git clone -b 4.0release https://github.com/ossrs/srs.git
Build SRS in srs/trunk
:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
./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
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: http://localhost:1985/rtc/v1/whep/?app=live&stream=livestream
- H5(HTTP-FLV): http://localhost:8080/live/livestream.flv
- H5(HLS): http://localhost:8080/live/livestream.m3u8
WebRTC using HTTPS
If not localhost, for example, to view WebRTC on pad or mobile phone, when SRS is running on remote server.
Get SRS source, recommend Ubuntu20:
git clone -b 4.0release https://github.com/ossrs/srs.git
Build SRS in srs/trunk
:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
./objs/srs -c conf/https.rtc.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.