asciinema / asciicast2gif

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

Conversion fails with `gifsicle:<stdin>: empty file` #33

Closed nicolasbock closed 2 years ago

nicolasbock commented 6 years ago

Running

$ docker run --memory $(( 1024 * 1024 * 1024 )) --volume /var/tmp/demo:/data --cpus 1 asciinema/asciicast2gif demo.json demo.gif
==> Loading demo.json...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining screenshots into GIF file...
gifsicle:<stdin>: empty file
Killed
/app/main.js:697
return new yp(a,Oe)}function Ap(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,tp(a[6]),b;throw c;}}function Bp(a,b,c){c=up(c,zp(function(c){a[2]=c;a[1]=b;return Ap(a)}));return t(c)?(a[2]=Gb(c),a[1]=b,ej):null}function Cp(a,b){var c=a[6];null!=b&&c.Jc(0,b,zp(function(){return function(){return null}}(c)));tp(c);return c}

Error: Command failed: convert -loop 0 -delay 3 /tmp/tmp.RFGokXCDrf/0.png -delay 196 /tmp/tmp.RFGokXCDrf/1.png [...] -delay 100 /tmp/tmp.RFGokXCDrf/2218.png -layers Optimize gif:- | gifsicle -k 32 -O2 -Okeep-empty -o demo.gif -
gifsicle:<stdin>: empty file
Killed

    at checkExecSyncError (child_process.js:472:13)
    at Object.execSync (child_process.js:512:13)
    at /app/main.js:711:275
    at Function.b (/app/main.js:707:233)
    at Ap (/app/main.js:697:64)
    at /app/main.js:697:209
    at /app/main.js:691:10
    at Immediate.kp (/app/main.js:687:320)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)

The same works with a shorter recording.

ku1ik commented 6 years ago

Does this happen with all longer recordings or only one specific?

rcoh commented 6 years ago

It's happening on my 2 minute recording

dominikschulz commented 6 years ago

I have the same problem. convert seems to use all the available memory (10GB) and then it's killed by the kernel. The recording is only about one minute.

ku1ik commented 6 years ago

I've implemented some optimizations:

I've pushed new version to npm, and there's new image on Docker hub (docker pull asciinema/asciicast2gif if you previously pulled it).

You can set GIFSICLE_OPTS env var to override the options passed to gifsicle, which is great for experimenting with different color/optimization/lossyiness combinations.

Let me know if that helped!

joshisa commented 6 years ago

I've encountered the same error result. To workaround the issue, I was able to convert a 4 min recording (into a 3.5Mb Gif) on a 16gb RAM box by providing the following Imagemagick, NodeOpts and GIFSICLE options. Not sure if the NODEOPTS is absolutely required, but the trick for me was to add the MAGICK* env vars to avoid having the convert command being killed by my linux kernel prematurely - thus resulting in an empty file failure.

docker run --rm -e "GIFSICLE_OPTS=--lossy=80" -e "NODE_OPTS=--max-old-space-size=12288" -e "MAGICK_MEMORY_LIMIT=6gb" -e "MAGICK_MAP_LIMIT=12gb" -v /home/ubuntu:/data asciinema/asciicast2gif -s 2 -t solarized-dark demo.json demo.gif
dominikschulz commented 6 years ago

With the latest docker image I was able to convert my recordings, thanks a lot :+1:

dustinblack commented 6 years ago

I've run into this, too. I think it is a problem with the length of the command line passed to gifsicle rather than directly related to the length of the recording.

ku1ik commented 6 years ago

@dustinblack that's interesting thought. I never thought of that but that's possible. And specifically this may about the number of args passed to convert (which combines the images), not to gifsicle.

dustinblack commented 6 years ago

The failure output I get seems to show a truncated command line to gifsicle. I think convert completes successfully.

christopherkeller commented 6 years ago

Similar issue here with the latest docker image. It was approximately a 5 minute asciinema cast around 51kb. I replicated the command from @joshisa and was able to get it to complete.

REPOSITORY                TAG                 IMAGE ID            CREATED             SIZE
asciinema/asciicast2gif   latest              54698cc15d97        2 months ago        398MB
$ docker run --rm -v $PWD:/data asciinema/asciicast2gif roosevelt.json roosevelt.gif
==> Loading roosevelt.json...
==> Spawning PhantomJS renderer...
==> Generating frame screenshots...
==> Combining 298 screenshots into GIF file...
Killed
gifsicle:<stdin>: empty 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: Command failed: convert -loop 0 -delay 53 /tmp/tmp.WTCofe7xS6/0.png -delay 53 /tmp/tmp.WTCofe7xS6/1.png -delay 6 /tmp/tmp.WTCofe7xS6/2.png -delay 6 /tmp/tmp.WTCofe7xS6/3.png -delay 13 /tmp/tmp.WTCofe7xS6/4.png -delay 13 /tmp/tmp.WTCofe7xS6/5.png -delay 6 /tmp/tmp.WTCofe7xS6/6.png -delay 6 /tmp/tmp.WTCofe7xS6/7.png -delay 26 /tmp/tmp.WTCofe7xS6/8.png -delay 6 /tmp/tmp.WTCofe7xS6/9.png -delay 53 /tmp/tmp.WTCofe7xS6/10.png -delay 13 /tmp/tmp.WTCofe7xS6/11.png -delay 6 /tmp/tmp.WTCofe7xS6/12.png -delay 13 /tmp/tmp.WTCofe7xS6/13.png -delay 13 /tmp/tmp.WTCofe7xS6/14.png -delay 46 /tmp/tmp.WTCofe7xS6/15.png -delay 13 /tmp/tmp.WTCofe7xS6/16.png -delay 6 /tmp/tmp.WTCofe7xS6/17.png -delay 6 /tmp/tmp.WTCofe7xS6/18.png -delay 6 /tmp/tmp.WTCofe7xS6/19.png -delay 13 /tmp/tmp.WTCofe7xS6/20.png -delay 6 /tmp/tmp.WTCofe7xS6/21.png -delay 13 /tmp/tmp.WTCofe7xS6/22.png -delay 20 /tmp/tmp.WTCofe7xS6/23.png -delay 46 /tmp/tmp.WTCofe7xS6/24.png -delay 20 /tmp/tmp.WTCofe7xS6/25.png -delay 13 /tmp/tmp.WTCofe7xS6/26.png -delay 26 /tmp/tmp.WTCofe7xS6/27.png -delay 6 /tmp/tmp.WTCofe7xS6/28.png -delay 13 /tmp/tmp.WTCofe7xS6/29.png -delay 6 /tmp/tmp.WTCofe7xS6/30.png -delay 13 /tmp/tmp.WTCofe7xS6/31.png -delay 6 /tmp/tmp.WTCofe7xS6/32.png -delay 20 /tmp/tmp.WTCofe7xS6/33.png -delay 13 /tmp/tmp.WTCofe7xS6/34.png -delay 6 /tmp/tmp.WTCofe7xS6/35.png -delay 26 /tmp/tmp.WTCofe7xS6/36.png -delay 13 /tmp/tmp.WTCofe7xS6/37.png -delay 13 /tmp/tmp.WTCofe7xS6/38.png -delay 6 /tmp/tmp.WTCofe7xS6/39.png -delay 6 /tmp/tmp.WTCofe7xS6/40.png -delay 6 /tmp/tmp.WTCofe7xS6/41.png -delay 6 /tmp/tmp.WTCofe7xS6/42.png -delay 6 /tmp/tmp.WTCofe7xS6/43.png -delay 20 /tmp/tmp.WTCofe7xS6/44.png -delay 26 /tmp/tmp.WTCofe7xS6/45.png -delay 13 /tmp/tmp.WTCofe7xS6/46.png -delay 19 /tmp/tmp.WTCofe7xS6/47.png -delay 13 /tmp/tmp.WTCofe7xS6/48.png -delay 13 /tmp/tmp.WTCofe7xS6/49.png -delay 6 /tmp/tmp.WTCofe7xS6/50.png -delay 20 /tmp/tmp.WTCofe7xS6/51.png -delay 19 /tmp/tmp.WTCofe7xS6/52.png -delay 6 /tmp/tmp.WTCofe7xS6/53.png -delay 6 /tmp/tmp.WTCofe7xS6/54.png -delay 6 /tmp/tmp.WTCofe7xS6/55.png -delay 19 /tmp/tmp.WTCofe7xS6/56.png -delay 6 /tmp/tmp.WTCofe7xS6/57.png -delay 6 /tmp/tmp.WTCofe7xS6/58.png -delay 6 /tmp/tmp.WTCofe7xS6/59.png -delay 13 /tmp/tmp.WTCofe7xS6/60.png -delay 6 /tmp/tmp.WTCofe7xS6/61.png -delay 13 /tmp/tmp.WTCofe7xS6/62.png -delay 6 /tmp/tmp.WTCofe7xS6/63.png -delay 6 /tmp/tmp.WTCofe7xS6/64.png -delay 26 /tmp/tmp.WTCofe7xS6/65.png -delay 13 /tmp/tmp.WTCofe7xS6/66.png -delay 13 /tmp/tmp.WTCofe7xS6/67.png -delay 13 /tmp/tmp.WTCofe7xS6/68.png -delay 19 /tmp/tmp.WTCofe7xS6/69.png -delay 13 /tmp/tmp.WTCofe7xS6/70.png -delay 6 /tmp/tmp.WTCofe7xS6/71.png -delay 6 /tmp/tmp.WTCofe7xS6/72.png -delay 6 /tmp/tmp.WTCofe7xS6/73.png -delay 79 /tmp/tmp.WTCofe7xS6/74.png -delay 6 /tmp/tmp.WTCofe7xS6/75.png -delay 13 /tmp/tmp.WTCofe7xS6/76.png -delay 13 /tmp/tmp.WTCofe7xS6/77.png -delay 33 /tmp/tmp.WTCofe7xS6/78.png -delay 13 /tmp/tmp.WTCofe7xS6/79.png -delay 13 /tmp/tmp.WTCofe7xS6/80.png -delay 6 /tmp/tmp.WTCofe7xS6/81.png -delay 13 /tmp/tmp.WTCofe7xS6/82.png -delay 19 /tmp/tmp.WTCofe7xS6/83.png -delay 6 /tmp/tmp.WTCofe7xS6/84.png -delay 6 /tmp/tmp.WTCofe7xS6/85.png -delay 20 /tmp/tmp.WTCofe7xS6/86.png -delay 6 /tmp/tmp.WTCofe7xS6/87.png -delay 186 /tmp/tmp.WTCofe7xS6/88.png -delay 6 /tmp/tmp.WTCofe7xS6/89.png -delay 6 /tmp/tmp.WTCofe7xS6/90.png -delay 59 /tmp/tmp.WTCofe7xS6/91.png -delay 6 /tmp/tmp.WTCofe7xS6/92.png -delay 13 /tmp/tmp.WTCofe7xS6/93.png -delay 40 /tmp/tmp.WTCofe7xS6/94.png -delay 13 /tmp/tmp.WTCofe7xS6/95.png -delay 13 /tmp/tmp.WTCofe7xS6/96.png -delay 6 /tmp/tmp.WTCofe7xS6/97.png -delay 6 /tmp/tmp.WTCofe7xS6/98.png -delay 19 /tmp/tmp.WTCofe7xS6/99.png -delay 13 /tmp/tmp.WTCofe7xS6/100.png -delay 13 /tmp/tmp.WTCofe7xS6/101.png -delay 6 /tmp/tmp.WTCofe7xS6/102.png -delay 13 /tmp/tmp.WTCofe7xS6/103.png -delay 86 /tmp/tmp.WTCofe7xS6/104.png -delay 20 /tmp/tmp.WTCofe7xS6/105.png -delay 13 /tmp/tmp.WTCofe7xS6/106.png -delay 53 /tmp/tmp.WTCofe7xS6/107.png -delay 6 /tmp/tmp.WTCofe7xS6/108.png -delay 13 /tmp/tmp.WTCofe7xS6/109.png -delay 13 /tmp/tmp.WTCofe7xS6/110.png -delay 13 /tmp/tmp.WTCofe7xS6/111.png -delay 13 /tmp/tmp.WTCofe7xS6/112.png -delay 19 /tmp/tmp.WTCofe7xS6/113.png -delay 19 /tmp/tmp.WTCofe7xS6/114.png -delay 13 /tmp/tmp.WTCofe7xS6/115.png -delay 6 /tmp/tmp.WTCofe7xS6/116.png -delay 6 /tmp/tmp.WTCofe7xS6/117.png -delay 19 /tmp/tmp.WTCofe7xS6/118.png -delay 59 /tmp/tmp.WTCofe7xS6/119.png -delay 86 /tmp/tmp.WTCofe7xS6/120.png -delay 6 /tmp/tmp.WTCofe7xS6/121.png -delay 53 /tmp/tmp.WTCofe7xS6/122.png -delay 73 /tmp/tmp.WTCofe7xS6/123.png -delay 6 /tmp/tmp.WTCofe7xS6/124.png -delay 6 /tmp/tmp.WTCofe7xS6/125.png -delay 6 /tmp/tmp.WTCofe7xS6/126.png -delay 6 /tmp/tmp.WTCofe7xS6/127.png -delay 133 /tmp/tmp.WTCofe7xS6/128.png -delay 6 /tmp/tmp.WTCofe7xS6/129.png -delay 93 /tmp/tmp.WTCofe7xS6/130.png -delay 6 /tmp/tmp.WTCofe7xS6/131.png -delay 6 /tmp/tmp.WTCofe7xS6/132.png -delay 6 /tmp/tmp.WTCofe7xS6/133.png -delay 160 /tmp/tmp.WTCofe7xS6/134.png -delay 39 /tmp/tmp.WTCofe7xS6/135.png -delay 40 /tmp/tmp.WTCofe7xS6/136.png -delay 146 /tmp/tmp.WTCofe7xS6/137.png -delay 6 /tmp/tmp.WTCofe7xS6/138.png -delay 6 /tmp/tmp.WTCofe7xS6/139.png -delay 6 /tmp/tmp.WTCofe7xS6/140.png -delay 6 /tmp/tmp.WTCofe7xS6/141.png -delay 6 /tmp/tmp.WTCofe7xS6/142.png -delay 2346 /tmp/tmp.WTCofe7xS6/143.png -delay 6 /tmp/tmp.WTCofe7xS6/144.png -delay 6 /tmp/tmp.WTCofe7xS6/145.png -delay 6 /tmp/tmp.WTCofe7xS6/146.png -delay 6099 /tmp/tmp.WTCofe7xS6/147.png -delay 6 /tmp/tmp.WTCofe7xS6/148.png -delay 6 /tmp/tmp.WTCofe7xS6/149.png -delay 6 /tmp/tmp.WTCofe7xS6/150.png -delay 113 /tmp/tmp.WTCofe7xS6/151.png -delay 6 /tmp/tmp.WTCofe7xS6/152.png -delay 6 /tmp/tmp.WTCofe7xS6/153.png -delay 6 /tmp/tmp.WTCofe7xS6/154.png -delay 6 /tmp/tmp.WTCofe7xS6/155.png -delay 13 /tmp/tmp.WTCofe7xS6/156.png -delay 6 /tmp/tmp.WTCofe7xS6/157.png -delay 6 /tmp/tmp.WTCofe7xS6/158.png -delay 26 /tmp/tmp.WTCofe7xS6/159.png -delay 46 /tmp/tmp.WTCofe7xS6/160.png -delay 193 /tmp/tmp.WTCofe7xS6/161.png -delay 6 /tmp/tmp.WTCofe7xS6/162.png -delay 6 /tmp/tmp.WTCofe7xS6/163.png -delay 13 /tmp/tmp.WTCofe7xS6/164.png -delay 706 /tmp/tmp.WTCofe7xS6/165.png -delay 93 /tmp/tmp.WTCofe7xS6/166.png -delay 133 /tmp/tmp.WTCofe7xS6/167.png -delay 6 /tmp/tmp.WTCofe7xS6/168.png -delay 133 /tmp/tmp.WTCofe7xS6/169.png -delay 13 /tmp/tmp.WTCofe7xS6/170.png -delay 246 /tmp/tmp.WTCofe7xS6/171.png -delay 6 /tmp/tmp.WTCofe7xS6/172.png -delay 113 /tmp/tmp.WTCofe7xS6/173.png -delay 13 /tmp/tmp.WTCofe7xS6/174.png -delay 6 /tmp/tmp.WTCofe7xS6/175.png -delay 6 /tmp/tmp.WTCofe7xS6/176.png -delay 6 /tmp/tmp.WTCofe7xS6/177.png -delay 6 /tmp/tmp.WTCofe7xS6/178.png -delay 6 /tmp/tmp.WTCofe7xS6/179.png -delay 120 /tmp/tmp.WTCofe7xS6/180.png -delay 106 /tmp/tmp.WTCofe7xS6/181.png -delay 106 /tmp/tmp.WTCofe7xS6/182.png -delay 133 /tmp/tmp.WTCofe7xS6/183.png -delay 6 /tmp/tmp.WTCofe7xS6/184.png -delay 106 /tmp/tmp.WTCofe7xS6/185.png -delay 113 /tmp/tmp.WTCofe7xS6/186.png -delay 6 /tmp/tmp.WTCofe7xS6/187.png -delay 106 /tmp/tmp.WTCofe7xS6/188.png -delay 120 /tmp/tmp.WTCofe7xS6/189.png -delay 106 /tmp/tmp.WTCofe7xS6/190.png -delay 6 /tmp/tmp.WTCofe7xS6/191.png -delay 106 /tmp/tmp.WTCofe7xS6/192.png -delay 106 /tmp/tmp.WTCofe7xS6/193.png -delay 6 /tmp/tmp.WTCofe7xS6/194.png -delay 120 /tmp/tmp.WTCofe7xS6/195.png -delay 200 /tmp/tmp.WTCofe7xS6/196.png -delay 6 /tmp/tmp.WTCofe7xS6/197.png -delay 6 /tmp/tmp.WTCofe7xS6/198.png -delay 19 /tmp/tmp.WTCofe7xS6/199.png -delay 20 /tmp/tmp.WTCofe7xS6/200.png -delay 6 /tmp/tmp.WTCofe7xS6/201.png -delay 400 /tmp/tmp.WTCofe7xS6/202.png -delay 1293 /tmp/tmp.WTCofe7xS6/203.png -delay 106 /tmp/tmp.WTCofe7xS6/204.png -delay 13 /tmp/tmp.WTCofe7xS6/205.png -delay 100 /tmp/tmp.WTCofe7xS6/206.png -delay 6 /tmp/tmp.WTCofe7xS6/207.png -delay 6 /tmp/tmp.WTCofe7xS6/208.png -delay 273 /tmp/tmp.WTCofe7xS6/209.png -delay 319 /tmp/tmp.WTCofe7xS6/210.png -delay 1473 /tmp/tmp.WTCofe7xS6/211.png -delay 1226 /tmp/tmp.WTCofe7xS6/212.png -delay 1120 /tmp/tmp.WTCofe7xS6/213.png -delay 1066 /tmp/tmp.WTCofe7xS6/214.png -delay 119 /tmp/tmp.WTCofe7xS6/215.png -delay 6 /tmp/tmp.WTCofe7xS6/216.png -delay 219 /tmp/tmp.WTCofe7xS6/217.png -delay 6 /tmp/tmp.WTCofe7xS6/218.png -delay 106 /tmp/tmp.WTCofe7xS6/219.png -delay 113 /tmp/tmp.WTCofe7xS6/220.png -delay 346 /tmp/tmp.WTCofe7xS6/221.png -delay 113 /tmp/tmp.WTCofe7xS6/222.png -delay 106 /tmp/tmp.WTCofe7xS6/223.png -delay 126 /tmp/tmp.WTCofe7xS6/224.png -delay 126 /tmp/tmp.WTCofe7xS6/225.png -delay 446 /tmp/tmp.WTCofe7xS6/226.png -delay 113 /tmp/tmp.WTCofe7xS6/227.png -delay 106 /tmp/tmp.WTCofe7xS6/228.png -delay 6 /tmp/tmp.WTCofe7xS6/229.png -delay 120 /tmp/tmp.WTCofe7xS6/230.png -delay 6 /tmp/tmp.WTCofe7xS6/231.png -delay 6 /tmp/tmp.WTCofe7xS6/232.png -delay 113 /tmp/tmp.WTCofe7xS6/233.png -delay 100 /tmp/tmp.WTCofe7xS6/234.png -delay 6 /tmp/tmp.WTCofe7xS6/235.png -delay 100 /tmp/tmp.WTCofe7xS6/236.png -delay 106 /tmp/tmp.WTCofe7xS6/237.png -delay 100 /tmp/tmp.WTCofe7xS6/238.png -delay 6 /tmp/tmp.WTCofe7xS6/239.png -delay 100 /tmp/tmp.WTCofe7xS6/240.png -delay 106 /tmp/tmp.WTCofe7xS6/241.png -delay 100 /tmp/tmp.WTCofe7xS6/242.png -delay 6 /tmp/tmp.WTCofe7xS6/243.png -delay 100 /tmp/tmp.WTCofe7xS6/244.png -delay 6 /tmp/tmp.WTCofe7xS6/245.png -delay 106 /tmp/tmp.WTCofe7xS6/246.png -delay 106 /tmp/tmp.WTCofe7xS6/247.png -delay 100 /tmp/tmp.WTCofe7xS6/248.png -delay 100 /tmp/tmp.WTCofe7xS6/249.png -delay 106 /tmp/tmp.WTCofe7xS6/250.png -delay 106 /tmp/tmp.WTCofe7xS6/251.png -delay 120 /tmp/tmp.WTCofe7xS6/252.png -delay 13 /tmp/tmp.WTCofe7xS6/253.png -delay 1793 /tmp/tmp.WTCofe7xS6/254.png -delay 106 /tmp/tmp.WTCofe7xS6/255.png -delay 206 /tmp/tmp.WTCofe7xS6/256.png -delay 213 /tmp/tmp.WTCofe7xS6/257.png -delay 106 /tmp/tmp.WTCofe7xS6/258.png -delay 6 /tmp/tmp.WTCofe7xS6/259.png -delay 6 /tmp/tmp.WTCofe7xS6/260.png -delay 113 /tmp/tmp.WTCofe7xS6/261.png -delay 106 /tmp/tmp.WTCofe7xS6/262.png -delay 106 /tmp/tmp.WTCofe7xS6/263.png -delay 6 /tmp/tmp.WTCofe7xS6/264.png -delay 206 /tmp/tmp.WTCofe7xS6/265.png -delay 6 /tmp/tmp.WTCofe7xS6/266.png -delay 146 /tmp/tmp.WTCofe7xS6/267.png -delay 700 /tmp/tmp.WTCofe7xS6/268.png -delay 266 /tmp/tmp.WTCofe7xS6/269.png -delay 113 /tmp/tmp.WTCofe7xS6/270.png -delay 239 /tmp/tmp.WTCofe7xS6/271.png -delay 119 /tmp/tmp.WTCofe7xS6/272.png -delay 13 /tmp/tmp.WTCofe7xS6/273.png -delay 133 /tmp/tmp.WTCofe7xS6/274.png -delay 106 /tmp/tmp.WTCofe7xS6/275.png -delay 6 /tmp/tmp.WTCofe7xS6/276.png -delay 206 /tmp/tmp.WTCofe7xS6/277.png -delay 206 /tmp/tmp.WTCofe7xS6/278.png -delay 106 /tmp/tmp.WTCofe7xS6/279.png -delay 6 /tmp/tmp.WTCofe7xS6/280.png -delay 6 /tmp/tmp.WTCofe7xS6/281.png -delay 100 /tmp/tmp.WTCofe7xS6/282.png -delay 6 /tmp/tmp.WTCofe7xS6/283.png -delay 100 /tmp/tmp.WTCofe7xS6/284.png -delay 106 /tmp/tmp.WTCofe7xS6/285.png -delay 206 /tmp/tmp.WTCofe7xS6/286.png -delay 126 /tmp/tmp.WTCofe7xS6/287.png -delay 159 /tmp/tmp.WTCofe7xS6/288.png -delay 260 /tmp/tmp.WTCofe7xS6/289.png -delay 6 /tmp/tmp.WTCofe7xS6/290.png -delay 100 /tmp/tmp.WTCofe7xS6/291.png -delay 239 /tmp/tmp.WTCofe7xS6/292.png -delay 113 /tmp/tmp.WTCofe7xS6/293.png -delay 6 /tmp/tmp.WTCofe7xS6/294.png -delay 19 /tmp/tmp.WTCofe7xS6/295.png -delay 573 /tmp/tmp.WTCofe7xS6/296.png -delay 100 /tmp/tmp.WTCofe7xS6/297.png -layers Optimize gif:- | gifsicle -k 64 -O2 -Okeep-empty --lossy=80 -o roosevelt.gif -
Killed
gifsicle:<stdin>: empty file

    at checkExecSyncError (child_process.js:473:13)
    at Object.execSync (child_process.js:513: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)
    at runCallback (timers.js:672:20)
fmv1992 commented 5 years ago

My problem was actually the line:

convert -loop 0 -> convert -limit memory 2GiB -loop 0

If convert goes unbounded with enough gifs it will claim all the computer's memory.

karlkfi commented 3 years ago

Yeah, that convert call eats up all the memory and then some. It ate all 32GiB memory and then another 16GiB of swap...

Screenshot from 2021-02-02 13-45-15

ipatch commented 3 years ago

https://media.giphy.com/media/jQDdWWeZHA9NkrDQxh/giphy.gif

cheseremtitus24 commented 2 years ago

docker run --rm -v $PWD:/data asciinema/asciicast2gif -s 5 -t monokai $1 $2.gif Above is part of a shell script that takes in the ascii.cast and the output file I just increased the skip count from -s 2 to -s 5 and i received no errors while generating the gif file

ku1ik commented 2 years ago

The approach I took with asciicast2gif didn't really scale well... as we see above. It's hard to optimize it, especially when multiple independent tools are used together. That memory and disk usage we observed is crazy.

So I played with a different approach, and the result is https://github.com/asciinema/agg . It's written in Rust, does all the rendering and gif writing without using external tools, and it does it super fast, using very little memory. Please try it out :crossed_fingers: I tested it on many recordings and I'm yet to find one where agg fails.

Having said that, I don't plan to work on asciicast2gif anymore, so I'm going to close this.

nicolasbock commented 2 years ago

Thank you @sickill ! I'll give your new tool a try.