...
Parameter | Values available | Description |
---|---|---|
Audio parameters | ||
codec | opus mpeg4-generic speex ulaw | Audio codec to use |
bitrate | Depends on quality required and bandwidth available | Audio bitrate, bps |
rate | 8000 11025 12000 16000 22050 24000 32000 44100 48000 | Audio sample rate, kHz |
channels | 1 2 | Audio channels number |
Video parameters | ||
codec | h264 mpv vp8 | Video codec to use |
bitrate | Depends on quality required and bandwidth available | Video bitrate, kbps |
width | Depends on quality required and bandwidth available | Picture width |
height | Depends on quality required and bandwidth available | Picture height |
codeImpl | FF OPENH264 | Video codec used, FF by default |
gop | Depends on quality required and bandwidth available | Key frames frequency (GOP) |
fps | Depends on quality required and bandwidth available | Frames frequency per second |
quality | Depends on quality required and bandwidth available | Video quality |
preset | ultrafast superfast veryfast faster fast medium slow slower veryslow placebo | FF preset, ultrafast by default |
profile | 66 (Baseline) 77 (Main) 88 (Extended) 100 (High) | FF profile, 66 (Baseline) by default |
level | Depends on required quality | FF level, 3.1 by default |
...
The settings above should be applied to Transcoder nodes.
Transcoding profile management using REST API
The specific REST API is used to manage transcoding profiles on the fly, without server restart
REST query should be HTTP/HTTPS POST request as follows:
...
Multi channels audio support
Since build 5.2.773, audio transcoding by profile with certain number of channels (1 - mono, 2 - stereo) is supported
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
-240p:
audio:
codec : mpeg4-generic
rate : 48000
channels: 1
video:
height : 240
bitrate : 300
gop : 50
codec : h264 |
A channels number in a profile should be equal to channels number in original audio track for subscriber on Edge server to play stereo sound when stream with stereo sound is published, i.e.
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
-240p:
audio:
codec : mpeg4-generic
rate : 48000
channels: 2 |
If profile codec, samplerate and channels number are equal to original audio track parameters, the track will be passed to Edge server without transcoding
Transcoding profile management using REST API
The specific REST API is used to manage transcoding profiles on the fly, without server restart
REST query should be HTTP/HTTPS POST request as follows:
- HTTP: http://test.flashphoner.com:8081/rest-api/cdn/profile/print
- HTTPS: https://test.flashphoner.com:8444/rest-api/cdn/profile/print
...
Parameter name | Description | Example |
---|---|---|
globalState | Node state: ACTIVE or PASSIVE | ACTIVE |
id | Node address | 192.168.1.64 |
processingState, state | If this node participates in stream playback route elections: NEW_STREAMS_ALLOWED - participates CONNECTION_ALLOWED - participatesallows to pull already decoded streams by new profiles GROUP_CONNECTION_ALLOWED - not participates | NEW_STREAMS_ALLOWED |
role | Node role: ORIGIN, TRANSCODER or EDGE | ORIGIN |
...
Current CDN node state is defined as follows in priority order:
1. If there is a value enforced by /cdn/cdn/enforce_state REST query, state will be set to this value.
2. If CPU load threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
3. If video encoders threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
4. If no limits are reached, state will be set to NEW_STREAMS_ALLOWED.CDN node broadcasts its state to another nodes periodically, using the interval set in milliseconds with the folowing parameterenforce_state REST query, state will be set to this value.
2. If CPU load threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
3. If video encoders threshold is reached, state will be set to GROUP_CONNECTIONS_ALLOWED.
4. If no limits are reached, state will be set to NEW_STREAMS_ALLOWED.
CDN node broadcasts its state to another nodes periodically, using the interval set in milliseconds with the folowing parameter
Code Block | ||
---|---|---|
| ||
cdn_nodes_state_refresh_interval=60000 |
By default, this interval is 60 seconds. It is recommended to reduce this parameter to 1 second for Transcoder nodes to distribute the streams to another nodes.
Transcoder threshold reached state setup
Since build 5.2.640 Transcoder node threshold reached state can be set with the following parameter, GROUP_CONNECTIONS_ALLOWED by default
Code Block | ||
---|---|---|
| ||
cdn_transcoder_threshold_state=GROUP_CONNECTIONS_ALLOWED |
To prevent stream spreading over CDN, Transcoder node can be switched to CONNECTIONS_ALLOWED state if necessary
Code Block | ||
---|---|---|
| ||
cdn_transcoder_nodesthreshold_state_refresh_interval=60000 |
...
=CONNECTIONS_ALLOWED |
In this state, Transcoder node allows to pull streams which are already decoded on, including new encoding profiles. For example, if some Transcoder node decodes test stream by 360p profile, and som of Edge servers requests test240p stream, playback route will be built via the same Transcoder node.
This parameter should be set on Transcoder nodes.
CDN nodes authentication
...
Code Block | ||||
---|---|---|---|---|
| ||||
profiles: -240p: audio: codec : opus rate : 48000 video: height : 240 bitrate : 400 gop : 50 fps : 25 codec : h264 codecImpl : OPENH264 |
2. Encoding quality settings cannot be applied if OpenH264 is used
Symptoms: picture quality is not changing when using different quality
values in transcoding profile
Solution: do not use OpenH264 encoder because it does not support CRF
Code Block | ||||
---|---|---|---|---|
| ||||
profiles:
-240p:
audio:
...
video:
...
quality: 10
codecImpl : FF |