How to do I convert an webm (video) to a (animated) gif on the command line?












22















I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.










share|improve this question




















  • 1





    See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

    – llogan
    Aug 4 '14 at 16:20
















22















I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.










share|improve this question




















  • 1





    See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

    – llogan
    Aug 4 '14 at 16:20














22












22








22


7






I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.










share|improve this question
















I suppose ffmpeg is the weapon of choice but I didn't find out how to reach my goal.







14.04 ffmpeg webm gif convert-command






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Aug 4 '14 at 11:45







brubaker

















asked Aug 4 '14 at 11:36









brubakerbrubaker

1561317




1561317








  • 1





    See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

    – llogan
    Aug 4 '14 at 16:20














  • 1





    See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

    – llogan
    Aug 4 '14 at 16:20








1




1





See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

– llogan
Aug 4 '14 at 16:20





See How do I convert a video to GIF using ffmpeg, with reasonable quality? for some additional information.

– llogan
Aug 4 '14 at 16:20










2 Answers
2






active

oldest

votes


















34














From here:



ffmpeg -i input.webm -pix_fmt rgb24 output.gif





share|improve this answer





















  • 1





    Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

    – brubaker
    Aug 4 '14 at 11:47






  • 3





    gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

    – kenn
    Aug 4 '14 at 11:52








  • 1





    @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

    – brubaker
    Aug 4 '14 at 12:01






  • 2





    @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

    – wchargin
    Nov 1 '15 at 23:19






  • 2





    rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

    – kxxoling
    Jan 22 '17 at 8:59



















0














Barafu's answer is alright. But, I resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'. Here is what I find works:



First, create PNG Palette:



ffmpeg -y -i input.webm -vf palettegen palette.png


Then, use the palette to produce gif:



ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif


Source:



Covert MP4/Webm - ubuntubuzz.com





share























    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%2f506670%2fhow-to-do-i-convert-an-webm-video-to-a-animated-gif-on-the-command-line%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









    34














    From here:



    ffmpeg -i input.webm -pix_fmt rgb24 output.gif





    share|improve this answer





















    • 1





      Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

      – brubaker
      Aug 4 '14 at 11:47






    • 3





      gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

      – kenn
      Aug 4 '14 at 11:52








    • 1





      @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

      – brubaker
      Aug 4 '14 at 12:01






    • 2





      @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

      – wchargin
      Nov 1 '15 at 23:19






    • 2





      rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

      – kxxoling
      Jan 22 '17 at 8:59
















    34














    From here:



    ffmpeg -i input.webm -pix_fmt rgb24 output.gif





    share|improve this answer





















    • 1





      Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

      – brubaker
      Aug 4 '14 at 11:47






    • 3





      gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

      – kenn
      Aug 4 '14 at 11:52








    • 1





      @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

      – brubaker
      Aug 4 '14 at 12:01






    • 2





      @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

      – wchargin
      Nov 1 '15 at 23:19






    • 2





      rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

      – kxxoling
      Jan 22 '17 at 8:59














    34












    34








    34







    From here:



    ffmpeg -i input.webm -pix_fmt rgb24 output.gif





    share|improve this answer















    From here:



    ffmpeg -i input.webm -pix_fmt rgb24 output.gif






    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 20 '17 at 10:18









    Community

    1




    1










    answered Aug 4 '14 at 11:39









    Barafu AlbinoBarafu Albino

    4,99311932




    4,99311932








    • 1





      Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

      – brubaker
      Aug 4 '14 at 11:47






    • 3





      gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

      – kenn
      Aug 4 '14 at 11:52








    • 1





      @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

      – brubaker
      Aug 4 '14 at 12:01






    • 2





      @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

      – wchargin
      Nov 1 '15 at 23:19






    • 2





      rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

      – kxxoling
      Jan 22 '17 at 8:59














    • 1





      Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

      – brubaker
      Aug 4 '14 at 11:47






    • 3





      gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

      – kenn
      Aug 4 '14 at 11:52








    • 1





      @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

      – brubaker
      Aug 4 '14 at 12:01






    • 2





      @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

      – wchargin
      Nov 1 '15 at 23:19






    • 2





      rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

      – kxxoling
      Jan 22 '17 at 8:59








    1




    1





    Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

    – brubaker
    Aug 4 '14 at 11:47





    Wow! It works! AND.. 2.6 MB webm -> 48 MB gif ^^ -- any thought to reduce this?

    – brubaker
    Aug 4 '14 at 11:47




    3




    3





    gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

    – kenn
    Aug 4 '14 at 11:52







    gifsicle is a fantastic tool to reduce gif size gifsicle -O2 input.gif -o output.gif

    – kenn
    Aug 4 '14 at 11:52






    1




    1





    @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

    – brubaker
    Aug 4 '14 at 12:01





    @BarafuAlbino Thanks buddy, but I got an error: "Unknown pixel format requested: rgb16."

    – brubaker
    Aug 4 '14 at 12:01




    2




    2





    @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

    – wchargin
    Nov 1 '15 at 23:19





    @brubaker I think I got you beat: 120K .webm → 2.7G .gif. Yes, that's with a G.

    – wchargin
    Nov 1 '15 at 23:19




    2




    2





    rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

    – kxxoling
    Jan 22 '17 at 8:59





    rgb24 is not supported for gif, ffmpeg would use rgb8 instead automatically.

    – kxxoling
    Jan 22 '17 at 8:59













    0














    Barafu's answer is alright. But, I resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'. Here is what I find works:



    First, create PNG Palette:



    ffmpeg -y -i input.webm -vf palettegen palette.png


    Then, use the palette to produce gif:



    ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif


    Source:



    Covert MP4/Webm - ubuntubuzz.com





    share




























      0














      Barafu's answer is alright. But, I resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'. Here is what I find works:



      First, create PNG Palette:



      ffmpeg -y -i input.webm -vf palettegen palette.png


      Then, use the palette to produce gif:



      ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif


      Source:



      Covert MP4/Webm - ubuntubuzz.com





      share


























        0












        0








        0







        Barafu's answer is alright. But, I resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'. Here is what I find works:



        First, create PNG Palette:



        ffmpeg -y -i input.webm -vf palettegen palette.png


        Then, use the palette to produce gif:



        ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif


        Source:



        Covert MP4/Webm - ubuntubuzz.com





        share













        Barafu's answer is alright. But, I resulting gif may have color conversion issue as ffmpeg complains on Incompatible pixel format 'rgb24' for codec 'gif'. Here is what I find works:



        First, create PNG Palette:



        ffmpeg -y -i input.webm -vf palettegen palette.png


        Then, use the palette to produce gif:



        ffmpeg -y -i input.webm -i palette.png -filter_complex paletteuse -r 10 output.gif


        Source:



        Covert MP4/Webm - ubuntubuzz.com






        share











        share


        share










        answered 1 min ago









        Raynal GobelRaynal Gobel

        1575




        1575






























            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.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f506670%2fhow-to-do-i-convert-an-webm-video-to-a-animated-gif-on-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

            GameSpot

            connect to host localhost port 22: Connection refused

            Getting a Wifi WPA2 wifi connection