How to tune ffmpeg libx265 parameters for encoding old sprite based game video? I'm using ffmpeg libx265 to encode some fun gameplay clips from old games.
Typically this means low resolution pixel art, with small sprites moving against a static or scrolling background.
The default settings for the x265 codec are poorly suited for this and give large areas of blocky noise artifacts around the moving sprites. 
I can of course just increase bitrate, e.g. "crf=22" and allow more computation time "-preset slow" to reduce the problem, but I guess there are better ways to tune the codec parameters to better deal with these types of visuals.

Any suggestions?

EDIT: hmm, I need >10 rep to be allowed to post more than two links. So I'm deleting the old examples and posting updated better examples.

Adding better examples (now with source)
Very simple graphics. Both sprites moving against static background and scrolling background. The major distortions are found when sprites are moving on static background. The noise distortions can extend quite far around the sprites: e.g. @15s

Download the files and view in fullscreen. The gdrive viewer will reencode and destroy.

source (x264 ultrafast crf=0)
4.4MB https://goo.gl/VjRhvh

ffmpeg -i source.mkv -libx265 -preset medium -libx265-params "crf=28" out.mkv
152KB https://goo.gl/bQDmxe

ffmpeg -i source.mkv -libx265 -preset veryslow -libx265-params "crf=22" out.mkv
216KB https://goo.gl/rGtNAT

This one looks a bit better due to higher bitrate and more compute time. Noise artifacts are smaller, but still disturbing.
The CRF 22 sample looks fine to me at 1x size. The lower the resolution, the greater the impact a high quantization parameter will have. Suggest you stick to values &lt; 24.

Since your video images are mostly static, slower presets won't be worth the extra time (unless you need to squeeze every bit of compression efficiency).