How to get good sound quality when using OBS

I've used Open Broadcaster Software for a while. It's a great piece of software. However, it has a fatal flaw: Bad sound quality, both when streaming and when recording video files. This happens because OBS was originally intended mainly for streaming, and streaming services universally require H.264 video and AAC audio. OBS uses ffmpeg for its video/audio encoding, and ffmpeg has a poorly implemented AAC codec. This is especially noticeable with chiptune-ish music. Have a listen:

However, it doesn't have to be that way. With one easy tweak, you can instead get audio that sounds way better, like this:

The solution here is getting a better AAC codec for OBS to use instead of ffmpeg's built-in one. Here's how you do it:

  1. Download and install the Apple CoreAudio AAC codec (don't worry, it won't install iTunes too).
  2. Open OBS and go to "Help->Log Files->View current log". Look for a line that looks like this to verify the codec installed correctly:
Screenshot of OBS log viewer showing the line [CoreAudio encoder]: Adding CoreAudio AAC encoder

That's it, now you should be getting much better audio quality in your recordings and/or streams.