Static pull feature in nginx-rtmp

Currently implemented pull/push relays are dynamic. They are created dynamically when there’s at least one RTMP client playing/publishing the stream. That’s useful for saving network bandwidth and handling undefined set of streams. However this implementation suffers from several problems

  • HLS is not generated until there’s at least one RTMP client playing the pulled stream
  • In multi-worker mode each worker pulls its own stream from remote server
  • In multi-worker mode recording pulled stream and generating HLS from such stream leads to conflict between workers writing the same files

I’ve been asked many times to solve that, especially HLS/pull. That’s hardly possible with dynamic relays. However not many people really need that kind of relays. In many cases It’d be enough to have static relays activated at nginx start with no dependence on RTMP clients. With static relays all above mentioned problems can easily be solved.

Static pulls are implemented in static-relay branch. To create one you need to add static keyword to pull directive argument list.

pull rtmp:// pageUrl=ABC name=mystream static;

Such stream is started at nginx start and restarted on stream error. There’s new pull_reconnect directive setting restart timeout. Unlike earlier you cannot omit stream name when creating static pull.

This feature will be later merged into master. I’m waiting for your feedback until then.

  1. #1 by soon on January 22, 2013 - 8:08 am

    after install it work and can restream, If play video on ipad long time maybe audio not sync but refresh it come back ok. and I listen some noise on IPAD2 but not have on flashplayer.

    • #2 by rarut on January 22, 2013 - 8:47 am

      to fix crackling noise in HLS use hls_sync directive:
      hls_sync 300ms;

  2. #3 by soon on January 22, 2013 - 4:39 pm

    thank you

  3. #4 by Ophelia on May 15, 2013 - 10:44 am

    An additional advantage of this product is its cost.

  4. #5 by KK on June 14, 2014 - 12:37 am

    is it possible to pull an HLS stream and restream that to multiple users as rtmp stream?

    • #6 by rarut on June 15, 2014 - 9:26 am

      You can pull any stream with ffmpeg (incl. HLS) and restream it as RTMP.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: