what worked for my case was:
(Menu Bar): Go > Computer > Macintosh HD > Library > Preferences > Audio
Delete the com.apple.audio.DeviceSettings.plist and com.apple.audio.SystemSettings.plist files
Empty trash
Restart your computer
After this I tried listening to the same YouTube videos and Spotify and no longer had any crackling/popping so far. Was really excited that Apple's Support was able to help solve it so quickly. Hope this helps!
Topic:
App & System Services
SubTopic:
Core OS
Tags: