Versions Compared

Key

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

...

Since WCS build 5.2.1193 it is possible to publish MPEG-TS RTP stream via UDP to WCS. The feature can be used to publish H264+AAC stream from software or hardware encoder supporting MPEG-TS.

Codecs supported

  • H264
  • AAC

Operation flowchart

1. Publisher sends REST API query /mpegts/startup 

...

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

Where:

  • test.flashphoner.com - is the address of the WCS server
  • 8081 - is the standard REST / HTTP port of the WCS server
  • 8444 - is the standard HTTPS port
  • rest-api - is the required part of the URL
  • /mpegts/startup - REST mathod to use

REST methods and response states

REST method

REST query body example

REST response body example

Response states

Description

/mpegts/startup

Code Block
languagejs
themeRDark
{
  "localStreamName":"test"
}
Code Block
languagejs
themeRDark
{
  "localMediaSessionId": "32ec1a8e-7df4-4484-9a95-e7eddc45c508",
  "localStreamName": "test",
  "uri": "udp://192.168.1.39:31006",
  "status": "CONNECTED",
  "hasAudio": true,
  "hasVideo": true,
  "record": false,
  "timeout": 90000,
  "maxTimestampDiff": 90000
}

200 - OK

409 - Conflict

500 - Internal error


Start MPEG-TS publishing


/mpegts/find
Code Block
languagejs
themeRDark
{
  "localStreamName":"test",
  "uri": "udp://192.168.1.39:31006"
}
Code Block
languagejs
themeRDark
[
 {
  "localMediaSessionId": "32ec1a8e-7df4-4484-9a95-e7eddc45c508",
  "localStreamName": "test",
  "uri": "udp://192.168.1.39:31006",
  "status": "CONNECTED",
  "hasAudio": true,
  "hasVideo": true,
  "record": false,
  "timeout": 90000,
  "maxTimestampDiff": 90000
 }
]

200 – streams found

404 – streams not found

500 - Internal error

Find the MPEG-TS stream by criteria

/mpegts/find_all


Code Block
languagejs
themeRDark
[
 {
  "localMediaSessionId": "32ec1a8e-7df4-4484-9a95-e7eddc45c508",
  "localStreamName": "test",
  "uri": "udp://192.168.1.39:31006",
  "status": "CONNECTED",
  "hasAudio": true,
  "hasVideo": true,
  "record": false,
  "timeout": 90000,
  "maxTimestampDiff": 90000
 }
]

200 – streams found

404 – streams not found

500 - Internal error

Find all MPEG-TS streams

/mpegts/terminate

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

200 - stream stopped

404 - stream not found

500 - Internal error

Stop MPEG-TS stream

Parameters

Name

Description

Example

localStreamNameName to set to the stream on servertest
uriEndpoint URI to publish the streamudp://192.168.1.39:31006
localMediaSessionIdStream media session Id32ec1a8e-7df4-4484-9a95-e7eddc45c508
statusStream statusCONNECTED
hasAudioStream has audio tracktrue
hasVideoStream has video tracktrue
recordStream is recordingfalse
timeoutMaximum media data receiving timeout, ms90000
maxTimestampDiffMaximum stream timestamps difference, ms90000

Known issues

1. When MPEG-TS stream publishing via UDP is stopped at server side via REST API query /mpegts/terminate , publishing encoder still sends media data

...

Solution: this is normal behaviour for UDP because the protocol itself provides no any methods to let publisher know the UDP port is already closed