This is a common error if you have recently installed or updated your graphics drivers. Rebooting the system usually fixes this issue.
Ensure you are using the correct and latest GPU drivers, if using Nvidia GPU install the Official drivers provided for your distribution, and same goes if using AMD GPU. Reboot your computer after installing/upgrading drivers and OBS should work properly after.