However, to my surprise, there's a lot of people reporting the problem, but very few solutions. Presumably problems like this is not just limited to whatever OS or graphics card we are using, but the cause may still be the same, and could be software related.
I searched both for flickering on Ubuntu, and flickering generally. My first step in solving a problem like this is to Google the problem. This happened both in the preview and in the recorded video, but only seems to happen when using the XSHM Screen Capture, and not when using the window recorder.
I recently encountered a problem with screen tearing – or so called 'flickering' – in OBS (Open Broadcaster Software), which is likely connected to a setting for the graphics card.