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 develop https://github.com/ossrs/srs.git
Build SRS in srs/trunk:
cd srs/trunk
./configure
make
Run SRS server:
env SRS_RTMP_LISTEN=1935 SRS_HTTP_API_ENABLED=on SRS_HTTP_SERVER_ENABLED=on \
SRS_VHOST_HTTP_REMUX_ENABLED=on SRS_VHOST_HLS_ENABLED=on \
./objs/srs -e
Check SRS by http://localhost:8080/ or by the HTTP API, and the logs are in the console:
curl http://localhost:1985/api/v1/versions
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.flvis 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 develop https://github.com/ossrs/srs.git
Build SRS in srs/trunk:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
env SRS_RTMP_LISTEN=1935 SRS_HTTP_API_ENABLED=on SRS_HTTP_SERVER_ENABLED=on \
SRS_RTC_SERVER_ENABLED=on SRS_RTC_SERVER_CANDIDATE=$CANDIDATE SRS_VHOST_RTC_ENABLED=on \
SRS_VHOST_HTTP_REMUX_ENABLED=on SRS_VHOST_HLS_ENABLED=on \
./objs/srs -e
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
Check SRS by http://localhost:8080/ or by the HTTP API, and the logs are in the console:
curl http://localhost:1985/api/v1/versions
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 converting live streaming to WebRTC.
Get SRS source, recommend Ubuntu20:
git clone -b develop https://github.com/ossrs/srs.git
Build SRS in srs/trunk:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
env SRS_RTMP_LISTEN=1935 SRS_HTTP_API_ENABLED=on SRS_HTTP_SERVER_ENABLED=on \
SRS_RTC_SERVER_ENABLED=on SRS_RTC_SERVER_CANDIDATE=$CANDIDATE SRS_VHOST_RTC_ENABLED=on \
SRS_VHOST_RTC_RTMP_TO_RTC=on SRS_VHOST_RTC_RTC_TO_RTMP=on \
SRS_VHOST_HTTP_REMUX_ENABLED=on SRS_VHOST_HLS_ENABLED=on \
./objs/srs -e
Note: Please replace the IP with your server IP.
Note: About CANDIDATE, please read CANDIDATE
Note: If convert RTMP to WebRTC, you can also use the config file
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.flvis 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 develop https://github.com/ossrs/srs.git
Build SRS in srs/trunk:
cd srs/trunk
./configure
make
Run SRS server:
CANDIDATE="192.168.1.10"
env SRS_RTMP_LISTEN=1935 SRS_HTTP_API_ENABLED=on SRS_HTTP_API_HTTPS_ENABLED=on \
SRS_HTTP_SERVER_ENABLED=on SRS_HTTP_SERVER_HTTPS_ENABLED=on \
SRS_RTC_SERVER_ENABLED=on SRS_RTC_SERVER_CANDIDATE=$CANDIDATE SRS_VHOST_RTC_ENABLED=on \
SRS_VHOST_HTTP_REMUX_ENABLED=on \
./objs/srs -e
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
thisisunsafeto accept it.
Note: If use different streams, you're able to do video chat application.
Cross Buildâ
Normally you're able to build SRS on both ARM or MIPS servers.
If need to cross-build SRS for embed devices, pelase read ARM and CrossBuild.
