This article describes the Live Streaming protocols supported by StackCDN.
Live Streaming is the relay of live video over the CDN so that it can be played from a node closest to the viewer

StackCDN supports several distinct methods to deliver live video. The following formats are supported

  • RTMP – Real Time Messaging Protocol
  • RTSP – Real Time Streaming Protocol
  • HLS – HTTP Live Streaming
  • HDS – HTTP Dynamic Streaming
  • MPEG-DASH – Dynamic Adaptive Streaming over HTTP
  • MSS – Microsoft Smooth Streaming

For best results use H.264 video codec and AAC audio codec, other codecs will not work with all formats

These methods are described in detail below

Publishing

This mode will cache pre-segmented HLS, HDS, DASH or MSS video from your origin server

This mode is very similar to regular Object Storage in that it will cache the video segments from your origin via HTTP. Where it differs is that it will only cache the playlist files for a short amount of time, since they are always changing (adding new segments) for live video.

Any file matching the following will be subjected to the short cache time

  • *.m3u8
  • *.mpd
  • *.f4m
  • *.abst
  • Manifest

To use this mode, create a HTTP Live Zone in HTTP Origin Mode

Once created you should tune the HTTP Live Expiry setting to match the duration of each video segment so that playlists get updated/re-cached at the correct rate

You can now play your live HTTP video through the CDN, e.g:

original playlist url: http://live.yourdomain.com/live/yourstream/playlist.m3u8
live zone name: cdn-live.yourdomain.com
live zone origin: http://cdn-live.yourdomain.com
cdn playlist url: http://cdn-live.yourdomain.com/live/yourstream/playlist.m3u8
cdn playlist url (without cname): http://<account-id>-<hash>.c.stackcdn.io/cdn-live.yourdomain.com/live/yourstream/playlist.m3u8

If you are using your own Wowza server as your origin you must set the application type to be “Live HTTP Origin”

This mode will allow RTMP to be pushed to our Nginx instances

This is the preferred method of RTMP push if you only need to play via RTMP and/or RTSP and/or HLS and/or MPEG-DASH. This is because it is much more efficient and can provide a more real-time viewing experience than Wowza can.

It can only transmux to HLS, DASH and RTSP, not the other HTTP formats. However the HLS and DASH segment time is tunable (where it is fixed in Wowza), so can be set as low as 1 second for more real-time viewing.

To use this mode, create a new (or use an existing) Real-Time Live Zone

You can now push RTMP to Nginx using the following details

server: rtmp://cdn.stackcdn.io

port: 1935

application: live

stream: yourlivezone_yourstreamname

rtmp push full url: rtmp://cdn.stackcdn.io/live/mylivezone_mystreamname

To tune the playlist segments length and duration, use one of the following application names instead

live: RTMP only, no transmuxing

live_1_3: segment: 1s duration: 3s

live_1_6: segment: 1s duration: 6s

live_2_6: segment: 2s duration: 6s

live_2_12: segment: 2s duration: 12s

live_3_9: segment: 3s duration: 9s

live_3_18: segment: 3s duration: 18s

live_4_12: segment: 4s duration: 12s

live_4_16: segment: 4s duration: 16s

live_4_24: segment: 4s duration: 24s

live_5_15: segment: 5s duration: 15s

live_5_30: segment: 5s duration: 30s

live_10_30: segment: 10s duration: 30s

live_10_60: segment: 10s duration: 60s

live_20_60: segment: 20s duration: 60s

live_20_120: segment: 20s duration: 120s

For best results, set the video keyframe interval to a multiple of the segment length in video encoding settings

Note: when playing, always use ‘live’ application regardless of which application was used for the push

The mode will allow you to push RTMP or RTSP streams to our Wowza instances

If you only need to play via RTMP and/or RTSP and/or HLS and/or DASH, push to Nginx instead. However if you need HDS and/or MSS then push to Wowza.

To use this mode, create a new (or use an existing) Real-Time Live Zone

You can now push RTMP or RTSP to Wowza using the following details

server: rtmp|rtsp://wowza.cdn.stackcdn.io

port: rtmp: 1935 rtsp: 554

application: live

stream: yourlivezone_yourstreamname

rtmp push url: rtmp://wowza.cdn.stackcdn.io/live/mylivezone_mystreamname

rtsp push url: rtsp://wowza.cdn.stackcdn.io/live/mylivezone_mystreamname

This mode will pull an existing RTMP or RTSP stream from another server

Follow Live Streaming Pull Streams

Playing

To play an RTMP or RTSP stream from an push or pull use the following

RTMP Play

server: rtmp://cdn.stackcdn.io

port: 1935

application: live / live-npn / live-npr / live-npn-npr

stream: yourlivezone_yourstreamname

play full url: rtmp://cdn.stackcdn.io/live/yourlivezone_yourstreamname

The default application of /live/ will send the RTMP events NetStream.Play.PublishNotify, NetStream.Play.UnpublishNotify, and NetStream.Play.Start and NetStream.Play.Stop to each subscriber every time publisher starts or stops publishing

If you do not want your clients to receive these events, then set them to play from one of these applications instead:
live-npn: does not send NetStream.Play.PublishNotify or NetStream.Play.UnpublishNotify
live-npr: does not send NetStream.Play.Start or NetStream.Play.Stop
live-npn-npr: does not send any of the above events

RTSP Play

server: rtsp://wowza.cdn.stackcdn.io

port: 554

application: live

stream: yourlivezone_yourstreamname

play full url: rtsp://cdn.stackcdn.io/live/yourlivezone_yourstreamname

Please note that RTMP is always played from cdn.stackcdn.io (Nginx) and RTSP is always played from wowza.cdn.stackcdn.io – regardless of which was used for the push/pull

This mode will convert streams which were pushed or pulled via RTMP or RTSP into httplive/playlist type streams

If Nginx was used for the push then HLS and DASH are available

If Wowza was used for the push or pull then HLS, HDS, DASH, MS Smooth are available

Follow this guide to Create a Transmuxing Live Zone

Note: a single Transmuxing Zone can be used for multiple Real-Time zones and streams, however you may create more if different settings are needed. The owner of the Real-Time Zone and the Transmuxing Zone must match, this is to prevent users from viewing other users’ streams.

Once the Transmuxing Zone has been created, use the following URL formats to access the transmuxed streams

HLS: http://transmux.yoursite.com/yourlivezone_yourstreamname/index.m3u8

HDS: http://transmux.yoursite.com/yourlivezone_yourstreamname/manifest.f4m

MPEG-DASH (via nginx): http://transmux.yoursite.com/yourlivezone_yourstreamname/index.mpd

MPEG-DASH (via wowza): http://transmux.yoursite.com/yourlivezone_yourstreamname/manifest.mpd

MSS: http://transmux.yoursite.com/yourlivezone_yourstreamname/Manifest

Leave a Reply

Your email address will not be published. Required fields are marked *