DEV Community

Cover image for I made an ANSI video format (.m2a) and a ~11 KB canvas player for it
Danil G.
Danil G.

Posted on Edited on

I made an ANSI video format (.m2a) and a ~11 KB canvas player for it

Live version (real code running in the browser): https://pleiades.shalotts.site/movie/

Page source: https://github.com/francyfox/PleiadesOrchestra/blob/master/apps/docs/src/routes/movie/%2Bpage.svelte

ANSI encoder and player: https://github.com/francyfox/movie2ansi

The page is a simple player built with a Splide slider and window frames. The video itself is played by a web component I wrote for a custom .m2a format: gzipped text with a luminance map of blocks and glyphs.

I looked for a ready solution for playing ANSI video directly and only found players that read it from one huge JSON file. Maybe my search was bad, but I couldn't find a proper format for this.

Most projects convert a movie to ANSI as a video, not as a text file made for an ANSI player. So I built my own: a ~11 KB canvas player (framework-agnostic) and an encoder on Bun that writes the binary file used to play the movie.

Top comments (0)