4

I'm trying to push a RTMP stream with the nginx-rtmp-module (set up after this manual) from one of its applications into another one. A minimal example of my config (nginx.conf) looks as following.

rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application live {
            live on;
            record off;

            push rtmp://localhost:1935/source/$name;
        }

        application source {
            live on;
            record off;
        }
    }
}

My streaming setup (with OBS) points the broadcast to example.com/live with the StreamKey ($name in nginx) jackbox. Now when trying to watch the stream in VLC, the URL rtmp://example.com/live/jackbox works, however rtmp://example.com/source/jackbox doesn't. Am I misunderstanding what push is supposed to do, or is there any other problem?

If anyone needs more information about the setup, please feel free to ask.

RikuXan
  • 336

2 Answers2

6

you can watch it if you put into vlc exactly this: "rtmp://example.com/source/$name". if you want to use $name as variable, you need to remove it from rtmp push completely, so your setup will look like this:

rtmp {
server {
    listen 1935;
    chunk_size 4096;

    application live {
        live on;
        record off;

        push rtmp://localhost:1935/source/;
    }

    application source {
        live on;
        record off;
    }
}
}
Johny Host
  • 76
  • 1
  • 3
0

There's an alternative implementation that allows you to change the stream name more explicitly, using FFmpeg:

ffmpeg -re -i rtmp://example.com/live/jackbox -c copy \
  -f flv rtmp://example.com/source/jackbox

You'll need to configure two separate apps first:

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
    application live {
        live on;
        record off;
    }

    application source {
        live on;
        record off;
    }
}

}

The advantages of this approach are:

  1. You can specify stream names more clearly, allowing you to forward only certain streams.
  2. You can forward multiple different streams and send them to multiple different servers.
  3. You can transcode high bitrate streams.

If you find FFmpeg too challenging, you can use SRS Stack instead of FFmpeg, combined with Nginx. You can refer to bellow guides for more information:

SRS Stack is an open-source solution that offers a web-based user interface, making it easy and user-friendly to operate.

Winlin
  • 101