Try pressing CTRL-ALT-F2 to get a shell prompt. That is, it will hide the desktop and make the whole screen a big terminal window. Than CTRL-ALT-F1 brings back the desktop (or maybe another function key, like F7 or F8).
Try it when the output is working so you can see the results. Then wait until it's in the failed state and try it. The shift causes a change of output state, so if anything is going to jar it back to life, that probably will.
Once you know that result, you'll know which direction to go. If that doesn't work, it suggests you have a hardware failure. I once had a graphics card that failed something like that.
If the graphics output hardware is failing, the rest of the computer should operate just fine, so here's another test. Open a terminal window (or press CTRL-ALT-F2 and log in) to get a shell prompt. Type in a disk-intensive command, but don't press ENTER until it goes into the failed state. In the failed state, press ENTER and watch the disk activity LED on the computer's front panel. If it lights, it's executing the command, so the computer is actually executing.
Commands "find /usr -name firefox" and "df" are examples of disk-intensive commands.
NOTE: With 8GB of memory, every disk access is probably cached. So once you execute almost any command, it probably won't access the disk when you execute it the second time. So don't experiment with the command you are going to use. Just type it and don't press ENTER until the output fails.
If the computer is on a network and you can ping it, that would be an even better test than using the disk LED.
If the disk LED never lights or it stops responding to a ping, you may have a failing power supply.