Versions Compared

Key

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

...

Since build 5.2.1896 it is possible to collect a certain stream metrics data

FieldTypeDescription
timestampUInt64Time stamp
ipIPv4Server address
mediaSessionIdStringMedia session Id
streamNameStringStream name
videoProfileIdUInt32Video profile Id
videoWidthUInt32Pictiure height
videoHeightUInt32Picture width
videoFrameRateUInt32Video frame rate per second
videoKframesUInt64Key frames number (I-frame)
videoPframesUInt64P-frames number
videoBframesUInt64B-frames number
videoRateUInt64Video bitrate, bps
audioRateUInt64Audio bitrate, bps
videoSyncTimeUInt64Video synchronization value
audioSyncTimeUInt64Audio synchronization value
videoTimestampUInt64Video packet timestamp
audioTimestampUInt64Audio packet timestamp
lastKeyFrameSyncTimeUInt64Video synchronization value from the last key frame
sendNACKUInt64NACK sent count
recvNACKUInt64NACK received count
videoFramesLostUInt64Lost video frames count
audioPacketsLostUInt64Lost audio frames count
audioPlaybackSpeedFloat32Audio publishing/playback speed
videoPlaybackSpeedFloat32Video publishing/playback speed

HLS stream data (table HlsStreamEvents)

Since build 5.2.1917 it is possible to collect a certain HLS stream events data

FieldTypeDescription
timestampUInt64Time stamp
ipIPv4Server address
severityUInt8Event severity level: INFO, WARNING, ERROR
messageTypeUInt16Event type
streamIdStringHLS stream Id
variantNameStringQuality variant name
segmentIdStringHLS segment Id
messageStringLogged event description

HLS segments data (table HlsSegmenterEvents)

Since build 5.2.1917 it is possible to collect a certain HLS stream segments data

FieldTypeDescription
timestampUInt64Time stamp
ipIPv4Server address
streamIdStringHLS stream Id
variantNameStringQuality variant name
segmentIdStringSegment Id
segmentStartPtsUInt64Segment start PTS
videoStartPtsUInt64Video start PTS
audioStartPtsUInt64Audio start PTS
videoWidthUInt32Picture width
videoHeightUInt32Picture height
videoFrameCountUInt32Video frames count
audioPacketCountUInt32Audio packets count
segmentDurationUInt64Segment duration, ms
independentBoolIndependent segment
gapBoolGAP segment
discontinuityBoolDISCONTINUTY segment
segmentIntervalUInt64Segments interval, ms
partialBoolPartial segment
playbackSpeedFloat32Playback speed

HLS subscribers data (table HlsClientEvents)

Since build 5.2.1929 it is possible to collect a certain HLS stream subscribers data

FieldTypeDescription
creationTimeUInt64Subscriber creation time (a first request)
responseTimeUInt64Subscriber response time
streamIdStringHLS stream Id
variantNameStringQuality variant name
uriStringPlaylist URI
localIpIPv4Server address
remoteIpIPv4Client address
remotePortUInt32Client port
userAgentStringUser-Agent data
httpStatusUInt32Response status
clientIdUInt64Client session Id

Mixer metrics data (table MixerEvent)

Since build 5.2.1923 it is possible to collect a certain mixer metrics data

FieldTypeDescription
timestampUInt64Time stamp
mixerMediaSessionIdStringMixer media session Id
mixerStreamNameStringMixer output stream name
mediaSessionIdStringIncoming stream media session Id
streamNameStringIncoming stream name
mixerAverageTickTimeInMsInt64Mixer tick average duration, ms
audioMixerSyncInt64Mixer output stream audio synchronization value
videoMixerSyncInt64Mixer output stream audio synchronization value
nextAudioDataTimeInt64Next audio packet time
nextVideoDataTimeInt64Next video packet time
audioBufferedInt64Incoming stream audio packets buffered count
videoBufferedInt64Incoming stream video packets buffered count
audioDropsCounterInt64Incoming stream audio packets dropped count
audioDropsSizeInBytesInt64Incoming stream audio dropped data in bytes
videoDropsCounterInt64Incoming stream video packets dropped count
videoDropsSizeInBytesInt64Incoming stream video dropped data in bytes
videoFpsInt64Mixer output stream framerate per second
audioRateDOUBLEMixer output stream audio bitrate, bps
videoRateDOUBLEMixer output stream audio bitrate, bps
eventTypeUInt32Mixer event type
eventPayloadStringEvent description

Incoming audio recovery data (table AudioRecoveryEvent)

Since build 5.2.1969 it is possible to collect a certain stream audio recovery data

FieldTypeDescription
timestampUInt64Time stamp
mediaSessionIdStringMedia session Id
typeUInt32Event type
rtpTimestampUInt64RTP stream timestamp

RTMP incoming streams buffer metrics data (table RtmpInBufferEvent)

Since build 5.2.1978 it is possible to collect a certain incoming RTMP stream buffer metrics data

FieldTypeDescription
timestampUInt64Time stamp
streamClockTimeUInt64Stream clock time
mediaSessionIdStringMedia session Id
streamNameStringStream name
nextAudioDataTimeInt64Next audio data packet time
nextVideoDataTimeInt64Next video data packet time
audioBufferedInt64Audio packets buffered count
videoBufferedInt64Video packets buffered count
maximumAllowedBufferInt64Maximum packet allowed in the buffer
bufferingCounterInt64Bufferings counter
lastAudioDataTimeInt64Last audio data packet time
lastVideoDataTimeInt64Last video data packet time
bufferStateUInt32Buffer state

Configuration

ClickHouse installation and setup

...

CONNECTION, STREAM, CDN, MEDIA_SESSION, HLS_SEGMENTER, HLS_STREAM, HLS_CLIENT, MIXER, AUDIO_RECOVERY, RTMP_IN_BUFFER

TypeDescription
CONNECTIONClient session events
STREAMStream events
CDNCDN events
MEDIA_SESSIONStream metrics
HLS_SEGMENTERHLS stream segment metrics
HLS_STREAMHLS stream events
HLS_CLIENTHLS clients statistics
MIXERMixer events and metrics
AUDIO_RECOVERYAudio packets recovery events
RTMP_IN_BUFFERRTMP incoming streams buffer metrics

ClickHouse server, database address and protocol are set by the following parameters

...

Code Block
themeRDark
reload node-settings

Data collection management using REST API

The data of CONNECTION, STREAM, CDN, HLS_STREAM types are always collected, for all the client sessions and all the streams. All the other types are collected on demand only because a data amount may be too big.

The data collection for a certain stream is enabled by REST API.

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

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

Здесь:

  • streaming.flashphoner.com - WCS server address
  • 8081 - the standard REST / HTTP port of the WCS server
  • 8444 - the standard HTTPS port
  • rest-api - the required part of the URL
  • /rels/startup - REST-method to use

REST methods and responses

/rels/startup

Start data collectio of a certain type for the certain streams

Request example

Code Block
languagejs
themeRDark
POST /rest-api/rels/startup HTTP/1.1
Host: localhost:8081
Content-Type: application/json

{
    "mediaSession": {
        "frequency":100,
        "ids": [
            "d7d6b6e4-b137-461a-8a32-d6abf2b8666e",
            "39cbf770-128a-11ef-b839-d1a1f53f8bd2"
        ] 
    }
}

Response example

Code Block
languagejs
themeRDark
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json

Return codes

CodeReason
200OK
400Bad request
404Not found
500Internal server error

/rels/find_all

Get the sent data statistics

Request example

Code Block
languagejs
themeRDark
POST /rest-api/rels/find_all HTTP/1.1
Host: localhost:8081
Content-Type: application/json

Response example

Code Block
languagejs
themeRDark
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json

[
  {
    "type": "CONNECTION",
    "sentBytes": 1989,
    "bitrateKbps": 0,
    "sentEvents": 6,
    "queueEvents": 0
  },
  {
    "type": "STREAM",
    "sentBytes": 70766,
    "bitrateKbps": 0,
    "sentEvents": 73,
    "queueEvents": 1
  },
  {
    "type": "CDN",
    "sentBytes": 0,
    "bitrateKbps": 0,
    "sentEvents": 0,
    "queueEvents": 0
  },
  {
    "type": "MEDIA_SESSION",
    "ids": [
      "d7d6b6e4-b137-461a-8a32-d6abf2b8666e",
      "39cbf770-128a-11ef-b839-d1a1f53f8bd2"
    ],
    "sentBytes": 205794,
    "bitrateKbps": 143,
    "sentEvents": 999,
    "queueEvents": 119
  }
]

Return codes

CodeReason
200OK
404Not found
500Internal server error

/rels/terminate

Stop data collection of the certain type for the certain streams

Request example

Code Block
languagejs
themeRDark
POST /rest-api/rels/terminate HTTP/1.1
Host: localhost:8081
Content-Type: application/json

{
    "mediaSession": {
        "ids": [
            "d7d6b6e4-b137-461a-8a32-d6abf2b8666e"
        ] 
    }
}

Response example

Code Block
languagejs
themeRDark
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json

Return codes

CodeReason
200OK
400Bad request
404Not found
500Internal server error

/rels/terminate_all

Stop the certain types data collection for all the streams

Request example

Code Block
languagejs
themeRDark
POST /rest-api/rels/terminate_all HTTP/1.1
Host: localhost:8081
Content-Type: application/json

{
    "types": [
        "MEDIA_SESSION"
    ]
}

Response example

Code Block
languagejs
themeRDark
HTTP/1.1 200 OK
Access-Control-Allow-Origin: *
Content-Type: application/json

{
  "MEDIA_SESSION": [
    "39cbf770-128a-11ef-b839-d1a1f53f8bd2"
  ]
}

Return codes

CodeReason
200OK
400Bad request
404Not found
500Internal server error

Parameters

ParameterDescriptionExample
mediaSessionMEDIA_SESSION data collection descriptor object"mediaSession": {"frequency":100, "ids":["12345678-0000-1111"]} 
frequencydata collection frequency in ms100
idsMedissesson identifiers list for the streams which data should be collected["12345678-0000-1111","12345678-3333-4444"]
hlsSegmenterHLS_SEGMENTER data collection descriptor object"hlsSegmenter": {"ids":["stream1"]}
hlsClientHLS_CLIENT data collection descriptor object"hlsClient": {"ids":["stream1"]}
mixerMIXER data collection descriptor object"mixer": {"ids":["12345678-5555-6666"]}
audioRecoveryAUDIO_RECOVERY data collection descriptor object"audioRecovery": {"ids":["12345678-7777-8888"]}
rtmpInBufferRTMP_IN_BUFFER data collection descriptor object"rtmpInBuffer": {"ids":["12345678-9999-AAAA"]}

Data retrieving from DB

Logging data can be retrieved usin SQL queries in CliskHouse client

...