Page 1 of 1
Speed up .gif animation
Posted: 2011-01-07T08:49:16-07:00
by piphil
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!
Re: Speed up .gif animation
Posted: 2011-01-07T11:04:19-07:00
by fmw42
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/
Re: Speed up .gif animation
Posted: 2011-01-09T21:41:39-07:00
by anthony
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.
Re: Speed up .gif animation
Posted: 2011-02-25T01:05:49-07:00
by coffeebucket
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:
Code: Select all
convert -dispose none -coalesce -loop 0 -delay 0 frame-%03d.png[1-100] anim-01.gif
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:
- Firefox: slower than expected
- Chrome: slower than expected
- Safari: slower than expected
- Xee image viewer: slower than expected
- Quicktime 7: 100fps
Changing the delay to any other value causes every frame to be blank (white). Moving the parameter further toward the left - in the hope that order of operations had something to do with it - also didn't help. Interestingly, using -delay '1x30' produces something Quicktime recognises as 33.33fps.
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.
Re: Speed up .gif animation
Posted: 2011-02-25T10:50:29-07:00
by fmw42
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.
Re: Speed up .gif animation
Posted: 2011-02-25T16:20:26-07:00
by anthony
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
Before proceeding any further. Other that settings for 'read' all Operations should be made AFTER reading.
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
Re: Speed up .gif animation
Posted: 2011-02-25T16:22:07-07:00
by anthony
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.
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.
Re: Speed up .gif animation
Posted: 2011-02-25T16:34:20-07:00
by anthony
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.
IM has NO built in limits to exactly what it can produce.
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?
Re: Speed up .gif animation
Posted: 2011-02-25T16:41:50-07:00
by anthony
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.
Re: Speed up .gif animation
Posted: 2011-02-26T03:03:59-07:00
by coffeebucket
Fred, Anthony - thank you both for your excellent documentation, examples and input on this issue.
anthony wrote:So the question becomes what do you think is GIMP doing that IM can't do?
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:Looking at the animation provided, I found it used 3cs, so even it is not following there recommendations.
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?
Re: Speed up .gif animation
Posted: 2011-02-26T20:47:54-07:00
by anthony
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