Send output to multiple destinations












0















I'm really new on ffmpeg and have a question where I cannot find a solution.
I really hope that somebody from you could help me with that.



On one server I receive a 1080p stream, with ffmpeg I create a new stream with multiple bitrates and resolution and send it afterwards to a rtmp destination on this server.
Below CL the command that I use at the moment and it is working.



ffmpeg -i - -copyts -muxdelay 0  -c:a libfaac -ab 128k 
-c:v libx264 -preset faster -profile:v main -level 3.1 -crf 20 -g 50 -b:v 1500k -s:v 1920x1080 -f flv rtmp://localhost/stream/output_stream
-c:a libfaac -ab 64k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 1000k -s:v 1280x720 -f flv rtmp://localhost/stream/output_stream
-c:a libfaac -ab 32k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 800k -s:v 960x540 -f flv rtmp://localhost/stream/output_stream


Now I have the challenge that I need to send it to multiple servers.
Is there anyway to add multiple outputs?



At the end the incoming 1080p stream should get multiple bitrates and should be send to around 10 different RTMP server.



I really hope that somebody can help me with that.










share|improve this question



























    0















    I'm really new on ffmpeg and have a question where I cannot find a solution.
    I really hope that somebody from you could help me with that.



    On one server I receive a 1080p stream, with ffmpeg I create a new stream with multiple bitrates and resolution and send it afterwards to a rtmp destination on this server.
    Below CL the command that I use at the moment and it is working.



    ffmpeg -i - -copyts -muxdelay 0  -c:a libfaac -ab 128k 
    -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 20 -g 50 -b:v 1500k -s:v 1920x1080 -f flv rtmp://localhost/stream/output_stream
    -c:a libfaac -ab 64k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 1000k -s:v 1280x720 -f flv rtmp://localhost/stream/output_stream
    -c:a libfaac -ab 32k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 800k -s:v 960x540 -f flv rtmp://localhost/stream/output_stream


    Now I have the challenge that I need to send it to multiple servers.
    Is there anyway to add multiple outputs?



    At the end the incoming 1080p stream should get multiple bitrates and should be send to around 10 different RTMP server.



    I really hope that somebody can help me with that.










    share|improve this question

























      0












      0








      0








      I'm really new on ffmpeg and have a question where I cannot find a solution.
      I really hope that somebody from you could help me with that.



      On one server I receive a 1080p stream, with ffmpeg I create a new stream with multiple bitrates and resolution and send it afterwards to a rtmp destination on this server.
      Below CL the command that I use at the moment and it is working.



      ffmpeg -i - -copyts -muxdelay 0  -c:a libfaac -ab 128k 
      -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 20 -g 50 -b:v 1500k -s:v 1920x1080 -f flv rtmp://localhost/stream/output_stream
      -c:a libfaac -ab 64k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 1000k -s:v 1280x720 -f flv rtmp://localhost/stream/output_stream
      -c:a libfaac -ab 32k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 800k -s:v 960x540 -f flv rtmp://localhost/stream/output_stream


      Now I have the challenge that I need to send it to multiple servers.
      Is there anyway to add multiple outputs?



      At the end the incoming 1080p stream should get multiple bitrates and should be send to around 10 different RTMP server.



      I really hope that somebody can help me with that.










      share|improve this question














      I'm really new on ffmpeg and have a question where I cannot find a solution.
      I really hope that somebody from you could help me with that.



      On one server I receive a 1080p stream, with ffmpeg I create a new stream with multiple bitrates and resolution and send it afterwards to a rtmp destination on this server.
      Below CL the command that I use at the moment and it is working.



      ffmpeg -i - -copyts -muxdelay 0  -c:a libfaac -ab 128k 
      -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 20 -g 50 -b:v 1500k -s:v 1920x1080 -f flv rtmp://localhost/stream/output_stream
      -c:a libfaac -ab 64k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 1000k -s:v 1280x720 -f flv rtmp://localhost/stream/output_stream
      -c:a libfaac -ab 32k -c:v libx264 -preset faster -profile:v main -level 3.1 -crf 23 -g 50 -b:v 800k -s:v 960x540 -f flv rtmp://localhost/stream/output_stream


      Now I have the challenge that I need to send it to multiple servers.
      Is there anyway to add multiple outputs?



      At the end the incoming 1080p stream should get multiple bitrates and should be send to around 10 different RTMP server.



      I really hope that somebody can help me with that.







      ffmpeg streaming rtmp






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 1 at 12:03









      ChrisChris

      1




      1






















          1 Answer
          1






          active

          oldest

          votes


















          0














          You can use the tee muxer if any same streams are to be sent to multiple outputs, but that's not the case with your example because each output is receiving a different stream.



          However, audio doesn't take up much bitrate compared to video, so you can consider ditching the multiple audio bitrates, encode it only once, and use that same stream for all of the outputs. Basic example:



          ffmpeg -i input -filter_complex 
          "[0:v]split=2[s0][s1];[s0]scale=1280:-2[v0];[s1]scale=960:-2[v1]"
          -map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -b:v:0 1000k -b:v:1 800k -c:a aac -flags +global_header -f tee
          "[select='v:0,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream0|[select='v:1,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream1"


          Unrelated, but you're using libfaac which means your ffmpeg is ancient. So you really should upgrade.






          share|improve this answer


























          • Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

            – Chris
            Mar 14 at 9:04











          • @Chris Command updated. Forgot the -flags +global_header previously.

            – llogan
            Mar 14 at 17:06











          • I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

            – Chris
            Mar 15 at 7:43













          • @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

            – llogan
            Mar 15 at 17:14














          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "3"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410451%2fsend-output-to-multiple-destinations%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          You can use the tee muxer if any same streams are to be sent to multiple outputs, but that's not the case with your example because each output is receiving a different stream.



          However, audio doesn't take up much bitrate compared to video, so you can consider ditching the multiple audio bitrates, encode it only once, and use that same stream for all of the outputs. Basic example:



          ffmpeg -i input -filter_complex 
          "[0:v]split=2[s0][s1];[s0]scale=1280:-2[v0];[s1]scale=960:-2[v1]"
          -map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -b:v:0 1000k -b:v:1 800k -c:a aac -flags +global_header -f tee
          "[select='v:0,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream0|[select='v:1,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream1"


          Unrelated, but you're using libfaac which means your ffmpeg is ancient. So you really should upgrade.






          share|improve this answer


























          • Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

            – Chris
            Mar 14 at 9:04











          • @Chris Command updated. Forgot the -flags +global_header previously.

            – llogan
            Mar 14 at 17:06











          • I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

            – Chris
            Mar 15 at 7:43













          • @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

            – llogan
            Mar 15 at 17:14


















          0














          You can use the tee muxer if any same streams are to be sent to multiple outputs, but that's not the case with your example because each output is receiving a different stream.



          However, audio doesn't take up much bitrate compared to video, so you can consider ditching the multiple audio bitrates, encode it only once, and use that same stream for all of the outputs. Basic example:



          ffmpeg -i input -filter_complex 
          "[0:v]split=2[s0][s1];[s0]scale=1280:-2[v0];[s1]scale=960:-2[v1]"
          -map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -b:v:0 1000k -b:v:1 800k -c:a aac -flags +global_header -f tee
          "[select='v:0,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream0|[select='v:1,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream1"


          Unrelated, but you're using libfaac which means your ffmpeg is ancient. So you really should upgrade.






          share|improve this answer


























          • Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

            – Chris
            Mar 14 at 9:04











          • @Chris Command updated. Forgot the -flags +global_header previously.

            – llogan
            Mar 14 at 17:06











          • I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

            – Chris
            Mar 15 at 7:43













          • @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

            – llogan
            Mar 15 at 17:14
















          0












          0








          0







          You can use the tee muxer if any same streams are to be sent to multiple outputs, but that's not the case with your example because each output is receiving a different stream.



          However, audio doesn't take up much bitrate compared to video, so you can consider ditching the multiple audio bitrates, encode it only once, and use that same stream for all of the outputs. Basic example:



          ffmpeg -i input -filter_complex 
          "[0:v]split=2[s0][s1];[s0]scale=1280:-2[v0];[s1]scale=960:-2[v1]"
          -map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -b:v:0 1000k -b:v:1 800k -c:a aac -flags +global_header -f tee
          "[select='v:0,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream0|[select='v:1,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream1"


          Unrelated, but you're using libfaac which means your ffmpeg is ancient. So you really should upgrade.






          share|improve this answer















          You can use the tee muxer if any same streams are to be sent to multiple outputs, but that's not the case with your example because each output is receiving a different stream.



          However, audio doesn't take up much bitrate compared to video, so you can consider ditching the multiple audio bitrates, encode it only once, and use that same stream for all of the outputs. Basic example:



          ffmpeg -i input -filter_complex 
          "[0:v]split=2[s0][s1];[s0]scale=1280:-2[v0];[s1]scale=960:-2[v1]"
          -map "[v0]" -map "[v1]" -map 0:a -c:v libx264 -b:v:0 1000k -b:v:1 800k -c:a aac -flags +global_header -f tee
          "[select='v:0,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream0|[select='v:1,a':f=flv:onfail=ignore]rtmp://localhost/stream/output_stream1"


          Unrelated, but you're using libfaac which means your ffmpeg is ancient. So you really should upgrade.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 14 at 17:06

























          answered Mar 1 at 20:10









          lloganllogan

          26.4k54883




          26.4k54883













          • Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

            – Chris
            Mar 14 at 9:04











          • @Chris Command updated. Forgot the -flags +global_header previously.

            – llogan
            Mar 14 at 17:06











          • I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

            – Chris
            Mar 15 at 7:43













          • @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

            – llogan
            Mar 15 at 17:14





















          • Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

            – Chris
            Mar 14 at 9:04











          • @Chris Command updated. Forgot the -flags +global_header previously.

            – llogan
            Mar 14 at 17:06











          • I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

            – Chris
            Mar 15 at 7:43













          • @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

            – llogan
            Mar 15 at 17:14



















          Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

          – Chris
          Mar 14 at 9:04





          Many thanks for your help and sorry for my late reply. When I use this command I get below warning, any clue? Codec for stream 0 does not use global headers but container format requires global headers

          – Chris
          Mar 14 at 9:04













          @Chris Command updated. Forgot the -flags +global_header previously.

          – llogan
          Mar 14 at 17:06





          @Chris Command updated. Forgot the -flags +global_header previously.

          – llogan
          Mar 14 at 17:06













          I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

          – Chris
          Mar 15 at 7:43







          I added it and it is gone now, but when I stop ffmpeg I get below error Failed to update header with correct duration. Failed to update header with correct filesize. Also onfail=ignore is not working, get always error "Unknown option onfail"

          – Chris
          Mar 15 at 7:43















          @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

          – llogan
          Mar 15 at 17:14







          @Chris I'm guessing you're using an ancient ffmpeg. As I mentioned in the answer I strongly recommend you update to a recent version. You didn't mention your OS, so I can only recommend taking a look at the links to builds at FFmpeg Download.

          – llogan
          Mar 15 at 17:14




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Super User!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1410451%2fsend-output-to-multiple-destinations%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How do I know what Microsoft account the skydrive app is syncing to?

          When does type information flow backwards in C++?

          Grease: Live!