work

Cernlib on MacOS Docker and Apptainer Using Git Asciinema Jekyll

c++

Assertions Debugging Profiling

Asciinema, gifs



Recording typing

asciinema rec demo.cast

Press Ctrl + D when done recording.

asciinema upload demo.cast will return the address - that will show how to embed it on a webpage or download a gif.

Can add data-autoplay="true" data-loop="true" to the page.


Scripting

The asciinema-rec_script script can be used to record a script.

Remember to load the environment.

./asciinema-rec_script script_name.sh


Agg: from .cast to gif

Make sure to:

agg --theme asciinema --font-size 50 --cols 132 --rows 22 --speed 2  ifarm.cast ifarm.gif

Note

As of November 2025 asciinema is v3 but agg only supports v2. To convert a v3 to a v2:
asciinema convert -f asciicast-v2 a.cast a-v2.cast


ffmpeg: from .mov gif

Here’s an example to convert a mov file to a gif. The two steps ensure optimal colors:

ffmpeg -i input.mov -vf "fps=15,scale=800:-1:flags=lanczos,palettegen" -y palette.png
ffmpeg -i input.mov -i palette.png -lavfi "fps=15,scale=800:-1:flags=lanczos[x];[x][1:v]paletteuse" -loop 0 output.gif

where:


Additional gif goodies

To concatenate 3 gifs:


W=860
H=600
FPS=15

ffmpeg -i a.gif -i b.gif -i c.gif \
  -filter_complex "\
[0:v]fps=${FPS},scale=${W}:${H}:force_original_aspect_ratio=decrease,pad=${W}:${H}:(ow-iw)/2:(oh-ih)/2[v0]; \
[1:v]fps=${FPS},scale=${W}:${H}:force_original_aspect_ratio=decrease,pad=${W}:${H}:(ow-iw)/2:(oh-ih)/2[v1]; \
[2:v]fps=${FPS},scale=${W}:${H}:force_original_aspect_ratio=decrease,pad=${W}:${H}:(ow-iw)/2:(oh-ih)/2[v2]; \
[v0][v1][v2]concat=n=3:v=1:a=0,scale=${W}:${H},split[x][y]; \
[x]palettegen=reserve_transparent=1[p]; \
[y][p]paletteuse=dither=bayer" \
  -loop 0 out.gif

where:


To make sure a gif loops forever:

ffmpeg -i in.gif \
  -filter_complex "fps=15,split[x][z];[x]palettegen[p];[z][p]paletteuse" \
  -loop 0 out.gif