If you are stuck with Xvid for compatibility reasons, here’s how to squeeze the best possible quality out of it in 2024 using modern encoding knowledge:
Single-pass constrained bitrate: