1

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.

9
  • Can you post a short sample - source and result?
    – Gyan
    Commented Jun 9, 2017 at 14:50
  • added examples as suggested
    – netjiro
    Commented Jun 9, 2017 at 16:03
  • Sample of source, as well.
    – Gyan
    Commented Jun 10, 2017 at 4:21
  • My apologies. I had already deleted the source. Edited and replaced with better example, simpler graphics. Included source. Too low rep to post all links, removed the old example links
    – netjiro
    Commented Jun 10, 2017 at 9:15
  • 1
    That's from the CRF 28, which has heavier quantization. So stick to <24.
    – Gyan
    Commented Jan 4, 2018 at 5:11

1 Answer 1

1

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 < 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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.