Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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 the following operation flowchart of the three possible sound encoding configurations in the CDN intended to distribute a stream from the web camera and the RTMP encoder:Image Removed.

Using Opus or AAC

Image Added

1. Distributing the a stream captured from the browser Chrome browser

1.1. Origin receives the stream captures H.264+Opus stream from Chrome.
1.2. Edge fetches pulls stream from Origin the stream via WebRTС using H.264+Opus, there is 's no transcoding on Origin.
1.3. A spectator fetches the Subscriber pulls stream from Edge:
1.3.1. via using H.264+Opus, there's no transcoding on EdgeOrigin;
1.3.2. via using H.264+AAC, Opus there is transcoding Opus > AAC transcoding on Edge.

2. Distributing the a stream captured from the RTMP  RTMP encoder

2.1. Origin receives the stream captures H.264 +AAC stream from the RTMP streamerRTMP encoder:
2.1.1 AAC sound without transcoding:
2.1.2 Speex soind with transcoding to AAC.
2.2. Edge fetches the pulls stream from Origin via WebRTС Husing H.264+Opus, AAC > Opus transcoding on Origin.
2.3. A spectator fetches the Subscriber pulls stream from Edge:
2.3.1. via Husing H.264+Opus, no transcoding on there is transcoding AAC > Opus Edge;
2.3.2. via Husing H.264+AAC, Opus > AAC transcoding on Edgethere's no transcoding on Edge.

For operation of such this CDN to work, you should configure codecs in the flashphoner.properties file codecs should be configures as follows:

on the Origin server

...

flash_handler_publish.sdp file should be created

Code Block
themeRDark
codecs=opus,mpeg4-generic,alaw,ulaw,g729,g722,telephone-event,h264,vp8,flv,mpv
# switching transcoding on, to push to Edge audio in Opus codec only
disable_rtc_avoid_transcoding_alg=true

...

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
languagebash
themeRDark
codecs_exclude_cdn=alaw,ulaw,g729,speex16,g722,telephone-event,flv

and flash_handler_play.sdp file should be created

Code Block
themeRDark
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

Image Added

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
languagebash
themeRDark
codecs_exclude_cdn=alaw,ulaw,g729,speex16,g722,mpeg4-generic,telephone-event,flv

Using AAC only

Image Added

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
themeRDark
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
languagebash
themeRDark
codecscodecs_exclude_cdn=opus,mpeg4-generic,alaw,ulaw,g729,speex16,g722,telephone-event,h264,vp8,flv,mpv
# exclude AAC from cdn to pull from Origin audio in Opus codec only
codecs_exclude_cdn=flv,telephone-event,mpeg4-generic

Quick manual on testing

1. For testing we use:

...