Versions Compared

Key

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

...

defines veryfast preset usage with Main profile and level 3.1

When stream is transcoded on Edge server

Stream will be transcoded on Edge under the following conditions:

...

Picture aspect ratio preserving while stream transcoding by profile

If picture aspect ratio preserving is enabled for all CDN nodes (by default), then stream aspect ratio as published to Origin node will be preserved while transcoding the stream on Transcoder node. For example, if the following profile is used(16:9) is applied  to 640x480 (4:3) stream

Code Block
languageyml
themeRDark
 -opus-vp8profile1:
  audio:
    codec : opus
    rate : 48000
    channels : 2
  video:
    width : 320
    height : 240180
    gop : 6090
    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

...

h264

the 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"
}

...

languagejs
themeRDark

...

320x240 (4:3).

In this case, picture width may be omitted in transcoding profile, because width will be chosen according to picture aspect ratio. For example, the following profile is allowed

Code Block
languageyml
themeRDark
 profile3:
  audio:
    codec : opus
    rate : 48000
  video:
    height : 180

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:
    codec : opus
    rate : 48000
    channels : 2
  video:
    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 Added

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

Image Added

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 Added

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
{
    "REQUESTED-PROFILE": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=320256, height=180144, gop=null, fps=null, bitrate=0, codec='H264h264', codecImpl='FFOPENH264', quality=null}",
    ],
    "VIDEO{width=256, height=144, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='OPENH264', quality=null}"
    ],
    "2-STREAM-192.168.1.220": [
        "1-PROFILE-192.168.1.220": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",
        "VIDEO{width=320, height=180, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='FF', quality=null}",
        "VIDEO{width=256, height=144, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='OPENH264', quality=null}"
    ],
    "32-NEWSTREAM-TRANSCODER-192.168.1.220": [],
    "4-PROXY-192.168.1.219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}",
        "VIDEO{width=320, height=180, gop=null, fps=null,  ]
}

200 – OK

500 – Internal Server Error

Show CDN stream routes

Parameters

VIDEO{width=256, height=144, gop=null, fps=h2642-STREAM320180FF4-PROXY-192.168.1.219

Description

Example

Stream name (including transcoding profile if necessary)

test-webrtc-144
Transcoding profile requested parameters
Profile requested parameters
REQUESTED-PROFILE
Audio parameters
AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}
Video parameters
bitrate=0, codec='H264', codecImpl='FF', quality=null}",
        "VIDEO{width=256, height=144, gop=null, fps=null, bitrate=0, codec='
H264', codecImpl='OPENH264', quality=null}
Transcoder stream parameters
Transcoding profiles used by Transcoder parameters
1-PROFILE-192.168.1.220
Stream pulled from Origin by Transcoder parameters
"
    ],
    "3-NEW-TRANSCODER-192.168.1.220
Audio parameters
": [],
    "4-PROXY-192.168.1.219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}
Video parameters (according to transcoding profiles used)
",
        "VIDEO{width=
0, height=
0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='
', quality=null}"
    ]
}
Stream parameters that Transcoder can pull from Origin
3-NEW-TRANSCODER-192.168.1.220
Origin stream parameters
Stream published to Origin parameters

200 – OK

500 – Internal Server Error

Show CDN stream routes

Parameters

Description

Example

Stream name (including transcoding profile if necessary)

test-webrtc-144
Transcoding profile requested parameters
Profile requested parameters
REQUESTED-PROFILE
Audio parameters
AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}
Video parameters
VIDEO{width=0256, height=0144, gop=null, fps=null, bitrate=0, codec='H264h264', codecImpl='OPENH264', quality=null}

CDN routes checking examples

Let's look how to check some CDN routes build for stream playback.

For example we use three nodes CDN:

...

Transcoder stream parameters
Transcoding profiles used by Transcoder parameters
1-PROFILE-192.168.1.220

...

Stream pulled from Origin by Transcoder parameters
2-STREAM-192.168.1.

...

WebRTC H264+opus (48 kHz, stereo) stream named test is published to Origin

Stream pulling from Origin without transcoding if publishing and playback profiles are equal

Stream named test is played on Edge by profile

Code Block
languageyml
themeRDark
 -webrtc-opus-video-proxy:
  audio:
    codec : opus
    rate : 48000
    channels : 2
  video:
    codec: h264

The response to this query

Code Block
languagejs
themeRDark
http://192.168.1.221:8081/rest-api/cdn/stream/show_routes
{
    "streamName": "test-webrtc-opus-video-proxy"
}

should be interpreted as follows:

1. Profile requested parameters:

...

languagejs
themeRDark

...

220
Audio parameters
AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}
Video parameters (according to transcoding profiles used)
VIDEO{width=320, height=180, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='FF', quality=null}
Stream parameters that Transcoder can pull from Origin
3-NEW-TRANSCODER-192.168.1.220
Origin stream parameters
Stream published to Origin parameters
4-PROXY-192.168.1.219
Audio parameters
AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}
Video parameters
VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='

...

H264', codecImpl='

...

', quality=null}

...

2. Stream is pulled from Origin:

Code Block
languagejs
themeRDark
    "1-PROXY-PROFILE-192.168.1.219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}"
    ],

...

CDN routes checking examples

Let's look how to check some CDN routes build for stream playback.

For example we use three nodes CDN:

  • 192.168.1.219 - Origin
  • 192.168.1.220 - Transcoder
  • 192.168.1.221 - Edge

WebRTC H264+opus (48 kHz, stereo) stream named test is published to Origin

Stream pulling from Origin without transcoding if publishing and playback profiles are equal

Stream named test is played on Edge by profile

Code Block
languageyml
themeRDark
 -webrtc-opus-video-proxy:
  audio:
    codec : opus
    rate : 48000
    channels : 2
  video:
    codec: h264

The response to this query

Code Block
languagejs
themeRDark
    "2-NEW-TRANSCODER-http://192.168.1.220": [],

...

221:8081/rest-api/cdn/stream/show_routes
{
    "streamName": "test-webrtc-opus-video-proxy"
}

should be interpreted as follows:

1. Profile requested parameters:

Code Block
languagejs
themeRDark
    "3-PROXY-192.168.1.219REQUESTED-PROFILE": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264h264', codecImpl='null', quality=null}"
    ]

,

2. Stream

...

Stream named test is played on Edge by profile

is pulled from Origin:

Code Block
languageymljs
themeRDark
    "1-webrtcPROXY-pcma-video-proxy:
  audio:
PROFILE-192.168.1.219": [
        "AUDIO{bitrate=0, codec : pcma='opus', rate=48000, channels=2}",
    rate : 8000
    channels : 1

...

    "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}"
    ],

3. Stream can be pulled from Transcoder

Code Block
languagejs
themeRDark
http://    "2-NEW-TRANSCODER-192.168.1.221:8081/rest-api/cdn/stream/show_routes
{
    "streamName": "test-webrtc-pcma-video-proxy"
}

should be interpreted as follows:

...

220": [],

4. But is pulled from Origin because stream publishing parameters are equal to requested playback parameters:

Code Block
languagejs
themeRDark
    "REQUESTED-PROFILE": [
        "AUDIO{bitrate=0, codec='pcma', rate=8000, channels=1}"
    ],

2. Transcoding profile is created on Transcoder:

Code Block
languagejs
themeRDark
    "1-PROFILE-192.3-PROXY-192.168.1.220219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",
        "AUDIO{bitrate=0, codec='PCMA', rate=8000, channels=1}"
    ],

...

]

Stream pulling from Transcoder with audio transcoding

Stream named test is played on Edge by profile

Code Block
languagejsyml
themeRDark
    "2-STREAM-192.168.1.220": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",-webrtc-pcma-video-proxy:
  audio:
    codec : pcma
    rate :   "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",8000
    channels : 1

The response to this query

Code Block
languagejs
themeRDark
http://192.168.1.221:8081/rest-api/cdn/stream/show_routes
{
        "AUDIO{bitrate=0, codec='PCMA', rate=8000, channels=1}"
    ],
    "3-NEW-TRANSCODER-192.168.1.220": [],

...

"streamName": "test-webrtc-pcma-video-proxy"
}

should be interpreted as follows:

1. Profile requested parameters:

Code Block
languagejs
themeRDark
    "3-PROXY-192.168.1.219REQUESTED-PROFILE": [
        "AUDIO{bitrate=0, codec='opuspcma', rate=480008000, channels=21}",
    ],

2. Transcoding profile is created on Transcoder:

Code Block
languagejs
themeRDark
    "VIDEO{width=0, height=0, gop=null, fps=null, 1-PROFILE-192.168.1.220": [
        "AUDIO{bitrate=0, codec='H264opus', codecImplrate=''48000, qualitychannels=null2}",
      ]

Stream pulling from Transcoder with video transcoding

Stream named test is played on Edge by profile

Code Block
languageyml
themeRDark
 -opus-vp8:
  audio:
    codec : opus "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",
    rate : 48000
  "AUDIO{bitrate=0, codec='PCMA', rate=8000, channels=1}"
 : 2
  video:
  ],

3. Stream is pulled from Transcoder

Code Block
languagejs
themeRDark
    width "2-STREAM-192.168.1.220": 320[
     height : 240
    gop : 60
 "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
       fps : 30
    codec : vp8 "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='null', quality=null}",
    codecImpl : FF

...

    "AUDIO{bitrate=0, codec='PCMA', rate=8000, channels=1}"
    ],
    "3-NEW-TRANSCODER-192.168.1.220": [],

4. Stream publishing to Origin parameters:

Code Block
languagejs
themeRDark
http://    "3-PROXY-192.168.1.221:8081/rest-api/cdn/stream/show_routes
{
    "streamName": "test-webrtc-opus-vp8"
}

should be interpreted as follows:

1. Profile requested parameters:

Code Block
languagejs
themeRDark
    "REQUESTED-PROFILE": 219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=3200, height=2400, gop=60null, fps=30null, bitrate=0, codec='vp8H264', codecImpl='FF', quality=null}"
    ],

...



Stream pulling from Transcoder with video transcoding

Stream named test is played on Edge by profile

Code Block
languagejsyml
themeRDark
    "1-PROFILE-192.168.1.220": [opus-vp8:
  audio:
    codec : opus
  "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}", : 48000
    channels : 2
  video:
    width  "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}",: 320
    height : 240
    gop : 60
    fps : 30
   "VIDEO{width=320, height=240, gop=60, fps=30, bitrate=0, codec='VP8', codecImpl='FF', quality=null}"
    ],

...

 codec : vp8
    codecImpl : FF

The response to this query

Code Block
languagejs
themeRDark
    "2-STREAM-http://192.168.1.220"221:8081/rest-api/cdn/stream/show_routes
{
    "streamName": "test-webrtc-opus-vp8"
}

should be interpreted as follows:

1. Profile requested parameters:

Code Block
languagejs
themeRDark
    "REQUESTED-PROFILE": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0320, height=0240, gop=null60, fps=null30, bitrate=0, codec='H264vp8', codecImpl='FF', quality=null}",
    ],

2. Transcoding profile is created on Transcoder:

Code Block
languagejs
themeRDark
    "VIDEO{width=320, height=240, gop=60, fps=30, "1-PROFILE-192.168.1.220": [
        "AUDIO{bitrate=0, codec='VP8opus', codecImplrate='FF'48000, qualitychannels=null2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264',  ]codecImpl='', quality=null}",
     "3-NEW-TRANSCODER-192.168.1.220": [],

4. Stream publishing to Origin parameters:

Code Block
languagejs
themeRDark
    "3-PROXY-192.168.1.219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}"
    ]

Picture aspect ratio preserving while stream transcoding by profile

If picture aspect ratio preserving is enabled for all CDN nodes (by default), then stream aspect ratio as published to Origin node will be preserved while transcoding the stream on Transcoder node. For example, if the following profile (16:9) is applied  to 640x480 (4:3) stream

Code Block
languageyml
themeRDark
 profile1:
  audio:
    codec : opus
    rate : 48000
  video:
    width : 320
    height : 180
    gop : 90
    fps : 30
    codec : h264

the stream will be transcoded to 320x240 (4:3).

In this case, picture height may be omitted in transcoding profile, because height will be chosen according to picture aspect ratio. For example, the following profile is allowed

Code Block
languageyml
themeRDark
 profile3:
  audio:
    codec : opus
    rate : 48000
  video:
    width : 320   "VIDEO{width=320, height=240, gop=60, fps=30, bitrate=0, codec='VP8', codecImpl='FF', quality=null}"
    ],

3. Stream is pulled from Transcoder

Code Block
languagejs
themeRDark
    "2-STREAM-192.168.1.220": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}",
        "VIDEO{width=320, height=240, gop=60, fps=30, bitrate=0, codec='VP8', codecImpl='FF', quality=null}"
    ],
    "3-NEW-TRANSCODER-192.168.1.220": [],

4. Stream publishing to Origin parameters:

Code Block
languagejs
themeRDark
    "3-PROXY-192.168.1.219": [
        "AUDIO{bitrate=0, codec='opus', rate=48000, channels=2}",
        "VIDEO{width=0, height=0, gop=null, fps=null, bitrate=0, codec='H264', codecImpl='', quality=null}"
    ]

Transcoder node load balancing

If there are some Transcoder nodes with the same profiles in CDN, those nodes load can be balanced  by CPU load. Maximum allowed load for certain Transcoder can be defined with the following parameter

Code Block
themeRDark
cdn_node_load_average_threshold=1.0

This value sets average CPU load (JVM SystemLoadAverage parameter) to CPU cores avalable ratio, including hyperthreading cores. When this value is exceeded, the Transcoder node is excluded from route elections for new stteams and profiles. In this case the Transcoder node is displayed in the stream route PROFILE section for profiles the stream is already transcoded by.

This parameter should be set on Transcoder nodes.

Node current state (if node participates in new stream route elections) can be checked with REST API.

Node state checking with REST API

To check node state REST API query /cdn/show_nodes is used

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

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

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/show_nodes - REST query used

REST queries and responses

REST query

REST query body example

REST response

Response states

Description

/cdn/show_nodes



Code Block
languagejs
themeRDark
[
    {
        "globalState": "ACTIVE", 
        "id": "192.168.1.64", 
        "processingState": "NEW_STREAMS_ALLOWED", 
        "role": "TRANSCODER"
    }, 
    {
        "globalState": "ACTIVE", 
        "id": "192.168.1.39", 
        "processingState": "NEW_STREAMS_ALLOWED", 
        "role": "ORIGIN"
    }
]

200 – OK

500 – Internal Server Error

Show CDN nodes state

Parameters

Parameter name

Description

Example

globalState

Статус узла: ACTIVE или PASSIVE

ACTIVE

id

Адрес узла

192.168.1.64
processingState

Участвует ли узел в выборе маршрута для воспроизведения потоков:

NEW_STREAMS_ALLOWED - участвует

GROUP_CONNECTION_ALLOWED - не участвует

NEW_STREAMS_ALLOWED
roleРоль узла: ORIGIN, TRANSCODER или EDGE
ORIGIN

REST query /cdn/show_nodes may be sent to certain node, the node responds with all visible CDN nodes state excluding itself.

CDN nodes authentication

Nodes trying to connect to CDN can be authenticated by IP address. Node addresses allowed to connect to CDN should be set in the following parameter

...