Video codec for simple animation?
I read up a bit and made some experiments with lossless codecs, getting decent results. I'd be interested in comments on this, especially if there are lossless or lossy alternatives that I overlooked.
I tried the following codecs / formats in ffmpeg:

Lossless Motion JPEG2000 / AVI
ffmpeg -i test.avi -vcodec jpeg2000 -strict -2 -pred 1 test_jpeg2000.avi
compression ratio 19.59%

Lossless VP9 / WebM
ffmpeg -i test.avi -vcodec vp9 -lossless 1 test_vp9.webm
compression ratio 0.52%

HuffYUV / AVI
ffmpeg -i test.avi -vcodec huffyuv test_huffyuv.avi
compression ratio 37.42%

Lossless H.264 / MP4
ffmpeg -i test.avi -vcodec h264 -qp 0 -preset veryslow test_h264.mp4
compression ratio 0.53%


Since HuffYUV did not perform well, I excluded it from further tests.
I then tested playback support on Linux and Windows, trying mplayer, xine, vlc, chrome, and firefox on Linux (Debian testing) and vlc, windows media player, chrome, and firefox on Windows (8.1). I included browsers because WebM is specifically designed for web video. Results:

Lossless Motion JPEG2000 / AVI
plays on Linux with mplayer

Lossless VP9 / WebM
plays on Linux with vlc and chrome and on Windows with chrome and firefox

Lossless H.264 / MP4
plays on Linux with mplayer, vlc, and chrome, and on Windows with vlc and chrome


That a video &quot;plays&quot; means it is supported by the player out of the box, and playback is correct. I found several cases where the video was &quot;supported&quot; but playback was buggy.
Though Lossless VP9 has the best compression ratio (by a tiny margin), for the time being I decided to use Lossless H.264 because it has better playback support.