As far as we've been able to gather, this is caused by the AMD Spectre/Meltdown patches on Ryzen. Run Windows Update and make sure you have the latest, then visit AMD's website and also update your BIOS. So far, this has fixed it for most people.
If you own a supported AMD or Nvidia graphics card, you can also switch to the AMF or NVENC encoder instead, which will then use your graphics card for encoding.
For more details about the crash: AMD's patch seems to be crashing the x264 encoder, used to turn the OBS preview into an actual stream/file - it's not something that can be fixed in OBS directly.