Convert OGV video to GIF animation?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
37
down vote

favorite
12












I created OGV videos with the gtk-recordmydesktop screencasting program, trying to tackle this problem here with bruteforce over X. I can view the videos with VLC.



Now, the task is to find some ways to convert OGV videos into GIF animations so I can display them on SE. How can I do that?










share|improve this question



























    up vote
    37
    down vote

    favorite
    12












    I created OGV videos with the gtk-recordmydesktop screencasting program, trying to tackle this problem here with bruteforce over X. I can view the videos with VLC.



    Now, the task is to find some ways to convert OGV videos into GIF animations so I can display them on SE. How can I do that?










    share|improve this question

























      up vote
      37
      down vote

      favorite
      12









      up vote
      37
      down vote

      favorite
      12






      12





      I created OGV videos with the gtk-recordmydesktop screencasting program, trying to tackle this problem here with bruteforce over X. I can view the videos with VLC.



      Now, the task is to find some ways to convert OGV videos into GIF animations so I can display them on SE. How can I do that?










      share|improve this question















      I created OGV videos with the gtk-recordmydesktop screencasting program, trying to tackle this problem here with bruteforce over X. I can view the videos with VLC.



      Now, the task is to find some ways to convert OGV videos into GIF animations so I can display them on SE. How can I do that?







      video conversion screencasting






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Sep 2 '17 at 12:47









      Matthias Braun

      1,81421120




      1,81421120










      asked Mar 29 '12 at 1:15







      user2362



























          4 Answers
          4






          active

          oldest

          votes

















          up vote
          37
          down vote













          take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735



          ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.



          On a terminal:



          mplayer -ao null <video file name> -vo jpeg:outdir=output


          Use ImageMagick to convert the screenshots into an animated gifs.



          convert output/* output.gif


          you can optimize the screenshots this way:



          convert output.gif -fuzz 10% -layers Optimize optimised.gif





          share|improve this answer


















          • 1




            For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
            – Ax3l
            Sep 8 '14 at 15:12










          • With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
            – max pleaner
            Oct 21 '15 at 21:19






          • 1




            Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
            – Dawid Drozd
            Jul 13 '16 at 16:07











          • It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
            – Raphael
            Oct 4 '17 at 10:09


















          up vote
          19
          down vote













          Simple script with good quality



          Script:



          inputFile=$1

          FPS=15
          WIDTH=320

          #Generate palette for better quality
          ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png

          #Generate gif using palette
          ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

          rm tmp_palette.png


          Code from: https://superuser.com/a/556031/295664



          Without palette: (231 KB)



          enter image description here



          With palette:(573 KB)



          enter image description here






          share|improve this answer





























            up vote
            3
            down vote













            This one-liner is working for me:



            ffmpeg -i video.ogv video.gif





            share|improve this answer
















            • 2




              Is this essentially different from the existing answers that use ffmpeg? How?
              – ilkkachu
              Dec 8 '17 at 15:12






            • 1




              @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
              – luator
              Dec 8 '17 at 22:53

















            up vote
            2
            down vote













            ifile=~/test.ogv

            echo '# Determine input WxH and FPS'
            eval "$(ffmpeg -i "$ifile" 2>&1 |sed -nr 's/.*Stream.*Video.* ([0-9]+x[0-9]+),.*[^[0-9.]([0-9.]+).*tbr,.*/WxH=1;FPS=2/p')"

            echo '# Output multiple images from the input video'
            ffmpeg -i "$ifile" -r $FPS -s $WxH -f image2 -vframes 100 -y ~/test-%03d.jpg 2>/dev/null

            echo '# use ImageMagic "convert" to generate the animated .gif'
            convert -delay 20 ~/test-[0-9][0-9][0-9].jpg ~/test.gif

            echo '# remove temp image files'
            rm -f ~/test-[0-9][0-9][0-9].jpg

            echo 'Done!'





            share|improve this answer


















            • 1




              Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
              – ideasman42
              Mar 30 '14 at 6:50









            protected by Community Nov 22 at 6:49



            Thank you for your interest in this question.
            Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



            Would you like to answer one of these unanswered questions instead?













            4 Answers
            4






            active

            oldest

            votes








            4 Answers
            4






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            37
            down vote













            take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735



            ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.



            On a terminal:



            mplayer -ao null <video file name> -vo jpeg:outdir=output


            Use ImageMagick to convert the screenshots into an animated gifs.



            convert output/* output.gif


            you can optimize the screenshots this way:



            convert output.gif -fuzz 10% -layers Optimize optimised.gif





            share|improve this answer


















            • 1




              For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
              – Ax3l
              Sep 8 '14 at 15:12










            • With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
              – max pleaner
              Oct 21 '15 at 21:19






            • 1




              Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
              – Dawid Drozd
              Jul 13 '16 at 16:07











            • It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
              – Raphael
              Oct 4 '17 at 10:09















            up vote
            37
            down vote













            take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735



            ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.



            On a terminal:



            mplayer -ao null <video file name> -vo jpeg:outdir=output


            Use ImageMagick to convert the screenshots into an animated gifs.



            convert output/* output.gif


            you can optimize the screenshots this way:



            convert output.gif -fuzz 10% -layers Optimize optimised.gif





            share|improve this answer


















            • 1




              For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
              – Ax3l
              Sep 8 '14 at 15:12










            • With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
              – max pleaner
              Oct 21 '15 at 21:19






            • 1




              Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
              – Dawid Drozd
              Jul 13 '16 at 16:07











            • It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
              – Raphael
              Oct 4 '17 at 10:09













            up vote
            37
            down vote










            up vote
            37
            down vote









            take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735



            ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.



            On a terminal:



            mplayer -ao null <video file name> -vo jpeg:outdir=output


            Use ImageMagick to convert the screenshots into an animated gifs.



            convert output/* output.gif


            you can optimize the screenshots this way:



            convert output.gif -fuzz 10% -layers Optimize optimised.gif





            share|improve this answer














            take a look at this: https://askubuntu.com/questions/107726/how-to-create-animated-gif-images-of-a-screencast/107735#107735



            ..... After the Desktop Recorder has saved the recording into an OGV video, MPlayer will be used to capture JPEG screenshots, saving them into the 'output' directory.



            On a terminal:



            mplayer -ao null <video file name> -vo jpeg:outdir=output


            Use ImageMagick to convert the screenshots into an animated gifs.



            convert output/* output.gif


            you can optimize the screenshots this way:



            convert output.gif -fuzz 10% -layers Optimize optimised.gif






            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Apr 13 '17 at 12:22









            Community

            1




            1










            answered Jul 31 '12 at 14:40









            maniat1k

            83231833




            83231833







            • 1




              For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
              – Ax3l
              Sep 8 '14 at 15:12










            • With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
              – max pleaner
              Oct 21 '15 at 21:19






            • 1




              Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
              – Dawid Drozd
              Jul 13 '16 at 16:07











            • It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
              – Raphael
              Oct 4 '17 at 10:09













            • 1




              For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
              – Ax3l
              Sep 8 '14 at 15:12










            • With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
              – max pleaner
              Oct 21 '15 at 21:19






            • 1




              Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
              – Dawid Drozd
              Jul 13 '16 at 16:07











            • It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
              – Raphael
              Oct 4 '17 at 10:09








            1




            1




            For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
            – Ax3l
            Sep 8 '14 at 15:12




            For a large number of images, I had to add -limit map 1 to convert (got a "Killed" otherwise).
            – Ax3l
            Sep 8 '14 at 15:12












            With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
            – max pleaner
            Oct 21 '15 at 21:19




            With a 30 second ogv video, the convert command took all my cpu and was going for over 10 minutes before i stopped it. adding -limit map 1 to the command did not fix it.
            – max pleaner
            Oct 21 '15 at 21:19




            1




            1




            Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
            – Dawid Drozd
            Jul 13 '16 at 16:07





            Try this for converting ffmpeg -i output/00000%03d.jpg output.gif unix.stackexchange.com/questions/24014/…
            – Dawid Drozd
            Jul 13 '16 at 16:07













            It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
            – Raphael
            Oct 4 '17 at 10:09





            It bears mention that direct convert output/* -fuzz 10% -layers Optimize optimised.gif is possible as well, and noticeably faster than the two-command path. Also, mplayer readily creates png screenshots as well, which may be preferred for captures of websites or GUIs.
            – Raphael
            Oct 4 '17 at 10:09













            up vote
            19
            down vote













            Simple script with good quality



            Script:



            inputFile=$1

            FPS=15
            WIDTH=320

            #Generate palette for better quality
            ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png

            #Generate gif using palette
            ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

            rm tmp_palette.png


            Code from: https://superuser.com/a/556031/295664



            Without palette: (231 KB)



            enter image description here



            With palette:(573 KB)



            enter image description here






            share|improve this answer


























              up vote
              19
              down vote













              Simple script with good quality



              Script:



              inputFile=$1

              FPS=15
              WIDTH=320

              #Generate palette for better quality
              ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png

              #Generate gif using palette
              ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

              rm tmp_palette.png


              Code from: https://superuser.com/a/556031/295664



              Without palette: (231 KB)



              enter image description here



              With palette:(573 KB)



              enter image description here






              share|improve this answer
























                up vote
                19
                down vote










                up vote
                19
                down vote









                Simple script with good quality



                Script:



                inputFile=$1

                FPS=15
                WIDTH=320

                #Generate palette for better quality
                ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png

                #Generate gif using palette
                ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

                rm tmp_palette.png


                Code from: https://superuser.com/a/556031/295664



                Without palette: (231 KB)



                enter image description here



                With palette:(573 KB)



                enter image description here






                share|improve this answer














                Simple script with good quality



                Script:



                inputFile=$1

                FPS=15
                WIDTH=320

                #Generate palette for better quality
                ffmpeg -i $inputFile -vf fps=$FPS,scale=$WIDTH:-1:flags=lanczos,palettegen tmp_palette.png

                #Generate gif using palette
                ffmpeg -i $inputFile -i tmp_palette.png -loop 0 -filter_complex "fps=$FPS,scale=$WIDTH:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif

                rm tmp_palette.png


                Code from: https://superuser.com/a/556031/295664



                Without palette: (231 KB)



                enter image description here



                With palette:(573 KB)



                enter image description here







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Mar 20 '17 at 10:18









                Community

                1




                1










                answered Jul 27 '16 at 14:41









                Dawid Drozd

                29124




                29124




















                    up vote
                    3
                    down vote













                    This one-liner is working for me:



                    ffmpeg -i video.ogv video.gif





                    share|improve this answer
















                    • 2




                      Is this essentially different from the existing answers that use ffmpeg? How?
                      – ilkkachu
                      Dec 8 '17 at 15:12






                    • 1




                      @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                      – luator
                      Dec 8 '17 at 22:53














                    up vote
                    3
                    down vote













                    This one-liner is working for me:



                    ffmpeg -i video.ogv video.gif





                    share|improve this answer
















                    • 2




                      Is this essentially different from the existing answers that use ffmpeg? How?
                      – ilkkachu
                      Dec 8 '17 at 15:12






                    • 1




                      @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                      – luator
                      Dec 8 '17 at 22:53












                    up vote
                    3
                    down vote










                    up vote
                    3
                    down vote









                    This one-liner is working for me:



                    ffmpeg -i video.ogv video.gif





                    share|improve this answer












                    This one-liner is working for me:



                    ffmpeg -i video.ogv video.gif






                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 8 '17 at 14:33









                    luator

                    1414




                    1414







                    • 2




                      Is this essentially different from the existing answers that use ffmpeg? How?
                      – ilkkachu
                      Dec 8 '17 at 15:12






                    • 1




                      @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                      – luator
                      Dec 8 '17 at 22:53












                    • 2




                      Is this essentially different from the existing answers that use ffmpeg? How?
                      – ilkkachu
                      Dec 8 '17 at 15:12






                    • 1




                      @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                      – luator
                      Dec 8 '17 at 22:53







                    2




                    2




                    Is this essentially different from the existing answers that use ffmpeg? How?
                    – ilkkachu
                    Dec 8 '17 at 15:12




                    Is this essentially different from the existing answers that use ffmpeg? How?
                    – ilkkachu
                    Dec 8 '17 at 15:12




                    1




                    1




                    @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                    – luator
                    Dec 8 '17 at 22:53




                    @ilkkachu I was looking for a very quick, simple and easy-to-remember solution. The other answers are much more complicated and not so easy to understand at first glance (probably resulting in higher quality results, though).
                    – luator
                    Dec 8 '17 at 22:53










                    up vote
                    2
                    down vote













                    ifile=~/test.ogv

                    echo '# Determine input WxH and FPS'
                    eval "$(ffmpeg -i "$ifile" 2>&1 |sed -nr 's/.*Stream.*Video.* ([0-9]+x[0-9]+),.*[^[0-9.]([0-9.]+).*tbr,.*/WxH=1;FPS=2/p')"

                    echo '# Output multiple images from the input video'
                    ffmpeg -i "$ifile" -r $FPS -s $WxH -f image2 -vframes 100 -y ~/test-%03d.jpg 2>/dev/null

                    echo '# use ImageMagic "convert" to generate the animated .gif'
                    convert -delay 20 ~/test-[0-9][0-9][0-9].jpg ~/test.gif

                    echo '# remove temp image files'
                    rm -f ~/test-[0-9][0-9][0-9].jpg

                    echo 'Done!'





                    share|improve this answer


















                    • 1




                      Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                      – ideasman42
                      Mar 30 '14 at 6:50














                    up vote
                    2
                    down vote













                    ifile=~/test.ogv

                    echo '# Determine input WxH and FPS'
                    eval "$(ffmpeg -i "$ifile" 2>&1 |sed -nr 's/.*Stream.*Video.* ([0-9]+x[0-9]+),.*[^[0-9.]([0-9.]+).*tbr,.*/WxH=1;FPS=2/p')"

                    echo '# Output multiple images from the input video'
                    ffmpeg -i "$ifile" -r $FPS -s $WxH -f image2 -vframes 100 -y ~/test-%03d.jpg 2>/dev/null

                    echo '# use ImageMagic "convert" to generate the animated .gif'
                    convert -delay 20 ~/test-[0-9][0-9][0-9].jpg ~/test.gif

                    echo '# remove temp image files'
                    rm -f ~/test-[0-9][0-9][0-9].jpg

                    echo 'Done!'





                    share|improve this answer


















                    • 1




                      Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                      – ideasman42
                      Mar 30 '14 at 6:50












                    up vote
                    2
                    down vote










                    up vote
                    2
                    down vote









                    ifile=~/test.ogv

                    echo '# Determine input WxH and FPS'
                    eval "$(ffmpeg -i "$ifile" 2>&1 |sed -nr 's/.*Stream.*Video.* ([0-9]+x[0-9]+),.*[^[0-9.]([0-9.]+).*tbr,.*/WxH=1;FPS=2/p')"

                    echo '# Output multiple images from the input video'
                    ffmpeg -i "$ifile" -r $FPS -s $WxH -f image2 -vframes 100 -y ~/test-%03d.jpg 2>/dev/null

                    echo '# use ImageMagic "convert" to generate the animated .gif'
                    convert -delay 20 ~/test-[0-9][0-9][0-9].jpg ~/test.gif

                    echo '# remove temp image files'
                    rm -f ~/test-[0-9][0-9][0-9].jpg

                    echo 'Done!'





                    share|improve this answer














                    ifile=~/test.ogv

                    echo '# Determine input WxH and FPS'
                    eval "$(ffmpeg -i "$ifile" 2>&1 |sed -nr 's/.*Stream.*Video.* ([0-9]+x[0-9]+),.*[^[0-9.]([0-9.]+).*tbr,.*/WxH=1;FPS=2/p')"

                    echo '# Output multiple images from the input video'
                    ffmpeg -i "$ifile" -r $FPS -s $WxH -f image2 -vframes 100 -y ~/test-%03d.jpg 2>/dev/null

                    echo '# use ImageMagic "convert" to generate the animated .gif'
                    convert -delay 20 ~/test-[0-9][0-9][0-9].jpg ~/test.gif

                    echo '# remove temp image files'
                    rm -f ~/test-[0-9][0-9][0-9].jpg

                    echo 'Done!'






                    share|improve this answer














                    share|improve this answer



                    share|improve this answer








                    edited Apr 2 '12 at 12:36

























                    answered Apr 2 '12 at 10:04









                    Peter.O

                    18.7k1791143




                    18.7k1791143







                    • 1




                      Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                      – ideasman42
                      Mar 30 '14 at 6:50












                    • 1




                      Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                      – ideasman42
                      Mar 30 '14 at 6:50







                    1




                    1




                    Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                    – ideasman42
                    Mar 30 '14 at 6:50




                    Suggest converting to PNG, not JPEG, larger but reduces re-compression artifacts.
                    – ideasman42
                    Mar 30 '14 at 6:50





                    protected by Community Nov 22 at 6:49



                    Thank you for your interest in this question.
                    Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).



                    Would you like to answer one of these unanswered questions instead?


                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Displaying single band from multi-band raster using QGIS

                    How many registers does an x86_64 CPU actually have?