asciinema / asciicast2gif

Generate GIF animations from asciicasts (asciinema recordings)
MIT License
1.2k stars 83 forks source link

taking a long time... #51

Closed lalan7 closed 2 years ago

lalan7 commented 5 years ago

I run this command:

i run this in alias :

asciicast2gif='docker run --rm -v $PWD:/data asciinema/asciicast2gif' then i ran the following command:

asciicast2gif demosprint.cast demosprint.gif

==> Loading demosprint.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 1131 screenshots into GIF file...

And now is seem to be stuck there forever. A long normaly should this take ?

thx

lalan7 commented 5 years ago

Finally finish we this error:

convert: unable to write pixel cache `/tmp/magick-29fn6FcP36q2mC': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: Too many IDAT's found `/tmp/tmp.KQuSBHp7HZ/1094.png' @ error/png.c/MagickPNGErrorHandler/1643.
.....
convert: Too many IDAT's found `/tmp/tmp.KQuSBHp7HZ/1127.png' @ error/png.c/MagickPNGErrorHandler/1643.
convert: corrupt image `/tmp/tmp.KQuSBHp7HZ/1127.png' @ error/png.c/ReadPNGImage/3973.
convert: unable to write pixel cache `/tmp/magick-29Tl_q7GLqRiIC': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: Too many IDAT's found `/tmp/tmp.KQuSBHp7HZ/1128.png' @ error/png.c/MagickPNGErrorHandler/1643.
convert: corrupt image `/tmp/tmp.KQuSBHp7HZ/1128.png' @ error/png.c/ReadPNGImage/3973.
convert: unable to write pixel cache `/tmp/magick-294uV8FtIbmAeT': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: Too many IDAT's found `/tmp/tmp.KQuSBHp7HZ/1129.png' @ error/png.c/MagickPNGErrorHandler/1643.
convert: corrupt image `/tmp/tmp.KQuSBHp7HZ/1129.png' @ error/png.c/ReadPNGImage/3973.
convert: unable to write pixel cache `/tmp/magick-29BMBPgDfJRcR9': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: Too many IDAT's found `/tmp/tmp.KQuSBHp7HZ/1130.png' @ error/png.c/MagickPNGErrorHandler/1643.
convert: corrupt image `/tmp/tmp.KQuSBHp7HZ/1130.png' @ error/png.c/ReadPNGImage/3973.
convert: unable to write pixel cache `/tmp/magick-29h15xjBUD74Bq': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: unable to extend cache `/tmp/tmp.KQuSBHp7HZ/0.png': No space left on device @ error/cache.c/OpenPixelCache/3682.
convert: unable to write pixel cache `/tmp/magick-29h15xjBUD74Bq': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: unable to extend cache `/tmp/tmp.KQuSBHp7HZ/0.png': No space left on device @ error/cache.c/OpenPixelCache/3682.
convert: unable to write pixel cache `/tmp/magick-29h15xjBUD74Bq': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: unable to extend cache `/tmp/tmp.KQuSBHp7HZ/0.png': No space left on device @ error/cache.c/OpenPixelCache/3682.
convert: unable to write pixel cache `/tmp/magick-29h15xjBUD74Bq': No space left on device @ error/cache.c/WritePixelCachePixels/5492.
convert: unable to extend cache `/tmp/tmp.KQuSBHp7HZ/0.png': No space left on device @ error/cache.c/OpenPixelCache/3682.
gifsicle: warning: trivial adaptive palette (only 2 colors in source)

the ouput of the gif is :

image

ku1ik commented 5 years ago

Combining 1131 screenshots into GIF file - that's quite a lot.

Anyway, after the above is printed all the 1131 PNGs are passed to imagemagick+gifsicle, this is what takes this time.

Slowness is one thing, but more importantly Docker container went out of disk space. I'm not quite sure if Docker puts any (artificial) limits on the started containers. Worth investigating.

coderkan commented 5 years ago

Hi,

I had the same problem. I waited more than 3 hours and nothing happened. My computer stops responding while running asciicast2gif convert gif. Is there a limit to convert GIF?

Thanks. Erkan

Vafa-Andalibi commented 4 years ago

same here for a gif with 65 screenshots. It's taking more than 30 minutes on MacOS Mojave. Is this normal?

mathieu-aubin commented 4 years ago

@Vafa-Andalibi can you try using my fork and see if it helps?

git clone --recursive https://github.com/mathieu-aubin/asciicast2gif

Using my fork, scale is set to 1 by defaut (decreases generation times x2).

You can also set a custom temporary directory using -T /path/to/custom-temp and If the custom temporary directory doesn't exist, it will create one like /tmp/asciicast2gif-tmp.GhPfPtRXZA/so no need to worry about that...

Also, using environment variable DEBUG=1, you can view debugging informations.

i run it like this

DEBUG=1 ./asciicast2gif -T /tmp/custom-temp-directory https://asciinema.org/a/162519.cast out.gif

oh, and also, when using DEBUG, the temporary directory doesn't get deleted so if you wanted, you could run image optimizations on the files and then, create a gif using whichever gif program you'd like. For example, file 17.png of the following went down by 400.4 kB after optimization with xTinyPNG-cli

As example, using the same commanf, check out THIS ASCIICAST

Resulting gif (3.0mb) RESULTING GIF

You shouldn't run with docker as it runs an outdated version of gifsicle.

Also, try using the -S 1 (default on my fork) option instead of the default as this will greatly reduce the time spent generating file...

You could also set the niceness to -20 to give the app full priority, if you are not running on a super important production server that is (i hope not)

mathieu-aubin commented 4 years ago

I've added a new option just now, -c <color_count to set GIFSICLE_OPTS colors to the amount you want. Could be useful for black and white casts...

Also, there is better debugging output

mhewedy commented 4 years ago

Same issue here with 300 screenshots using:

docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 3  https://asciinema.org/a/327940.json vermin-v0.61.0-demo.gif

Take forever and doesn't work. (It used to work in past)

BTW, I need to reclaim disk space back from docker using (on macos):

> ~/Library/Containers/com.docker.docker/Data/vms/0/Docker.raw

which sometimes corrupt docker but reclaim the disk back.

mathieu-aubin commented 4 years ago

-S 1

mathieu-aubin commented 4 years ago

asciicast

the output gif:

output gif
koalalorenzo commented 4 years ago

at least seeing the progress would help a lot! I am facing the same issue :(

mathieu-aubin commented 4 years ago

which progress? Isn't this enough

docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 3 -S 1 https://asciinema.org/a/327940.json vermin-v0.61.0-demo.gif

sorry i dont get it

mhewedy commented 4 years ago

asciicast

the output gif:

output gif

Thanks. 😍

koalalorenzo commented 4 years ago

which progress? Isn't this enough

docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 3 -S 1 https://asciinema.org/a/327940.json vermin-v0.61.0-demo.gif

sorry i dont get it

@mathieu-aubin When it is combining the 300 screenshots into the GIF, seeing that it is doing the 299th will help me from interrupting right when it is about to be done :D

ku1ik commented 2 years ago

Memory and disk space problems with asciicast2gif have been reported too many times, so I decided to approach this problem in a different way. I played with pure Rust implementation of gif generation and the result is https://github.com/asciinema/agg , which does the job faster, with very low memory usage and no extra disk space needed. Check it out. I don't plan to maintain asciicast2gif anymore. Long live agg!

ku1ik commented 2 years ago

I tested agg on @mhewedy's recording:

x

Result:

327940

Some unicode glyphs didn't render properly, other than that it looks alright, and it was generated in 4 seconds!

ku1ik commented 2 years ago

I also tried agg on @mathieu-aubin's 162519.cast:

y

Took 3 seconds, generated nice looking gif, although pretty heavy - 8.2 MB:

162519

I then ran gifsicle on it - gifsicle --lossy=80 -k 128 -O3 -Okeep-empty 162519.gif -o 162519-opt.gif - which resulted in 4.4 MB gif, with some visible loss in quality, although still not terrible:

162519-opt