Versions Compared

Key

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

Table of Contents

The cases when transcoding is enabled

Video stream transcoding will be enabled automatically in one of the following cases:

1. Streamer and player codecs do not match by name.
For example, streamer publishes H.264 stream and player tries to play VP8.

2. H.264 codecs are differ by packetization-mode parameter
For example, streamer publishes stream with packetization-mode=1 (default value) and player explicitly sets packetization-mode=0. The situation is quite rare, because almost all  players support packetization-mode=1

3. Player resolution is explicitly set.
Example:

Code Block
languagejs
themeRDark
session.createStream({name:"stream1", constraints:{audio:true, video:{width:640,height:480}}}).play();

If the player explicitly sets the resolution desired, transcoding will be enabled even when the player resolution exactly matches the publisher one. This is done because WebRTC browser can change video resolution while publishing stream. To adapt the stream to the resolution that is specified by player, the stream should be transcoded.

4. Player bitrate is explicitly set.

Example

Code Block
languagejs
themeRDark
session.createStream({name:"stream1", constraints:{audio:true, video:{bitrate:300}}}).play();

In this case transcoder will be enabled to encode the stream to the bitrate specified.

Besides, transcoding can be forcibly enabled on server using this parameter in flashphoner.properties file

Code Block
languagebash
themeRDark
disable_streaming_proxy=true
Warning

Transcoding dramatically increases the server resources consumption (CPU cores). Therefore, use it carefully!

Force transcoding disabling

Transcoding may be fully disabled on server using this parameter in flashphoner.properties file

Code Block
languagebash
themeRDark
transcoding_disabled=true

If trascoding is forcefully disabled, in all four cases described above the TRANSCODING_REQUIRED_BUT_DISABLED error will be returned to client.

Transcoding disabling does not affects stream mixer, transcoding will be enabled automatically when mixer is used.

Transcoding management with REST API

REST query should be HTTP/HTTPS POST request as:

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

Where:

  • test.flashphoner.com is WCS server address
  • 8081 is a standard REST / HTTP port of  WCS server
  • 8444 is a standard HTTPS port
  • rest-api is mandatory URL prefix
  • /transcoder/startup is REST query

REST queries and response states

...

REST query

...

Request example

...

Response example

...

Response states

...

Description

...

/transcoder/startup

...

Code Block
languagejs
themeRDark
{
 "uri": "transcoder://tcode1",
 "remoteStreamName": "test",
 "localStreamName": "testT",
 "encoder": {
  "width": 640,
  "height": 480,
  "keyFrameInterval": 30,
  "fps": 30
 }
}

409 - Conflict

500 - Internal error

Create transcoder with defined parameters for certain stream

...

Code Block
languagejs
themeRDark
{
 "remoteStreamName": "test"
}

...

Code Block
languagejs
themeRDark
[
    {
        "localMediaSessionId": "42a92132-bcd1-4436-a96f-3fec36b32b37",
        "localStreamName": "testT",
        "remoteStreamName": "test",
        "uri": "transcoder://tcode1",
        "status": "PROCESSED_LOCAL",
        "hasAudio": true,
        "hasVideo": true,
        "record": false,
        "encoder": {
            "width": 640,
            "height": 480,
            "keyFrameInterval": 30,
            "fps": 30
        }
    }
]

...

200 – Transcoders found

404 – Transcoders not found

...

/transcoder/find_all

...

Code Block
languagejs
themeRDark
[
    {
        "localMediaSessionId": "42a92132-bcd1-4436-a96f-3fec36b32b37",
        "localStreamName": "testT",
        "remoteStreamName": "test",
        "uri": "transcoder://tcode1",
        "status": "PROCESSED_LOCAL",
        "hasAudio": true,
        "hasVideo": true,
        "record": false,
        "encoder": {
            "width": 640,
            "height": 480,
            "keyFrameInterval": 30,
            "fps": 30
        }
    }
]

200 – Transcoders found

404 – Transcoders not found

...

Find all transcoders

...

/transcoder/terminate

...

Code Block
languagejs
themeRDark
{
"uri":"transcoder://tcode1"
}

...

200 - Transcoders is terminated

404 - Transcoder not found

...

Stop transcoder and its output stream

Parameters

...

Name

...

Description

...

Example

...

uri

...

Transcoder URL

...

transcoder://tcode1

...

testT

...

test

...

42a92132-bcd1-4436-a96f-3fec36b32b37

...

status

...

Transcoder state

...

PROCESSED_LOCAL

...

true

...

true

...

false

...

640

...

480

...

30

...

30

...

500

...

OPENH264

Quick manual for testing

1. For test we use

  • WCS server;
  • Two Way Streaming web application to publish a stream;
  • Player web application to play an output stream;
  • Chrome browser with REST client to send REST queries to server

2. Open Two Way Streaming application and publish stream named test

Image Removed

3. Open REST client and send REST query /transcoder/startup

Image Removed

4. Open Player application, set testT to Stream field and click Start

Image Removed

5. Open REST client adn send REST query /transcoder/terminate

Image Removed

6. Playback will be stopped due to transcoder stop

Image Removed

Include Page
WCS5EN:Stream transcoding
WCS5EN:Stream transcoding