The original post: /r/nginx by /u/ThibauDefi on 2024-07-29 09:52:14.

Can you help me configuring my Nginx RTMP server and/or the FFMPEG transcoding settings

I made a IRL backpack for streaming which works as follow :

  1. GoPro stream via wifi h264 to local hotspot >
  2. Local hotspot host on Raspberry with local Nginx RTMP server >
  3. Raspberry bonding 4 cellular connection >
  4. Raspberry RTMP with ffmpeg push to remote Nginx RTMP >
  5. OBS on home computer read remote Nginx RTMP and stream to Twitch.

Works great until my connection drops a little bit, then the stream drops frames and audio cut with dropped frames. Unfortunately I have to restart the Rasp Nginx and gopro streaming to make it back to normal. You can see on this video at 24min : https://www.twitch.tv/videos/2207900898?t=00h24m09s

Is there any way to increase stability even if it must create delay in the live streaming ? Or at least make it come back to normal when network come back to normal ? (like a resync or something else ?)

Thanks you so much for any help !

I tried to find information on FFMPEG or RTMP about this kind of problem but without any success…

— RTMP CONFIG

local (Raspberry - RaspbianOS) Nginx rtmp.conf:

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application push {
            live on;
            record off;
            publish_notify on;
            drop_idle_publisher 10s;
            exec ffmpeg
                -re -hide_banner
                -i rtmp://127.0.0.1:1935/push/$name
                -c:v copy
                -c:a copy
                -f flv rtmp://remote.rtmp.address:1935/push/$name;
        }
    }
}

remote (VPS - Ubuntu) Nginx rtmp.conf :

rtmp_auto_push on;
rtmp_auto_push_reconnect 1s;
rtmp {
    server {
        listen 1935;
        chunk_size 4096;

        application push {
            live on;
            record off;
            publish_notify on;
            play_restart on;
            drop_idle_publisher 10s;
        }
    }
}