Restart rtmp stream using ffmpeg and nginx-rtmp-module

This is my current rtmp configuration for localhost, everything works fine

  # Transcoding (ffmpeg needed)

   application big {

       live on;

   exec /usr/local/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -vcodec flv -acodec copy -f flv rtmp://localhost:1935/anotherapp/${name};

   }

application anotherapp {
       live on;
  }

This is what I'm trying to achieve.

  # Transcoding (ffmpeg needed)

   application big {

       live on;

   # rtmp://localhost:1935/$app/$name  -> Receive this address dynamically from outside, for example the address will be rtmp://142.204.134.93/red5app/12345
   # rtmp://localhost:1935/anotherapp/${name};  -> and create new stream on my server with the same name. 
   # So this will be the result:

   exec /usr/local/bin/ffmpeg -re -i  rtmp://142.204.134.93/red5app/12345 -vcodec flv -acodec copy -f flv rtmp://localhost:1935/anotherapp/12345;

   }

application anotherapp {
       live on;
  }

Thank you in advance.

+4
source share

Source: https://habr.com/ru/post/1548067/


All Articles