How to create a gif from JPEG images with the command line












54














I want make a .gif animated picture from a given set of .jpg pictures.



I would prefer to do it from the command line, so command line tools would be very welcome.










share|improve this question




















  • 3




    Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
    – Wilf
    Jul 14 '15 at 11:48


















54














I want make a .gif animated picture from a given set of .jpg pictures.



I would prefer to do it from the command line, so command line tools would be very welcome.










share|improve this question




















  • 3




    Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
    – Wilf
    Jul 14 '15 at 11:48
















54












54








54


24





I want make a .gif animated picture from a given set of .jpg pictures.



I would prefer to do it from the command line, so command line tools would be very welcome.










share|improve this question















I want make a .gif animated picture from a given set of .jpg pictures.



I would prefer to do it from the command line, so command line tools would be very welcome.







command-line gif






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 15 at 20:54









Ciro Santilli 新疆改造中心 六四事件 法轮功

9,12444246




9,12444246










asked Jul 14 '15 at 10:57









Maythux

50.2k32165214




50.2k32165214








  • 3




    Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
    – Wilf
    Jul 14 '15 at 11:48
















  • 3




    Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
    – Wilf
    Jul 14 '15 at 11:48










3




3




Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
– Wilf
Jul 14 '15 at 11:48






Works, very memory hungry though. There are LOADs of potential dupes though:askubuntu.com/questions/648244/… askubuntu.com/questions/457351/… askubuntu.com/q/573712/178596 askubuntu.com/questions/566476/… askubuntu.com/questions/380875/… askubuntu.com/q/636149/178596
– Wilf
Jul 14 '15 at 11:48












4 Answers
4






active

oldest

votes


















67














You can use ImageMagick package. Install it using the command:



sudo apt-get install imagemagick


Now you can create a gif from number of pictures(jpg) using:



convert -delay 20 -loop 0 *.jpg myimage.gif





share|improve this answer



















  • 5




    Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
    – Léo Léopold Hertz 준영
    Aug 7 '16 at 11:23





















38














To complete @Maythux answer:



To avoid generating a very large file, you can use -resize option:



In my case, I have 4608x3456 images and the generated gif was more than 300M for 32 images



convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif


or



convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif


Take care of *.jpg



*.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.



$ ls|cat
21-33-26_1.jpg
21-33-26_10.jpg // <--- this one
21-33-26_2.jpg
21-33-26_3.jpg
21-33-26_4.jpg
21-33-26_5.jpg
21-33-26_6.jpg
21-33-26_7.jpg
21-33-26_8.jpg
21-33-26_9.jpg
21-33-28_1.jpg // <--- should be here
21-33-28_2.jpg
21-33-28_3.jpg
...


As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:



convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif


Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.






share|improve this answer

















  • 3




    You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
    – bigreddmachine
    Nov 28 '16 at 23:53






  • 1




    There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
    – tjt263
    Jan 23 '17 at 16:28












  • Some users might be interested in editing filenames with massren: github.com/laurent22/massren
    – Graham P Heath
    Nov 30 '17 at 22:09



















17














I don't have enough reputation to comment but instead of modifying file names you can use globbing to get your shell to expand file names



convert -resize 50% -delay 10 -loop 0 image_{0..99}.jpg output.gif





share|improve this answer































    0














    ffmeg solution with test data



    wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true
    unzip opengl-rotating-triangle.zip
    cd opengl-rotating-triangle
    ffmpeg
    -framerate 60
    -pattern_type glob
    -i 'tmp.*.png'
    -r 15
    -vf scale=512:-1
    out.gif
    ;


    enter image description here



    The test data was generated with: https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file/14324292#14324292



    The important ffmpeg options I wanted to highlight are:





    • -patter_type glob: convenient way to select images


    • -framerate 60 and -r 15: assume 60 FPS on input images (ffmpeg cannot know otherwise since no FPS data in images as in video formats), pick one every 4 images so reduce size (4 == 60 / 15)


    • -vf scale=512:-1: set the width, scale height proportionally, usually to reduce size and save space


    See also:




    • video from images: https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg/37478183#37478183

    • GIF from video: How to create an animated GIF from MP4 video via command line?


    Tested in Ubuntu 18.10, ffmpeg 4.0.2.






    share|improve this answer





















      Your Answer








      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "89"
      };
      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%2faskubuntu.com%2fquestions%2f648244%2fhow-to-create-a-gif-from-jpeg-images-with-the-command-line%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      67














      You can use ImageMagick package. Install it using the command:



      sudo apt-get install imagemagick


      Now you can create a gif from number of pictures(jpg) using:



      convert -delay 20 -loop 0 *.jpg myimage.gif





      share|improve this answer



















      • 5




        Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
        – Léo Léopold Hertz 준영
        Aug 7 '16 at 11:23


















      67














      You can use ImageMagick package. Install it using the command:



      sudo apt-get install imagemagick


      Now you can create a gif from number of pictures(jpg) using:



      convert -delay 20 -loop 0 *.jpg myimage.gif





      share|improve this answer



















      • 5




        Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
        – Léo Léopold Hertz 준영
        Aug 7 '16 at 11:23
















      67












      67








      67






      You can use ImageMagick package. Install it using the command:



      sudo apt-get install imagemagick


      Now you can create a gif from number of pictures(jpg) using:



      convert -delay 20 -loop 0 *.jpg myimage.gif





      share|improve this answer














      You can use ImageMagick package. Install it using the command:



      sudo apt-get install imagemagick


      Now you can create a gif from number of pictures(jpg) using:



      convert -delay 20 -loop 0 *.jpg myimage.gif






      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jul 22 '15 at 7:32

























      answered Jul 14 '15 at 10:57









      Maythux

      50.2k32165214




      50.2k32165214








      • 5




        Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
        – Léo Léopold Hertz 준영
        Aug 7 '16 at 11:23
















      • 5




        Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
        – Léo Léopold Hertz 준영
        Aug 7 '16 at 11:23










      5




      5




      Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
      – Léo Léopold Hertz 준영
      Aug 7 '16 at 11:23






      Please, include here how you resize the gif animation etc by 50%. Etc -resize 50%.
      – Léo Léopold Hertz 준영
      Aug 7 '16 at 11:23















      38














      To complete @Maythux answer:



      To avoid generating a very large file, you can use -resize option:



      In my case, I have 4608x3456 images and the generated gif was more than 300M for 32 images



      convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif


      or



      convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif


      Take care of *.jpg



      *.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.



      $ ls|cat
      21-33-26_1.jpg
      21-33-26_10.jpg // <--- this one
      21-33-26_2.jpg
      21-33-26_3.jpg
      21-33-26_4.jpg
      21-33-26_5.jpg
      21-33-26_6.jpg
      21-33-26_7.jpg
      21-33-26_8.jpg
      21-33-26_9.jpg
      21-33-28_1.jpg // <--- should be here
      21-33-28_2.jpg
      21-33-28_3.jpg
      ...


      As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:



      convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif


      Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.






      share|improve this answer

















      • 3




        You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
        – bigreddmachine
        Nov 28 '16 at 23:53






      • 1




        There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
        – tjt263
        Jan 23 '17 at 16:28












      • Some users might be interested in editing filenames with massren: github.com/laurent22/massren
        – Graham P Heath
        Nov 30 '17 at 22:09
















      38














      To complete @Maythux answer:



      To avoid generating a very large file, you can use -resize option:



      In my case, I have 4608x3456 images and the generated gif was more than 300M for 32 images



      convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif


      or



      convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif


      Take care of *.jpg



      *.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.



      $ ls|cat
      21-33-26_1.jpg
      21-33-26_10.jpg // <--- this one
      21-33-26_2.jpg
      21-33-26_3.jpg
      21-33-26_4.jpg
      21-33-26_5.jpg
      21-33-26_6.jpg
      21-33-26_7.jpg
      21-33-26_8.jpg
      21-33-26_9.jpg
      21-33-28_1.jpg // <--- should be here
      21-33-28_2.jpg
      21-33-28_3.jpg
      ...


      As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:



      convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif


      Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.






      share|improve this answer

















      • 3




        You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
        – bigreddmachine
        Nov 28 '16 at 23:53






      • 1




        There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
        – tjt263
        Jan 23 '17 at 16:28












      • Some users might be interested in editing filenames with massren: github.com/laurent22/massren
        – Graham P Heath
        Nov 30 '17 at 22:09














      38












      38








      38






      To complete @Maythux answer:



      To avoid generating a very large file, you can use -resize option:



      In my case, I have 4608x3456 images and the generated gif was more than 300M for 32 images



      convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif


      or



      convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif


      Take care of *.jpg



      *.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.



      $ ls|cat
      21-33-26_1.jpg
      21-33-26_10.jpg // <--- this one
      21-33-26_2.jpg
      21-33-26_3.jpg
      21-33-26_4.jpg
      21-33-26_5.jpg
      21-33-26_6.jpg
      21-33-26_7.jpg
      21-33-26_8.jpg
      21-33-26_9.jpg
      21-33-28_1.jpg // <--- should be here
      21-33-28_2.jpg
      21-33-28_3.jpg
      ...


      As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:



      convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif


      Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.






      share|improve this answer












      To complete @Maythux answer:



      To avoid generating a very large file, you can use -resize option:



      In my case, I have 4608x3456 images and the generated gif was more than 300M for 32 images



      convert -resize 20% -delay 20 -loop 0 *.jpg myimage.gif


      or



      convert -resize 768x576 -delay 20 -loop 0 *.jpg myimage.gif


      Take care of *.jpg



      *.jpg sucks a bit when dealing with numeric values, you may generate a gif with unsorted pics.



      $ ls|cat
      21-33-26_1.jpg
      21-33-26_10.jpg // <--- this one
      21-33-26_2.jpg
      21-33-26_3.jpg
      21-33-26_4.jpg
      21-33-26_5.jpg
      21-33-26_6.jpg
      21-33-26_7.jpg
      21-33-26_8.jpg
      21-33-26_9.jpg
      21-33-28_1.jpg // <--- should be here
      21-33-28_2.jpg
      21-33-28_3.jpg
      ...


      As the shots were taken very quickly (10/s) they all have the same modification time and you can't trick using ls -t for example. On ubuntu you can use ls -v instead, something like:



      convert -resize 768x576 -delay 20 -loop 0 `ls -v` myimage.gif


      Sorting numerically is quite tricky on Mac OS X though, I guess you'll need to build a custom script.







      share|improve this answer












      share|improve this answer



      share|improve this answer










      answered Apr 16 '16 at 9:28









      Ninsuo

      54059




      54059








      • 3




        You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
        – bigreddmachine
        Nov 28 '16 at 23:53






      • 1




        There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
        – tjt263
        Jan 23 '17 at 16:28












      • Some users might be interested in editing filenames with massren: github.com/laurent22/massren
        – Graham P Heath
        Nov 30 '17 at 22:09














      • 3




        You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
        – bigreddmachine
        Nov 28 '16 at 23:53






      • 1




        There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
        – tjt263
        Jan 23 '17 at 16:28












      • Some users might be interested in editing filenames with massren: github.com/laurent22/massren
        – Graham P Heath
        Nov 30 '17 at 22:09








      3




      3




      You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
      – bigreddmachine
      Nov 28 '16 at 23:53




      You can avoid your *.jpg issue by forward padding numbers with zeros. "01.jpg" instead of "1.jpg", and so on. If you get to triple digits, then "001.jpg", "010.jpg", etc.
      – bigreddmachine
      Nov 28 '16 at 23:53




      1




      1




      There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
      – tjt263
      Jan 23 '17 at 16:28






      There are several ways around the filename sequence problem. Including find, sort, brace expansion, and so on. The ls tool is notoriously unsuitable for this kind of thing. Use find. There's a bit of a learning curve, but it's worth it.
      – tjt263
      Jan 23 '17 at 16:28














      Some users might be interested in editing filenames with massren: github.com/laurent22/massren
      – Graham P Heath
      Nov 30 '17 at 22:09




      Some users might be interested in editing filenames with massren: github.com/laurent22/massren
      – Graham P Heath
      Nov 30 '17 at 22:09











      17














      I don't have enough reputation to comment but instead of modifying file names you can use globbing to get your shell to expand file names



      convert -resize 50% -delay 10 -loop 0 image_{0..99}.jpg output.gif





      share|improve this answer




























        17














        I don't have enough reputation to comment but instead of modifying file names you can use globbing to get your shell to expand file names



        convert -resize 50% -delay 10 -loop 0 image_{0..99}.jpg output.gif





        share|improve this answer


























          17












          17








          17






          I don't have enough reputation to comment but instead of modifying file names you can use globbing to get your shell to expand file names



          convert -resize 50% -delay 10 -loop 0 image_{0..99}.jpg output.gif





          share|improve this answer














          I don't have enough reputation to comment but instead of modifying file names you can use globbing to get your shell to expand file names



          convert -resize 50% -delay 10 -loop 0 image_{0..99}.jpg output.gif






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jul 28 '17 at 5:51









          d a i s y

          3,25982344




          3,25982344










          answered Jul 27 '17 at 18:52









          shanksk

          17113




          17113























              0














              ffmeg solution with test data



              wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true
              unzip opengl-rotating-triangle.zip
              cd opengl-rotating-triangle
              ffmpeg
              -framerate 60
              -pattern_type glob
              -i 'tmp.*.png'
              -r 15
              -vf scale=512:-1
              out.gif
              ;


              enter image description here



              The test data was generated with: https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file/14324292#14324292



              The important ffmpeg options I wanted to highlight are:





              • -patter_type glob: convenient way to select images


              • -framerate 60 and -r 15: assume 60 FPS on input images (ffmpeg cannot know otherwise since no FPS data in images as in video formats), pick one every 4 images so reduce size (4 == 60 / 15)


              • -vf scale=512:-1: set the width, scale height proportionally, usually to reduce size and save space


              See also:




              • video from images: https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg/37478183#37478183

              • GIF from video: How to create an animated GIF from MP4 video via command line?


              Tested in Ubuntu 18.10, ffmpeg 4.0.2.






              share|improve this answer


























                0














                ffmeg solution with test data



                wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true
                unzip opengl-rotating-triangle.zip
                cd opengl-rotating-triangle
                ffmpeg
                -framerate 60
                -pattern_type glob
                -i 'tmp.*.png'
                -r 15
                -vf scale=512:-1
                out.gif
                ;


                enter image description here



                The test data was generated with: https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file/14324292#14324292



                The important ffmpeg options I wanted to highlight are:





                • -patter_type glob: convenient way to select images


                • -framerate 60 and -r 15: assume 60 FPS on input images (ffmpeg cannot know otherwise since no FPS data in images as in video formats), pick one every 4 images so reduce size (4 == 60 / 15)


                • -vf scale=512:-1: set the width, scale height proportionally, usually to reduce size and save space


                See also:




                • video from images: https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg/37478183#37478183

                • GIF from video: How to create an animated GIF from MP4 video via command line?


                Tested in Ubuntu 18.10, ffmpeg 4.0.2.






                share|improve this answer
























                  0












                  0








                  0






                  ffmeg solution with test data



                  wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true
                  unzip opengl-rotating-triangle.zip
                  cd opengl-rotating-triangle
                  ffmpeg
                  -framerate 60
                  -pattern_type glob
                  -i 'tmp.*.png'
                  -r 15
                  -vf scale=512:-1
                  out.gif
                  ;


                  enter image description here



                  The test data was generated with: https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file/14324292#14324292



                  The important ffmpeg options I wanted to highlight are:





                  • -patter_type glob: convenient way to select images


                  • -framerate 60 and -r 15: assume 60 FPS on input images (ffmpeg cannot know otherwise since no FPS data in images as in video formats), pick one every 4 images so reduce size (4 == 60 / 15)


                  • -vf scale=512:-1: set the width, scale height proportionally, usually to reduce size and save space


                  See also:




                  • video from images: https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg/37478183#37478183

                  • GIF from video: How to create an animated GIF from MP4 video via command line?


                  Tested in Ubuntu 18.10, ffmpeg 4.0.2.






                  share|improve this answer












                  ffmeg solution with test data



                  wget -O opengl-rotating-triangle.zip https://github.com/cirosantilli/media/blob/master/opengl-rotating-triangle.zip?raw=true
                  unzip opengl-rotating-triangle.zip
                  cd opengl-rotating-triangle
                  ffmpeg
                  -framerate 60
                  -pattern_type glob
                  -i 'tmp.*.png'
                  -r 15
                  -vf scale=512:-1
                  out.gif
                  ;


                  enter image description here



                  The test data was generated with: https://stackoverflow.com/questions/3191978/how-to-use-glut-opengl-to-render-to-a-file/14324292#14324292



                  The important ffmpeg options I wanted to highlight are:





                  • -patter_type glob: convenient way to select images


                  • -framerate 60 and -r 15: assume 60 FPS on input images (ffmpeg cannot know otherwise since no FPS data in images as in video formats), pick one every 4 images so reduce size (4 == 60 / 15)


                  • -vf scale=512:-1: set the width, scale height proportionally, usually to reduce size and save space


                  See also:




                  • video from images: https://stackoverflow.com/questions/24961127/how-to-create-a-video-from-images-with-ffmpeg/37478183#37478183

                  • GIF from video: How to create an animated GIF from MP4 video via command line?


                  Tested in Ubuntu 18.10, ffmpeg 4.0.2.







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered Dec 15 at 20:52









                  Ciro Santilli 新疆改造中心 六四事件 法轮功

                  9,12444246




                  9,12444246






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Ask Ubuntu!


                      • 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.





                      Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                      Please pay close attention to the following guidance:


                      • 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%2faskubuntu.com%2fquestions%2f648244%2fhow-to-create-a-gif-from-jpeg-images-with-the-command-line%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

                      數位音樂下載

                      When can things happen in Etherscan, such as the picture below?

                      格利澤436b