[SOLVED] Bug with convert
[SOLVED] Bug with convert
Hey guys,
I have a problem trying to split big animated GIF into frames (17Mb).
I use the following command:
/usr/local/bin/convert -coalesce /gifs/test.gif /gifs/result/%d.gif
This GIF has 150 frames and lasts 5 seconds with FPS=10 (I made it from video).
However, most of the time in a result folder I get from 45 to 65 files.
For some reason, last frame has only 10 bytes. Sometimes I get all 150 frames but it happens very rare.
Convert usually stops without any warnings and errors in 22-28 seconds.
Here is the animation -- http://countriesguide.com/test.gif
Any ideas?
P.S.: ImageMagick 6.9.1-3
I have a problem trying to split big animated GIF into frames (17Mb).
I use the following command:
/usr/local/bin/convert -coalesce /gifs/test.gif /gifs/result/%d.gif
This GIF has 150 frames and lasts 5 seconds with FPS=10 (I made it from video).
However, most of the time in a result folder I get from 45 to 65 files.
For some reason, last frame has only 10 bytes. Sometimes I get all 150 frames but it happens very rare.
Convert usually stops without any warnings and errors in 22-28 seconds.
Here is the animation -- http://countriesguide.com/test.gif
Any ideas?
P.S.: ImageMagick 6.9.1-3
Last edited by grigory on 2016-01-16T11:33:39-07:00, edited 1 time in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bug with convert
try
Code: Select all
/usr/local/bin/convert /gifs/test.gif -coalesce +adjoin /gifs/result/test_%03d.gif
Re: Bug with convert
Tried it twice -- got 31 and 41 frames while it has 150 frames. The last one had 10 bytes.
Also tried it on my second server (2xXeon, 24Gb RAM, ImageMagick 6.8.6-10), got 130 frames without adjoin and 108 with adjoin, last one also had 10 bytes. BTW, adjoin option makes the process much slower. My first server has Dual Core + 8Gb RAM.
Bug?
Also tried it on my second server (2xXeon, 24Gb RAM, ImageMagick 6.8.6-10), got 130 frames without adjoin and 108 with adjoin, last one also had 10 bytes. BTW, adjoin option makes the process much slower. My first server has Dual Core + 8Gb RAM.
Bug?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bug with convert
No problem on my computer.
How much free memory do you have? Q16 takes 8 bytes/pixel. Coalesce might double this, so that would be 553 MB. That isn't much these days, but it's worth checking.
How much free memory do you have? Q16 takes 8 bytes/pixel. Coalesce might double this, so that would be 553 MB. That isn't much these days, but it's worth checking.
snibgo's IM pages: im.snibgo.com
Re: Bug with convert
Do you use linux? Well, sometimes I get 150 frames. This happens in 4/10. Also I make test on a production servers, not an idle PC.No problem on my computer.
My servers have 8 and 24 GBytes RAM respectively. Or you meant some sort of memory per each IM proccess? If so, how can I check it?snibgo wrote:How much free memory do you have? Q16 takes 8 bytes/pixel. Coalesce might double this, so that would be 553 MB. That isn't much these days, but it's worth checking.
/tmp is mounted on /dev/shm which has 4 GBytes of space.Perhaps the tmp directory is getting too full
Please keep in mind guys, that I use 2 version of IM on 2 different servers with different hardware configuration.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bug with convert
OK. Let me understand. Sorry if you have to repeat. Do both systems have trouble? If not, which one and what version of Imagemagick.
I am on Imagemagick 6.9.3.0 Q16 Mac OSX (Mac Mini with 4GB RAM) and the following works fine and creates all your frames
I am on Imagemagick 6.9.3.0 Q16 Mac OSX (Mac Mini with 4GB RAM) and the following works fine and creates all your frames
Code: Select all
cd test1
convert test.gif -coalesce ../test2/test_%03d.gif
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Bug with convert
I'm on IM v6.9.2-5, Windows 8.1, 12 GB RAM. Servers sometimes limit memory to 1 GB per process. If you have >2 GB available, that's not the problem.
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Bug with convert
check your Imagemagick policy.xml file to see if anything else has been limited in IM otherwise, as snibgo says, check your server for other limitations.
Re: Bug with convert
Yes, both servers have trouble (IM 6.8.6-10 and IM 6.9.1-3). That's why I opened this topic.fmw42 wrote:OK. Let me understand. Sorry if you have to repeat. Do both systems have trouble? If not, which one and what version of Imagemagick.
I am on Imagemagick 6.9.3.0 Q16 Mac OSX (Mac Mini with 4GB RAM) and the following works fine and creates all your frames
Code: Select all
cd test1 convert test.gif -coalesce ../test2/test_%03d.gif
I don't have anything policy.xml (all options are commented out). And what kind of check shall I make? As snibgo said, memory is not a problem in my case.check your Imagemagick policy.xml file to see if anything else has been limited in IM otherwise, as snibgo says, check your server for other limitations.
Re: Bug with convert
Perhaps you are running out of temporary space, typically /tmp. Set the MAGICK_TMP environment variable to a path that has copious amount of free space:
- export MAGICK_TMP=/data/tmp
convert -limit memory 2MiB -limit map 4MiB test.gif -coalesce ../test2/test_%03d.gif
Re: Bug with convert
Oh guys, promise me you won't laugh I found out what was the problem!
A couple of years ago I made a simple tool which kills any "convert" process after 40 seconds because of old IM bug when IM hanged my server.
So this tiny tool killed any convert process before it could prepare all the 150 frames of my .gif file
And I had it running in memory 24/7 on both servers
A couple of years ago I made a simple tool which kills any "convert" process after 40 seconds because of old IM bug when IM hanged my server.
So this tiny tool killed any convert process before it could prepare all the 150 frames of my .gif file
And I had it running in memory 24/7 on both servers
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: [SOLVED] Bug with convert
Glad to hear it was that simple. Sometimes the simplest issue are the hardest to find.
Re: [SOLVED] Bug with convert
Yeah, I spent many hours trying to find a bug in my code + PHP/Apache configs + IM