Closed hlolli closed 2 years ago
I was able to escape the heap limit with -e NODE_OPTIONS='--max_old_space_size=4096'
in the docker command, that led me step closer
docker run --rm -v $PWD:/data -e NODE_OPTIONS='--max_old_space_size=4096' asciinema/asciicast2gif -s 1.0 -t solarized-dark demo.cast demo.gif
==> Loading demo.cast...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 4338 screenshots into GIF file...
/app/main.js:697
Qe)}function ep(a){try{var b=a[0];return b.h?b.h(a):b.call(null,a)}catch(c){if(c instanceof Object)throw b=c,Yo(a[6]),b;throw c;}}function fp(a,b,c){c=Zo(c,dp(function(c){a[2]=c;a[1]=b;return ep(a)}));return r(c)?(a[2]=Nb(c),a[1]=b,dj):null}function gp(a,b){a=a[6];null!=b&&a.Dc(null,b,dp(function(){return function(){return null}}(a)));Yo(a);return a}
^
Error: spawnSync /bin/sh E2BIG
at exports._errnoException (util.js:1020:11)
at spawnSync (child_process.js:451:20)
at Object.execSync (child_process.js:507:13)
at Dp (/app/main.js:708:246)
at /app/main.js:713:178
at Function.b (/app/main.js:709:287)
at ep (/app/main.js:697:48)
at /app/main.js:697:193
at /app/main.js:689:264
at Immediate.Po (/app/main.js:685:331)
Is it possible that you link to example .cast file that helps to reproduce this?
Wow, this asciicast file is 80 MB, I'd say it's on a heavy side :)
I don't think asciicast2gif will manage. There's just too many frames and the current implementation requires all of it to fit into memory (image concat done by imagemagick's convert
).
However I just released asciicast2gif's successor - https://github.com/asciinema/agg . It's meant to handle any asciicast you throw at it very fast with minimal memory usage. You should try it out (asciicast2gif is no longer maintained).
I generated gif from your demo with agg, took 1 minute:
marcin@puter ~/tmp> agg -v --fps-cap=15 --speed=3 issue-53.{cast,gif}
[2022-08-14T14:33:10Z INFO agg] terminal size: 174x38
[2022-08-14T14:33:10Z INFO agg] selected font family: JetBrains Mono
[2022-08-14T14:33:10Z INFO agg] selected theme: dracula
[2022-08-14T14:33:10Z INFO agg] gif dimensions: 1478x764
1412 / 1412 [=========================================================] 100.00 % 23.61/s
[2022-08-14T14:34:09Z INFO agg] rendering finished in 59.800545s
The generated gif file was huge - 212 MB. So I ran it through gifsicle:
marcin@puter ~/tmp> gifsicle --lossy=80 -k 64 -O3 -Okeep-empty issue-53.gif -o issue-53-opt.gif
gifsicle: warning: huge GIF, conserving memory (processing may take a while)
This one took 10 minutes or so (didn't count), and produced 117 MB gif.
Either way, this type of animation is an extreme case asciinema will never be a good fit for.
I may be overly hopeful for a 6 minutes of cast to a gif, but this is what I'm getting