ffmpeg- Multiple Outputs in NGINX RTMP

0

I would like to compress down a live video and send it two different RTMP Server at once via ffmpeg without pushing it to two local outputs.

My Code looks like

    live on;
    meta copy;
    record off;
    sync 40ms;
    hls off; 
    allow play all;
    dash off;
    publish_notify on;
    wait_key on;

    # Down Compress
    exec_static ffmpeg -hide_banner -loglevel warning -i rtmp://localhost/inputstream -c:v libx264 -preset slow -c:a aac -c:a copy
    -b:v 3500k
    -bufsize 3500k
    -maxrate 3500k
    -rc-lookahead 30
    -f flv rtmp://localhost/livedebug 2>>/var/log/ffdebug.log;

}

if i add:

-f flv rtmp://localhost/livedebug -f rtmp://localhost/test2 >>/var/log/ffdebug.log;

my log for the second output stays empty

Deex

Posted 2020-01-13T04:40:49.937

Reputation: 65

Answers

2

The new command as pasted should fail to run since -f rtmp://localhost/test2 can't succeed. The 2nd -f also needs to be -f flv. In any case, for multiple outputs of a single encoder's output, you need to use the tee muxer.

ffmpeg -hide_banner -loglevel warning -i rtmp://localhost/inputstream
-map 0:v -map 1:a
-c:v libx264 -preset slow -c:a copy
-flags +global_header
-b:v 3500k
-bufsize 3500k
-maxrate 3500k
-rc-lookahead 30
-f tee
"[f=flv]rtmp://localhost/livedebug|[f=flv]rtmp://localhost/test2" 2>>/var/log/ffdebug.log;

Gyan

Posted 2020-01-13T04:40:49.937

Reputation: 21 016