/

Stream Name Aliasing


Stream name aliasing is enabled by default. The stripTypePrefix is also important if RTMP-based ingest is used as it ensures that the Adobe media prefixing is stripped off of the stream name. If the prefix persists, WebRTC subscribers will fail since the : has a special use in JavaScript manipulation of media elements.

To supply one's aliases, they need only be passed as parameters on the RTMP URI like so (when not passed in a Provision):

ffmpeg -stream_loop -1 -re -i test.mp4 -c:v libx264 -b:v 2M -vprofile baseline -level 3.2 -x264-params keyint=30:min-keyint=20:scenecut=0:bframes=0:intra-refresh=0 -c:a aac -b:a 128k -ar 48000 -f flv "rtmp://127.0.0.1:1935/live/stream1?aliases=stream2,stream3,stream4"

This allows subscribers to request stream2, stream3, or stream4 instead of stream1.

To implement a publish alias, add nameAlias like so:

ffmpeg -stream_loop -1 -re -i test.mp4 -c:v libx264 -b:v 2M -vprofile baseline -level 3.2 -x264-params keyint=30:min-keyint=20:scenecut=0:bframes=0:intra-refresh=0 -c:a aac -b:a 128k -ar 48000 -f flv "rtmp://127.0.0.1:1935/live/stream1?nameAlias=streamP&aliases=stream2,stream3,stream4"

Configuration

To configure Red5 Pro to perform aliasing for stream names, modify the red5-common.xml file and this bean:

    <bean id="streamService" class="org.red5.server.stream.StreamService">
        <property name="stripTypePrefix" value="true"/>
        <property name="nameAliasingEnabled" value="true"/>
    </bean>

Provision

Using a provision to configure aliasing looks like this:

{
  "provisions": [
    {
      "guid": "live/stream1",
      "context": "live",
      "name": "stream1",
      "nameAlias": "streamA",
      "level": 0,
      "isRestricted": false,
      "parameters": {},
      "restrictions": [],
      "primaries": [],
      "secondaries": [],
      "aliases": [
        "streamB",
        "streamC",
        "streamD"
      ]
    }
  ]
}

Using the same key names as with RTMP ingest - nameAlias and aliases.