How can you be sure you record what you see on screen? Well, to say it with a cyber security term, by pulling a man in the middle attack. What do I mean by that? Well, obviously, if we can record on the link between your desktop and your monitor, we would surely be capturing what is visible on the monitor. So we somehow need to find a way to get ourselves between that computer output and the input of your monitor.
Now there are multiple ways to do this.
Using a video field recorder
The first and the best option would be to use some kind of recording device. Many of the professional videographers on this forum will own one of these and maybe better know it as a camera monitor. These kind of devices have an input and often an output and they are commonly used to record the live output from a video camera.
In the picture above we can see the Atomos Ninja V recorder. It has 2 hdmi ports, one input and one output. We could put a cable from the desktop on the input and than a cable to a monitor as output. We could than work as normal, but can use the recorder to record anything happening on the screen. This recorder would be doing all the hardwork so the recording won't eat up system resources and these recorders are made to record high quality video. Ideal!
Recording software
A second option would indeed be to use some kind of virtual recorder, like OBS. These are less favourable to recording with external hardware cause they often impact performance and they aren't actually recording the system output. This means that some colour shenanigans from a OS can change the recorded screen from the actual output. Secondly, if the computer crashes the recorded files often get corrupt and can't be used.
I personally use OBS and ShareX and never ran into problems with these tools. I have to admit thought that I'm usually wondering whether or not my night-mode is captured as well.
Things to be aware of
Now many things can affect the recorded video. That makes it quite difficult to give you specific instructions for fixing your problem. But I think it can be either bad settings in your streaming software, asking too much from your desktop or maybe it's your screen. Maybe your screen is using some kind of video profile and giving and alternating the image.