Docs
Getting Started
Configuration
Apps
CODE
On this page
<Managers>
<API>
<Port>${env:OME_API_PORT:8081}</Port>
<WorkerCount>1</WorkerCount>
</API>
<Managers><WebRTC>
<Signalling>
<Port>${env:OME_SIGNALLING_PORT:3333}</Port>
<WorkerCount>1</WorkerCount>
<TLSPort>3334</TLSPort>
</Signalling>
<IceCandidates>
<TcpRelay>${env:OME_TCP_RELAY_ADDRESS:*:3478}</TcpRelay>
<TcpForce>false</TcpForce>
<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
<IceCandidate>${env:OME_ICE_CANDIDATES:*:10006/udp}</IceCandidate>
</IceCandidates>
</WebRTC><WebRTC>
<Signalling>
<Port>${env:OME_SIGNALLING_PORT:3333}</Port>
<WorkerCount>1</WorkerCount>
<TLSPort>3334</TLSPort>
</Signalling>
<IceCandidates>
<TcpRelay>${env:OME_TCP_RELAY_ADDRESS:*:3478}</TcpRelay>
<TcpRelayWorkerCount>1</TcpRelayWorkerCount>
<IceCandidate>${env:OME_ICE_CANDIDATES:*:10006/udp}</IceCandidate>
</IceCandidates>
</WebRTC><Host>
<Names>
<Name>live.example.com</Name>
</Names>
<TLS>
<CertPath>/path_here/live.example.com.cer</CertPath>
<KeyPath>/path_here/live.example.com.key</KeyPath>
<ChainCertPath>/path_here/fullchain.cer</ChainCertPath>
</TLS>
</Host><SignedPolicy>
<PolicyQueryKeyName>policy</PolicyQueryKeyName>
<SignatureQueryKeyName>signature</SignatureQueryKeyName>
<SecretKey>54321ytrewq_change_to_your_own</SecretKey>
<Enables>
<Providers>rtmp,webrtc,srt</Providers>
</Enables>
</SignedPolicy><Name>app</Name>
<Type>live</Type><OutputProfile>
<Name>1080p30</Name>
<OutputStreamName>${OriginStreamName}_1080p30</OutputStreamName>
<Encodes>
<Audio><Codec>opus</Codec><Bitrate>128000</Bitrate><Samplerate>48000</Samplerate><Channel>2</Channel></Audio>
<Video>
<Codec>h264</Codec>
<Bitrate>3072000</Bitrate><Framerate>30</Framerate>
<Width>1920</Width><Height>1080</Height>
</Video>
</Encodes>
</OutputProfile>
<OutputProfile>
<Name>720p30</Name>
<OutputStreamName>${OriginStreamName}_720p30</OutputStreamName>
<Encodes>
<Audio><Codec>opus</Codec><Bitrate>128000</Bitrate><Samplerate>48000</Samplerate><Channel>2</Channel></Audio>
<Video>
<Codec>h264</Codec>
<Bitrate>1536000</Bitrate><Framerate>30</Framerate>
<Width>1280</Width><Height>720</Height>
</Video>
</Encodes>
</OutputProfile><OutputProfile>
<Name>bypass_stream</Name>
<OutputStreamName>${OriginStreamName}</OutputStreamName>
<Encodes>
<Audio><Bypass>true</Bypass></Audio>
<Video><Bypass>true</Bypass></Video>
</Encodes>
</OutputProfile><WebRTC /><WebRTC>
<Timeout>30000</Timeout>
<Rtx>false</Rtx>
<Ulpfec>false</Ulpfec>
</WebRTC><Managers>
<Host>
<Names>
<Name>*</Name>
</Names>
</Host>
<API>
<AccessToken>qwerty12345_change_to_your_own</AccessToken>
</API>
</Managers>[
{
type: "webrtc",
file: "wss://{host}:3334/{app}/{key}_1080p30{params}",
label: "1080p30"
},
{
type: "webrtc",
file: "wss://{host}:3334/{app}/{key}_720p30{params}",
label: "720p30"
}
][
{
type: "webrtc",
file: "wss://{host}:3334/{app}/{key}{params}",
label: "bypass_stream"
}
]<FILE>
<RootPath>/path/to/recorded/videos</RootPath>
<FilePath>/${Stream}_${Id}.ts</FilePath>
<InfoPath>/${Stream}_${Id}.xml</InfoPath>
</FILE>rtmp {
server {
listen 1935;
application app {
live on;
record off; # disable recording
exec ffmpeg -i rtmp://localhost/app/$name
-preset ultrafast -c:a aac -s 1280:720 -b:a 128k -c:v libx264 -x264-params keyint=24:no-scenecut=1 -r 24 -b:v 1536k -f flv rtmp://localhost/hls/$name_mid
-preset ultrafast -c:a aac -s 1920:1080 -b:a 128k -c:v libx264 -x264-params keyint=24:no-scenecut=1 -r 24 -b:v 2048K -f flv rtmp://localhost/hls/$name_hi;
deny play all;
}
application hls {
live on;
on_publish http://example.com/m/stream/nginx_on_publish/;
hls on;
hls_path /tmp/hls;
hls_nested on;
hls_fragment 2s;
hls_playlist_length 10s;
hls_variant _mid BANDWIDTH=1664000;
hls_variant _hi BANDWIDTH=2176000;
}
}
}record all;
record_path /path/to/recorded/videos;
record_unique on;
on_record_done http://example.com/m/stream/on_record_done/; server {
listen 80;
server_name live.example.com;
index index.html index.htm;
root /var/www/html;
location /app {
types {
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
add_header Access-Control-Allow-Origin *;
add_header Cache-Control no-cache;
alias /tmp/hls;
}
location /stat {
rtmp_stat all;
}
}[
{
type: "hls",
file: "http://{host}/{app}/{key}_hi/index.m3u8{params}",
label: "HD 1080"
},
{
type: "hls",
file: "http://{host}/{app}/{key}_mid/index.m3u8{params}",
label: "HD 720"
}
] location /on_publish/ { # or /on_record_done/
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Real-IP $remote_addr;
proxy_pass https://example.com/m/stream/nginx_on_publish/; # or https://example.com/m/stream/on_record_done/
proxy_redirect off;
}on_publish http://some.example.com/on_publish/;on_record_done http://some.example.com/on_record_done/;45 * * * * find /path/to/recorded/videos/ -mtime +0 -exec rm -f {} \+Auto
