Page 1 of 1

Extracting frames from HUGE animated gif

Posted: 2014-12-12T15:00:59-07:00
by Rye
So I have this animated gif , with -


don't freak out -

a few thousand frames:

http://tinyurl.com/odk78wu



The usual command:

Code: Select all

convert image.gif  image_%d.gif
will just crash and burn.

Any ideas on this one ?

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-12T15:27:36-07:00
by snibgo
Movies, including large animations, are handled better by ffmpeg than by ImageMagick.

Code: Select all

ffmpeg -i toyrobo.gif f_%06d.gif

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-13T02:19:39-07:00
by Rye
This will however only extract the first frame of the gif...

how do I go on about extracting all ?

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-13T04:10:37-07:00
by rich2005
Your file seems to have vanished but..

try this syntax

Code: Select all

ffmpeg -i inputfile.gif -f image2 image-%07d.gif

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-13T06:34:15-07:00
by snibgo
The command I gave extracted 230,370 frames. For further help, see ffmpeg documentation.

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-14T02:34:22-07:00
by rich2005
@snibgo

Just a word of explanation, and I had to go and look it up as well.

The ffmpeg syntax changed from pre version 1.2.1

AFAIK the windows IM comes bundled with ffmpeg and uses an older version.
With Linux, ffmpeg is a separate package installed as a dependency and you get whatever version is in the repo, almost certainly post 1.2

The syntax I offered, pulled from my notes is not quite correct and produces jpeg encoded single files. (never bothered me in the past, very little to do with animations)

The correct syntax is

Code: Select all

ffmpeg -i infile.gif -c:v gif -f image2 outfile%07d.gif
A more universal way is convert to png where

Code: Select all

ffmpeg -i infile.gif outfile%07d.png

which should work regardless of ffmpeg version.

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-14T08:03:42-07:00
by snibgo
Thanks.

Re: Extracting frames from HUGE animated gif

Posted: 2014-12-17T01:06:08-07:00
by Rye
This is odd...

I tried both ways provided, but only one image is extracted...