...
In this case inactive nodes will be removed from CDN nodes list after 60 seconds of inactivity.
Coordination of codecs on Origin and Edge servers
In order to avoid excessive transcoding when distributing streams, you need to coordinate codec settings on Origin and Edge servers. Let's take a look at three possible sound encoding configurations in the CDN intended to distribute a stream from the web camera and the RTMP encoder.
Using Opus or AAC
1. Distributing a stream captured from browser Chrome
1.1. Origin captures H.264+Opus stream from Chrome.
1.2. Edge pulls stream from Origin via WebRTС using H.264+Opus, there's no transcoding on Origin.
1.3. Subscriber pulls stream from Edge:
1.3.1. using H.264+Opus, there's no transcoding on Origin;
1.3.2. using H.264+AAC, there is transcoding Opus > AAC on Edge.
2. Distributing a stream captured from RTMP encoder
2.1. Origin captures H.264 stream from RTMP encoder:
2.1.1 AAC sound without transcoding:
2.1.2 Speex soind with transcoding to AAC.
2.2. Edge pulls stream from Origin via WebRTС using H.264+AAC.
2.3. Subscriber pulls stream from Edge:
2.3.1. using H.264+Opus, there is transcoding AAC > Opus Edge;
2.3.2. using H.264+AAC, there's no transcoding on Edge.
For this CDN to work, codecs should be configures as follows:
on Origin server
flash_handler_publish.sdp file should be created
Code Block | ||
---|---|---|
| ||
v=0
o=- 1988962254 1988962254 IN IP4 0.0.0.0
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42e01f;packetization-mode=1
a=sendonly
m=audio 0 RTP/AVP 108
a=rtpmap:108 mpeg4-generic/48000/1
a=sendonly |
on Edge server
this parameter shuold be set in flashphoner.properties file
Code Block | ||||
---|---|---|---|---|
| ||||
codecs_exclude_cdn=alaw,ulaw,g729,speex16,g722,telephone-event,flv |
and flash_handler_play.sdp file should be created
Code Block | ||
---|---|---|
| ||
v=0
o=- 1988962254 1988962254 IN IP4 0.0.0.0
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42e01f;packetization-mode=1
a=recvonly
m=audio 0 RTP/AVP 108
a=rtpmap:108 mpeg4-generic/48000/1
a=recvonly |
Using Opus only
1. Distributing a stream captured from browser Chrome
1.1. Origin captures H.264+Opus stream from Chrome.
1.2. Edge pulls H.264+Opus stream from Origin via WebRTC, there's no transcoding on Origin.
1.3. Subscriber pulls H.264+Opus stream from Edge, there's no transcoding on Edge.
2. Distributing a stream captured from RTMP encoder
2.1. Origin captures H.264 stream from RTMP encoder:
2.1.1 AAC sound with transcoding to Opus:
2.1.2 Speex sound with transcoding to Opus.
2.2. Edge pulls H.264+Opus stream from Origin via WebRTC.
2.3. Subscriber pulls H.264+Opus stream from Edge, there's no transcoding on Edge.
For this CDN to work, codecs should be configures as follows:
on Origin server
codecs setting should be default
on Edge server
this parameter shuold be set in flashphoner.properties file
Code Block | ||||
---|---|---|---|---|
| ||||
codecs_exclude_cdn=alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,flv |
Using AAC only
1. Distributing a stream captured from browser Chrome
1.1. Origin captures H.264+Opus stream from Chrome with transcoding Opus > AAC.
1.2. Edge pulls H.264+AAC stream from Origin via WebRTС.
1.3. Subscriber pulls H.264+AAC stream from Edge, there's no transcoding on Edge.
2. Distributing a stream captured from RTMP encoder
2.1. Origin captures H.264 stream from RTMP encoder:
2.1.1 AAC sound without transcoding:
2.1.2 Speex sound with transcoding to AAC.
2.2. Edge pulls H.264+AAC stream from Origin via WebRTС.
2.3. Subscriber pulls H.264+AAC stream from Edge, there's no transcoding on Edge.
For this CDN to work, codecs should be configures as follows:
on Origin server
flash_handler_publish.sdp file should be created
Code Block | ||
---|---|---|
| ||
v=0
o=- 1988962254 1988962254 IN IP4 0.0.0.0
c=IN IP4 0.0.0.0
t=0 0
a=sdplang:en
m=video 0 RTP/AVP 96
a=rtpmap:96 H264/90000
a=fmtp:96 profile-level-id=42e01f;packetization-mode=1
a=sendonly
m=audio 0 RTP/AVP 108
a=rtpmap:108 mpeg4-generic/48000/1
a=sendonly |
on Edge server
this parameter shuold be set in flashphoner.properties file
Code Block | ||||
---|---|---|---|---|
| ||||
codecs_exclude_cdn=opus,alaw,ulaw,g729,speex16,g722,telephone-event,flv |
...
Choosing audio codecs for stream forwarding through CDN
Forwarding audio through CDN
When forwarding audio through CDN, a set of available codecs is formed with theПри пробросе в CDN набор предлагаемых кодеков формируется с учетомthe
- codec used to publish stream (as preferred), and
- codecs supported on Origin and Edge servers (
codecs
setting in flashphoner.properties file)
...
flash_handler_play.sdp is used for subscriber SDP only, and not affect codecs restrictions when frowarding stream through CDN. If some code is excluded from flash_handler_play.sdp, it will not be used to play RTMP stream by subscriber.
Choosing audio codec to play a
...
stream
If there is a codec used to publish the stream in subscrbers codecs set then this codec will be used to play the stream (regardless of its priority). Otherwise, the subscribers priority codec will be used for playback, and transcoding will occur.
...