Hi. I have had the same problem while working with different kinds of videos, and I have been struggling to find the answer to this question for weeks. Basically, what worked for me was changing the screen recording app. Now I use
www.movavi.com. What I like about it is that now I can easily screencast, record without any lines or other problems, and even use other useful tools such as drawing on videos or recording audio. Setting the right parameters is the key. You can also try this method, and maybe it will help you get rid of that problem.