arut / nginx-rtmp-module

NGINX-based Media Streaming Server
http://nginx-rtmp.blogspot.com
BSD 2-Clause "Simplified" License
13.21k stars 3.49k forks source link

default application #1641

Open sugoidogo opened 2 years ago

sugoidogo commented 2 years ago

I'm sending a 60mbps stream to my home server and using ffmpeg on the server to compress it to 6mpbs for streaming sites as well as recording it to a file share. I would like to have a single block defining the recording and exec directives and another block for each streaming platform for relaying the compressed stream to them. This is what I have so far:

rtmp {
    server {
        listen 1935;
        live on;
        application / {
            ...
            exec_push ffmpeg
                -i rtmp://localhost/$app/$name
                ...
                -f flv rtmp://localhost/live/$app/$name;
        }
        application /live/twitch {
            push rtmp://live.twitch.tv/app/$name;
        }
        ... more applications for the various platforms we stream to
    }
}

This doesn't work because applications are not prefix based like http locations, and since they don't support patterns I don't know how I could accomplish this. I don't want to have the same block of config in every location, and have to edit every block if a change is needed. Is there a way to have a default block for arbitrary application names or can support for that be added?

sugoidogo commented 2 years ago

The other thing that would solve my issue is if I could set the upstream url and then include the default block, but that also seems to be missing from this module.

lovgrandma commented 1 year ago

Any progress? Looking for insight on how to set variable from return values on_publish