Keep FFmpeg running











up vote
0
down vote

favorite












Good morning, I have a script that generates 2 images every second in a folder and I want ffmpeg to convert them into a series of mpeg-4 videos of 5 secs duration and that shows 2 images per second (10 frames total). Problem is that after I start the script and after I run ffmpeg, it processes the videos with the images it catches right after I run the command only and then it closes. I tried with the -re command also and nothing happens. How do I keep ffmpeg running and live converting the images while they're being generated? Here's the code I'm using :



ffmpeg -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp -vcodec libx264 -pix_fmt yuv420p -map 0 -segment_time 5 -g 5 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*5)" -f segment C:Desktopoutput%05d.mp4


All I want is to execute ffmpeg one time and let it work and close only when they're finished generating.










share|improve this question







New contributor




Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    Good morning, I have a script that generates 2 images every second in a folder and I want ffmpeg to convert them into a series of mpeg-4 videos of 5 secs duration and that shows 2 images per second (10 frames total). Problem is that after I start the script and after I run ffmpeg, it processes the videos with the images it catches right after I run the command only and then it closes. I tried with the -re command also and nothing happens. How do I keep ffmpeg running and live converting the images while they're being generated? Here's the code I'm using :



    ffmpeg -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp -vcodec libx264 -pix_fmt yuv420p -map 0 -segment_time 5 -g 5 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*5)" -f segment C:Desktopoutput%05d.mp4


    All I want is to execute ffmpeg one time and let it work and close only when they're finished generating.










    share|improve this question







    New contributor




    Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      Good morning, I have a script that generates 2 images every second in a folder and I want ffmpeg to convert them into a series of mpeg-4 videos of 5 secs duration and that shows 2 images per second (10 frames total). Problem is that after I start the script and after I run ffmpeg, it processes the videos with the images it catches right after I run the command only and then it closes. I tried with the -re command also and nothing happens. How do I keep ffmpeg running and live converting the images while they're being generated? Here's the code I'm using :



      ffmpeg -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp -vcodec libx264 -pix_fmt yuv420p -map 0 -segment_time 5 -g 5 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*5)" -f segment C:Desktopoutput%05d.mp4


      All I want is to execute ffmpeg one time and let it work and close only when they're finished generating.










      share|improve this question







      New contributor




      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      Good morning, I have a script that generates 2 images every second in a folder and I want ffmpeg to convert them into a series of mpeg-4 videos of 5 secs duration and that shows 2 images per second (10 frames total). Problem is that after I start the script and after I run ffmpeg, it processes the videos with the images it catches right after I run the command only and then it closes. I tried with the -re command also and nothing happens. How do I keep ffmpeg running and live converting the images while they're being generated? Here's the code I'm using :



      ffmpeg -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp -vcodec libx264 -pix_fmt yuv420p -map 0 -segment_time 5 -g 5 -sc_threshold 0 -force_key_frames "expr:gte(t,n_forced*5)" -f segment C:Desktopoutput%05d.mp4


      All I want is to execute ffmpeg one time and let it work and close only when they're finished generating.







      video ffmpeg slideshow






      share|improve this question







      New contributor




      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 14 at 10:08









      Vincent Bavaro

      12




      12




      New contributor




      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Vincent Bavaro is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          1
          down vote













          Pipe the images. When reading images from files, ffmpeg will identify the last image in the sequence during initialisation and will read till that image.



          cat images | ffmpeg -f image2pipe -re -framerate 2 -i - -vcodec libx264 ...


          Edit: Not surprisingly cat also sets the input roster at initialisation. However, the method below works for me.



          Have the script append the new images to a blob file



          i.e. cat new-image >> all-images



          while ffmpeg call is



          ffmpeg -f image2pipe -re -framerate 2 -i all-images -vcodec libx264 ...


          It is very important that your new image generation and appendation speed is equal to or faster than ffmpeg's read speed.






          share|improve this answer























          • I have Windows, cat won't work. I tried with type but it doesn't work either.
            – Vincent Bavaro
            Nov 14 at 10:36










          • Get gow and you'll have cat.
            – Gyan
            Nov 14 at 10:58










          • got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
            – Vincent Bavaro
            Nov 14 at 11:18










          • cat *.bmp works here.
            – Gyan
            Nov 14 at 11:22










          • it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
            – Vincent Bavaro
            Nov 14 at 11:28


















          up vote
          0
          down vote













          To keep ffmpeg getting added new images, it will need to get them from stdin.
          You will need to write a program or script that will keep feeding it new images
          as they arrive.



          For examples see:





          • Create video from a growing image sequence using FFMPEG
            for a C# script


          • Use Named Pipe (C++) to send images to FFMPEG
            for a C++ program.


          These programs will need some changes to fit them to your needs,
          but they are a good starting point.






          share|improve this answer





















          • I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
            – Vincent Bavaro
            Nov 14 at 11:36













          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',
          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
          });


          }
          });






          Vincent Bavaro is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375257%2fkeep-ffmpeg-running%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote













          Pipe the images. When reading images from files, ffmpeg will identify the last image in the sequence during initialisation and will read till that image.



          cat images | ffmpeg -f image2pipe -re -framerate 2 -i - -vcodec libx264 ...


          Edit: Not surprisingly cat also sets the input roster at initialisation. However, the method below works for me.



          Have the script append the new images to a blob file



          i.e. cat new-image >> all-images



          while ffmpeg call is



          ffmpeg -f image2pipe -re -framerate 2 -i all-images -vcodec libx264 ...


          It is very important that your new image generation and appendation speed is equal to or faster than ffmpeg's read speed.






          share|improve this answer























          • I have Windows, cat won't work. I tried with type but it doesn't work either.
            – Vincent Bavaro
            Nov 14 at 10:36










          • Get gow and you'll have cat.
            – Gyan
            Nov 14 at 10:58










          • got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
            – Vincent Bavaro
            Nov 14 at 11:18










          • cat *.bmp works here.
            – Gyan
            Nov 14 at 11:22










          • it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
            – Vincent Bavaro
            Nov 14 at 11:28















          up vote
          1
          down vote













          Pipe the images. When reading images from files, ffmpeg will identify the last image in the sequence during initialisation and will read till that image.



          cat images | ffmpeg -f image2pipe -re -framerate 2 -i - -vcodec libx264 ...


          Edit: Not surprisingly cat also sets the input roster at initialisation. However, the method below works for me.



          Have the script append the new images to a blob file



          i.e. cat new-image >> all-images



          while ffmpeg call is



          ffmpeg -f image2pipe -re -framerate 2 -i all-images -vcodec libx264 ...


          It is very important that your new image generation and appendation speed is equal to or faster than ffmpeg's read speed.






          share|improve this answer























          • I have Windows, cat won't work. I tried with type but it doesn't work either.
            – Vincent Bavaro
            Nov 14 at 10:36










          • Get gow and you'll have cat.
            – Gyan
            Nov 14 at 10:58










          • got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
            – Vincent Bavaro
            Nov 14 at 11:18










          • cat *.bmp works here.
            – Gyan
            Nov 14 at 11:22










          • it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
            – Vincent Bavaro
            Nov 14 at 11:28













          up vote
          1
          down vote










          up vote
          1
          down vote









          Pipe the images. When reading images from files, ffmpeg will identify the last image in the sequence during initialisation and will read till that image.



          cat images | ffmpeg -f image2pipe -re -framerate 2 -i - -vcodec libx264 ...


          Edit: Not surprisingly cat also sets the input roster at initialisation. However, the method below works for me.



          Have the script append the new images to a blob file



          i.e. cat new-image >> all-images



          while ffmpeg call is



          ffmpeg -f image2pipe -re -framerate 2 -i all-images -vcodec libx264 ...


          It is very important that your new image generation and appendation speed is equal to or faster than ffmpeg's read speed.






          share|improve this answer














          Pipe the images. When reading images from files, ffmpeg will identify the last image in the sequence during initialisation and will read till that image.



          cat images | ffmpeg -f image2pipe -re -framerate 2 -i - -vcodec libx264 ...


          Edit: Not surprisingly cat also sets the input roster at initialisation. However, the method below works for me.



          Have the script append the new images to a blob file



          i.e. cat new-image >> all-images



          while ffmpeg call is



          ffmpeg -f image2pipe -re -framerate 2 -i all-images -vcodec libx264 ...


          It is very important that your new image generation and appendation speed is equal to or faster than ffmpeg's read speed.







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 15 at 9:35

























          answered Nov 14 at 10:28









          Gyan

          13.8k21641




          13.8k21641












          • I have Windows, cat won't work. I tried with type but it doesn't work either.
            – Vincent Bavaro
            Nov 14 at 10:36










          • Get gow and you'll have cat.
            – Gyan
            Nov 14 at 10:58










          • got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
            – Vincent Bavaro
            Nov 14 at 11:18










          • cat *.bmp works here.
            – Gyan
            Nov 14 at 11:22










          • it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
            – Vincent Bavaro
            Nov 14 at 11:28


















          • I have Windows, cat won't work. I tried with type but it doesn't work either.
            – Vincent Bavaro
            Nov 14 at 10:36










          • Get gow and you'll have cat.
            – Gyan
            Nov 14 at 10:58










          • got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
            – Vincent Bavaro
            Nov 14 at 11:18










          • cat *.bmp works here.
            – Gyan
            Nov 14 at 11:22










          • it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
            – Vincent Bavaro
            Nov 14 at 11:28
















          I have Windows, cat won't work. I tried with type but it doesn't work either.
          – Vincent Bavaro
          Nov 14 at 10:36




          I have Windows, cat won't work. I tried with type but it doesn't work either.
          – Vincent Bavaro
          Nov 14 at 10:36












          Get gow and you'll have cat.
          – Gyan
          Nov 14 at 10:58




          Get gow and you'll have cat.
          – Gyan
          Nov 14 at 10:58












          got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
          – Vincent Bavaro
          Nov 14 at 11:18




          got gow, it gives me this error : C:Desktopinput%05d.bmp: No such file or directory
          – Vincent Bavaro
          Nov 14 at 11:18












          cat *.bmp works here.
          – Gyan
          Nov 14 at 11:22




          cat *.bmp works here.
          – Gyan
          Nov 14 at 11:22












          it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
          – Vincent Bavaro
          Nov 14 at 11:28




          it gives me the same error. Maybe I modified my command in a wrong way? Basically now it goes like : cat *.bmp | ffmpeg -f image2pipe -re -framerate 2 -s 1920x1200 -i C:Desktopinput%05d.bmp...
          – Vincent Bavaro
          Nov 14 at 11:28












          up vote
          0
          down vote













          To keep ffmpeg getting added new images, it will need to get them from stdin.
          You will need to write a program or script that will keep feeding it new images
          as they arrive.



          For examples see:





          • Create video from a growing image sequence using FFMPEG
            for a C# script


          • Use Named Pipe (C++) to send images to FFMPEG
            for a C++ program.


          These programs will need some changes to fit them to your needs,
          but they are a good starting point.






          share|improve this answer





















          • I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
            – Vincent Bavaro
            Nov 14 at 11:36

















          up vote
          0
          down vote













          To keep ffmpeg getting added new images, it will need to get them from stdin.
          You will need to write a program or script that will keep feeding it new images
          as they arrive.



          For examples see:





          • Create video from a growing image sequence using FFMPEG
            for a C# script


          • Use Named Pipe (C++) to send images to FFMPEG
            for a C++ program.


          These programs will need some changes to fit them to your needs,
          but they are a good starting point.






          share|improve this answer





















          • I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
            – Vincent Bavaro
            Nov 14 at 11:36















          up vote
          0
          down vote










          up vote
          0
          down vote









          To keep ffmpeg getting added new images, it will need to get them from stdin.
          You will need to write a program or script that will keep feeding it new images
          as they arrive.



          For examples see:





          • Create video from a growing image sequence using FFMPEG
            for a C# script


          • Use Named Pipe (C++) to send images to FFMPEG
            for a C++ program.


          These programs will need some changes to fit them to your needs,
          but they are a good starting point.






          share|improve this answer












          To keep ffmpeg getting added new images, it will need to get them from stdin.
          You will need to write a program or script that will keep feeding it new images
          as they arrive.



          For examples see:





          • Create video from a growing image sequence using FFMPEG
            for a C# script


          • Use Named Pipe (C++) to send images to FFMPEG
            for a C++ program.


          These programs will need some changes to fit them to your needs,
          but they are a good starting point.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 at 11:11









          harrymc

          247k10256542




          247k10256542












          • I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
            – Vincent Bavaro
            Nov 14 at 11:36




















          • I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
            – Vincent Bavaro
            Nov 14 at 11:36


















          I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
          – Vincent Bavaro
          Nov 14 at 11:36






          I will try them but I would've liked a built-in ffmpeg solution for it cause adding files to the stdin would slow down the process. I thought the -re command should've worked like that?
          – Vincent Bavaro
          Nov 14 at 11:36












          Vincent Bavaro is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          Vincent Bavaro is a new contributor. Be nice, and check out our Code of Conduct.













          Vincent Bavaro is a new contributor. Be nice, and check out our Code of Conduct.












          Vincent Bavaro is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1375257%2fkeep-ffmpeg-running%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?

          Grease: Live!

          When does type information flow backwards in C++?