Versions Compared

Key

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

Table of Contents

Overview

New CDN 2.1 implementation includes additional features comparing with CDN 2.0:

  • CDN nodes grouping by geographical (EU, US etc) or another basis
  • CDN nodes can be used for transcoding purposes only by setting Transcoder role to certain nod

CDN nodes grouping

Servers in a CDN can be grouped together by geographical (location), technical (GPU using for transcoding) and anoter basis. CDN group can be assigned to the server with the following parameter in flashphoner.properties file

Code Block
themeRDark
cdn_groups=group1

 The same server can belong to several groups. For example, server located in Europe and used for transcoding on GPU:

Code Block
themeRDark
cdn_groups=EU,GPU

CDN groups are used to choose a route for stream playback.

All the servers not assigned to any group are considered to belong to the same group.

Transcoder CDN nodes

In order not to load the servers used for publishing and watching videos in a CDN with transcoding tasks, it is advisable to allocate server with increased computing perfomance for these tasks. For such nodes, in addition to Origin and Edge roles, Transcoder role is added.

Code Block
themeRDark
cdn_role=transcoder

Transcoder node cannot be used to publish or play streams. This node interacts with Origin and Edge as follows:

1. Stream is published to Origin server

2. Transcoder pulls the stream from Origin server by Edge server request.

3. Transcoder performs stream transcoding by transcoding profile set by Edge server.

4. Edge server pulls the transcoded stream from Transcoder server to play it to subscriber.

The specific node for transcoding is selected when choosing a route for stream playback

Transcoding profiles

To set up transcoding parameters, special profiles are used on Edge server. Transcoding profiles file cdn_profiles.yml should be placed in /usr/local/FlashphonerWebCallServer/conf folder:

Code Block
languageyml
themeRDark
profiles:
 
 -webrtc-144:
  audio:
    type : AudioStreamProfile
    codec : opus
    rate : 48000
    channels : 2
  #this part forces transcoding
  video:
    type : VideoStreamProfile
    width : 256
    height : 144
    codecImpl : OPENH264

When stream playback is requested, transcoding profile name shoould be added to stream name to transcode this stream, for example

Code Block
themeRDark
test-webrtc-144

It is recommended to set hyphenated profile names for convinuence.

Profile parameters

...

opus

mpeg4-generic

speex

...

8000

11025

12000

16000

22050

24000

32000

44100

48000

...

1

2

...

FF

OPENH264

...

When stream is transcoded on Edge server

Stream will be transcoded on Edge under the following conditions:

1. If server video codec priority is higher than profile video codec priority. For example, if the following profile is used

Code Block
languageyml
themeRDark
 -opus-vp8:
  audio:
    type : AudioStreamProfile
    codec : opus
    rate : 48000
    channels : 2
  video:
    type : VideoStreamProfile
    width : 320
    height : 240
    gop : 60
    fps : 30
    codec : vp8
    codecImpl : FF

and the following codec priority is set in server properties

Code Block
themeRDark
codecs=opus,...,h264,vp8,flv,mpv

then VP8 stream will be transcoded to H264 because this codec has a higher priority.

2. If there is no audio codec or sample rate from profile in subscribers' SDP, audio track will be transcoded to one of formats supported by subscriber.

Choosing a route for stream playback

CDN routes are based on the following periodic data sendings between CDN nodes:

  • Origin sends published streams data to Transcoder and Edge;
  • Transcoder sends pulled streams data to Edge in the same group;
  • Edge sends nothing and is always an end poit of a route.
Expand
titleData sending algorithm to build stream route

Image Removed

A route for stream playback on Edge server is chosen as follows:

Image Removed

1. If transcoding profile is set on Edge server:

1.1. If there is the stream with such name on Transcoder node in the same group with Edge:

1.1.1. If the strea, is already transcoded by this profile, Edge pulls the stream from Transcoder

1.1.2. If the stream is transcoded by another profile:

1.1.2.1. Stream will be transcoded by profile set

1.1.2.2. Edge will pull the stream from Transcoder

1.2. If Transcoder that belongs to the same group with Edge can pull the stream with such name from Origin:

1.2.1. Transcoder will pull the stream from Origin

1.2.2. The stream will be transcoded by the profile set.

1.2.3. Edge will pull the stteam from Transcoder

1.3. In other cases, Edge pulls the strea, from Origin

2. If transcoding profile is not set on Edge server, Edge pulls the stream Origin

An example of streams translation via CDN with Transcoder nodes

Image Removed

Where

  • stream1, stream2, stream3 – streams published to Origin server
  • stream1-P1 – stream1 stream transcoded by settings profile P1
  • stream2-P1 – stream1 stream transcoded by settings profile P2

Getting stream routes information with REST API

To get an information about CDN stream routes REST API query /cdn/stream/show_routes is used

REST query should be HTTP/HTTPS POST request as follows:

  • HTTP: http://test.flashphoner.com:8081/rest-api/cdn/stream/show_routes
  • HTTPS: https://test.flashphoner.com:8444/rest-api/cdn/stream/show_routes

Where:

  • test.flashphoner.com - WCS server address
  • 8081 - a standard WCS REST / HTTP port
  • 8444 - a standard WCS HTTPS port
  • rest-api - mandatory part of URL
  • /cdn/stream/show_routes - REST query used

REST queries and responses

...

REST query

...

REST query body example

...

REST response example

...

Response states

...

Description

...

/cdn/stream/show_routes

...

Code Block
languagejs
themeRDark
{
 "streamName":"test-webrtc-144"
}

...

Code Block
languagejs
themeRDark
{
    "1-PROFILE-192.168.1.220": [
        "AudioStreamProfile{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VideoStreamProfile{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",
        "VideoStreamProfile{width=320, height=180, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='FF', quality=null}",
        "VideoStreamProfile{width=256, height=144, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='OPENH264', quality=null}"
],
    "2-STREAM-192.168.1.220": [
        "AudioStreamProfile{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VideoStreamProfile{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}",
        "VideoStreamProfile{width=320, height=180, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='FF', quality=null}",
        "VideoStreamProfile{width=256, height=144, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='OPENH264', quality=null}"
    ],
    "3-NEW-TRANSCODER-192.168.1.220": [],
    "4-PROXY-192.168.1.219": [
        "AudioStreamProfile{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VideoStreamProfile{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}"
    ]
}

...

200 – OK

500 – Internal Server Error

...

Show CDN stream routes

Parameters

...

Description

...

Example

...

Stream name (including transcoding profile if necessary)

...

test-webrtc-144

...

1-PROFILE-192.168.1.220

...

2-STREAM-192.168.1.220

...

AudioStreamProfile{bitrate=0, codec='opus', rate=48000, channels=2}

...

VideoStreamProfile{width=320, height=180, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='FF', quality=null}

...

3-NEW-TRANSCODER-192.168.1.220

...

4-PROXY-192.168.1.219

...

AudioStreamProfile{bitrate=0, codec='opus', rate=48000, channels=2}

...

Include Page
WCS5EN:CDN 2.1
WCS5EN:CDN 2.1