2.11 RTMP

2.11.1 URI format

Usually, RTMP URI is set by two parts: server URI and stream id (or stream key). But some apps support combined URI, which includes both parts concatenated via slash. VASTreaming library supports only combined URI format.

Example of separate server URI / stream id format:

Server URI: rtmp://a.rtmp.youtube.com/live2
Stream id: blah-blah-blah

Combined RTMP URI format is the following:

rtmp://<server-name>[:<server-port>]/<application>/<stream-id>[?<stream-parameters>]

where <server-name> is IP address or domain name of a server,

<server-port> can be skipped if it uses default RTMP port 1935,

<application> is a virtual entity of RTMP protocol, usually, it is a part of server URI,

<stream-id> is a unique stream identifier,

<stream-parameters> - an optional list of parameters of a stream.

Since RTMP standard does not explicitly divide definitions of application and stream ID in URI, collisions may occur in case of working with some third-party servers. Some third-party servers also require parameters for both application and stream id. In order to solve this problem, VASTreaming library supports extended RTMP URI format.

Beware that below format is specific to VASTreaming library only!

Extended RTMP URI format is the following:

rtmp://<server-name>[:<server-port>]/<application>[?<server-parameters>]|<stream-id>[?<stream-parameters>] 

So, <server-parameters> and <stream-parameters> can be set independently.

Note that server URI and stream id are divided by | character (vertical bar).



2.11.2 URI parameters

While connecting external server, there is a possibility to set several parameters to tune VASTreaming library. These parameters are not propagated to external server. If original URI does not contain parameter string, format of URI is as follows:

rtmp://<server-name>[:<server-port>]/<application>/<stream-id>?<vast-parameter-name1>=<vast-parameter-value1>&<vast-parameter-name2>=<vast-parameter-value2>...

Example of original server URI:

rtmp://192.168.0.101/live/stream1

The same URI with VASTreaming library parameter:

rtmp://192.168.0.101/live/stream1?vast-enable-send-control=1

Format of URI if original URI already has parameter string:

rtmp://<server-name>[:<server-port>]/<application>/<stream-id>?<stream-parameters>&<vast-parameter-name1>=<vast-parameter-value1>&<vast-parameter-name2>=<vast-parameter-value2>...

Example of original server URI:

rtmp://192.168.0.101/live/stream1?resolution=hi

The same URI with VASTreaming library parameter:

rtmp://192.168.0.101/live/stream1?resolution=hi&vast-enable-send-control=1

The following internal parameters are supported (sorted in alphabetical order):

  • vast-adobe-compatible can be used to enable special compatibility mode with Adobe FMLE server. The parameter value can be 0 or 1. By default, this mode is disabled.
  • vast-enable-send-control can be used to enable or disable the mechanism of congestion control for data being sent. This mode ensures continuous working in case of temporary network problems. Value can be 0 or 1. By default, this mode is enabled.
  • vast-send-buffer-duration can be used to set up output buffer to smoothen uneven media data flow from a source. Accordingly, send buffer increases latency. By default, send buffer is disabled. Time scale of this value is 100 ns.
  • vast-verify-handshake can be used to disable verification of RTMP handshake because several third party RTMP peers provide invalid handshake. By default, handshake verification is enabled. Value is 0 or 1.


2.11.3 Classes

FlvSink implements IMediaSink and intended for writing a stream into a FLV file.

RtmpClientSource implements INetworkSource interface and intended for creating a source which pulls data from an RTMP server.

RtmpPublisherSink is an object implementing INetworkSink interface and intended for creating a sink which pushes data to an external RTMP server.

RtmpServer implements RTMP server protocol and can work both stand-alone and as a part of a multi-protocol streaming server.

RtmpServerParameters contains additional parameters for creating an RTMP server.

contact us

info@vastreaming.net