Speed up .gif animation
Speed up .gif animation
I am creating a series of .gif animations from video files. I am impressed by the job that ImageMagick does of doing this compared to competing programs (hats off to the developers!).
However, I am finding that the videos once converted are playing very slowly. I understand this is due to the "tick" issue, where each frame is played by default 1/100 of a sec after the last, but browsers such as IE do not play the files any quicker than 6/100 sec per frame.
I am not particularly worried that the videos play at the correct speed, but I would like to speed them up. In order to do this I would like to delete all but, say, each 5th or 6th frame, leaving the rest to form a shorter, quicker animation.
I've trawled the excellent guides, but to no avail. It probably doesn't help that I've only been using the program for around 24 hours, I'll note, so it may be I'm using incorrect terminology.
Any ideas greatly appreciated!
However, I am finding that the videos once converted are playing very slowly. I understand this is due to the "tick" issue, where each frame is played by default 1/100 of a sec after the last, but browsers such as IE do not play the files any quicker than 6/100 sec per frame.
I am not particularly worried that the videos play at the correct speed, but I would like to speed them up. In order to do this I would like to delete all but, say, each 5th or 6th frame, leaving the rest to form a shorter, quicker animation.
I've trawled the excellent guides, but to no avail. It probably doesn't help that I've only been using the program for around 24 hours, I'll note, so it may be I'm using incorrect terminology.
Any ideas greatly appreciated!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Speed up .gif animation
Depending upon your computer memory, number of images and naming convention, you will likely be best to write a script to select the images you want and combine them into your animation.
If all your images are in a video animation, you could use the frame numbers to select those you want, but it is manual. As far as I know, IM does not have a skip factor. For example,
convert rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose12.gif
convert rose12.gif[1,4,7,11] rose4.gif
see http://www.imagemagick.org/Usage/basics/#image_seq
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/video/
If all your images are in a video animation, you could use the frame numbers to select those you want, but it is manual. As far as I know, IM does not have a skip factor. For example,
convert rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose: rose12.gif
convert rose12.gif[1,4,7,11] rose4.gif
see http://www.imagemagick.org/Usage/basics/#image_seq
http://www.imagemagick.org/Usage/anim_basics/
http://www.imagemagick.org/Usage/video/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
Not all programs can display a GIF animation at full speed or even 6/100 second per frame.
The larger the animation the slower its maximum speed often is, and also often depends on the computer the user is using.
Also whether a GIF animator actually uses the delay after display, or starting from the point it starts to draw the image to the display is another matter than can effect speed.
Basically GIF was never meant for video. It was only meant of to be used for simple, slow low color animated icons.
The larger the animation the slower its maximum speed often is, and also often depends on the computer the user is using.
Also whether a GIF animator actually uses the delay after display, or starting from the point it starts to draw the image to the display is another matter than can effect speed.
Basically GIF was never meant for video. It was only meant of to be used for simple, slow low color animated icons.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 2
- Joined: 2011-02-24T19:51:53-07:00
- Authentication code: 8675308
Re: Speed up .gif animation
I stumbled across this thread when trying to find the solution for a similar situation. I, too, have a series of images exported from a video file I wish to convert into GIF animations. However I want to have the exported files play back at a particular framerate.
My original question would have been "why won't IM produce a GIF with X framerate?" But further digging revealed the situation is made more complicated by various pieces of software - Firefox, Chrome (1,2), Safari, IE - all handling GIFs differently. I appreciate the GIF format was never meant to handle animation, and this is clearly evidence for that case. Nevertheless, it's still actively being used.
Ignoring frame optimisations, my IM convert command looks like this:
According to the documentation, the -delay flag determines the number of ticks (100 per second) that must expire before the next image is displayed. So a value of zero should result in very fast playback, correct?
Playback results in various applications:
The zero delay documentation alludes to Firefox and GIMP incorrectly implementing the GIF standard. But those two pieces of software are the only combination I've found so far that produce the results I want. By following this example I am able to create an animation that plays back at the anticipated speed (30fps) in Firefox (3.6.13) and Xee. Additionally, Quicktime 7's movie inspector reports the framerate as being 33.33fps (close enough).
My question is now how do I get IM to produce an animated GIF that behaves like the GIMP created file. Or given IM's adherence to standards, is this not possible? Thanks in advance.
My original question would have been "why won't IM produce a GIF with X framerate?" But further digging revealed the situation is made more complicated by various pieces of software - Firefox, Chrome (1,2), Safari, IE - all handling GIFs differently. I appreciate the GIF format was never meant to handle animation, and this is clearly evidence for that case. Nevertheless, it's still actively being used.
Ignoring frame optimisations, my IM convert command looks like this:
Code: Select all
convert -dispose none -coalesce -loop 0 -delay 0 frame-%03d.png[1-100] anim-01.gif
Playback results in various applications:
- Firefox: slower than expected
- Chrome: slower than expected
- Safari: slower than expected
- Xee image viewer: slower than expected
- Quicktime 7: 100fps
The zero delay documentation alludes to Firefox and GIMP incorrectly implementing the GIF standard. But those two pieces of software are the only combination I've found so far that produce the results I want. By following this example I am able to create an animation that plays back at the anticipated speed (30fps) in Firefox (3.6.13) and Xee. Additionally, Quicktime 7's movie inspector reports the framerate as being 33.33fps (close enough).
My question is now how do I get IM to produce an animated GIF that behaves like the GIMP created file. Or given IM's adherence to standards, is this not possible? Thanks in advance.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Speed up .gif animation
Most browsers and apps have some minimum delay built in. So you will not likely ever get 0 delay. Each one handles the min delay amount differently.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
Before proceeding any further. Other that settings for 'read' all Operations should be made AFTER reading.coffeebucket wrote: Ignoring frame optimisations, my IM convert command looks like this:Code: Select all
convert -dispose none -coalesce -loop 0 -delay 0 frame-%03d.png[1-100] anim-01.gif
See IM Examples, Basics
http://www.imagemagick.org/Usage/basics/
If you do not do this you are simply asking for trouble!
Code: Select all
convert -dispose none -delay 0 frame-%03d.png[1-100] -coalesce -loop 0 anim-01.gif
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
Even though they should have a understanding of a 'zero' delay as meaning an image that is so fast it should not be even displayed. The reason is simply that too many GIF animations out there have ONLY zero delay, and because of that they make this slowdown optimization.fmw42 wrote:Most browsers and apps have some minimum delay built in. So you will not likely ever get 0 delay. Each one handles the min delay amount differently.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
IM has NO built in limits to exactly what it can produce.coffeebucket wrote:My question is now how do I get IM to produce an animated GIF that behaves like the GIMP created file. Or given IM's adherence to standards, is this not possible? Thanks in advance.
The only thing GIMP does that does to limit the user (at least I know of) is that it will not allow you to save with a zero frame delay. Again that was because too many people create zero delay animations without realizing it is wrong.
PS: I like to be able to output some frames with zero delay, specifically for frames that I would prefer browsers to not display zero delay frames at all. But currently no browser, not even IM's "animate" command, does that at this time.
It isn't so much that web browsers are not following the standard, its more that the GIF standard was only ever a 'guide', and not fully defined in some aspects. In fact no one even makes any real use of the 'background' color meta-data that is stored in the saved file, prefering to use 'transparency' instead
So the question becomes what do you think is GIMP doing that IM can't do?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
One point. That artical you point to saves at 15 milli-seconds. That is imposible to set in a GIF file format which only sets delays in terms of centi-seconds. as such you can have either 1cs or 2cs equating to 10ms or 20ms not 15ms as the article says.
Looking at the animation provided, I found it used 3cs, so even it is not following there recommendations.
The key to a fast GIF is keep it small.
Looking at the animation provided, I found it used 3cs, so even it is not following there recommendations.
The key to a fast GIF is keep it small.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 2
- Joined: 2011-02-24T19:51:53-07:00
- Authentication code: 8675308
Re: Speed up .gif animation
Fred, Anthony - thank you both for your excellent documentation, examples and input on this issue.
I'm not entirely sure. All I know is that when I put various delay intervals into GIMP, the resulting animations play back at the correct speeds in Firefox and Xee. But nothing else. Actually, I've since tried several examples produced with both IM and GIMP with Sequential and observed different behaviour once again.anthony wrote:So the question becomes what do you think is GIMP doing that IM can't do?
Like you say, these problems come with GIF animation being guide and not a complete standard. What tools/methods did you use to examine the example?anthony wrote:Looking at the animation provided, I found it used 3cs, so even it is not following there recommendations.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Speed up .gif animation
IM -verbose identify.
But I also use a very very old tool known as giftrans
Download a patched version on
http://www.ict.griffith.edu.au/~anthony ... /#giftrans
But I also use a very very old tool known as giftrans
Download a patched version on
http://www.ict.griffith.edu.au/~anthony ... /#giftrans
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/