nginxffmpegwebrtcrtmpjanus-gateway

How to send RTP stream to Janus from NGINX RTMP module?


I'm trying to create a stream and display it in a browser. I have already configured NGINX with the rtmp module and my stream works very well with HLS (between 5 and 10 seconds of latency).

Now I would like to set up a low-latency stream and that's why I have installed the janus-gateway webRTC server that allows to take in input an RTP stream and provide in output a webRTC stream.

Here's the schema I'd like to follow :

OBS -> RTMP -> Nginx-rtmp-module -> ffmpeg -> RTP -> Janus -> webRTC -> Browser

But I have a problem with this part : "nginx-rtmp-module -> ffmpeg -> janus"

In fact, my janus's server is running and demos streaming works very well in localhost, but when i try to provide an RTP stream, Janus don't detect the stream in the demos (it shows "No remote video available").

Anyone can help me, please ?

Ressources :

rtp-sample: {
        type = "rtp"
        id = 1
        description = "Opus/VP8 live stream coming from external source"
        metadata = "You can use this metadata section to put any info you want!"
        audio = true
        video = true
        audioport = 5002
        audiopt = 111
        audiortpmap = "opus/48000/2"
        videoport = 5004
        videopt = 100
        videortpmap = "VP8/90000"
        secret = "adminpwd"
}

application test {

        deny play all;

        live on;
        on_publish http://localhost/test/backend/sec/live_auth.php;

        exec ffmpeg -i rtmp://localhost/test/$name -an -c:v copy -flags global_header -bsf dump_extra -f rtp rtp://localhost:5004;

}

Solution

  • I finally solved this problem with the following command :

    sudo ffmpeg -y -i "rtmp://127.0.0.1/app/stream" -c:v libx264 -profile:v main -s 1920x1080 -an -preset ultrafast -tune zerolatency -g 50 -f rtp rtp://127.0.0.1:5004
    

    Unfortunately, when I use -c:v copy, it doesn't work. It only works when encoding with libx264 which adds latency and I got between 3 and 4 seconds of latency.

    However, when I installed Janus, my goal was to do better than with HLS, protocol with which I reach 2.5 seconds of latency.

    So Janus did not meet my need. Moreover I was warned that it was not a stream server. After some research I came across Github on the Oven Media Engine project, a stream server that offers a latency of less than 1s. The documentation is complete on the dedicated site and a player (Oven Media Player) adapted to this server is available under MIT license. The server is under GPLv2 license.

    Here is the current schema of my architecture :

    OBS -> Nginx (which allows to allow streaming with on_publish, because OME doesn't allow it yet. The stream is then pushed to the OME server) -> OME -> Transcoding in different bitrate and resolution (optional) -> OME -> Edge OME (optional) -> player.

    If you have any questions, don't hesitate, the support is very friendly !

    Hope it helps