Depending upon your capture program then you can tell it to capture one specific window and nothing else. Alternatively I have not gone there for a while but you can have one application always have focus, I have not had to do it outside of actual code/terminal/kiosk stuff which is different but I did see it as a feature in a mouse jail program (programs designed for multiple screens where you want to keep the mouse from wandering in there) once.
Otherwise there are any number of things that can pull focus. I would have to look into your machine to see what goes. IM clients, updates and email notifications are usually good suspects here.
Do you have a touchscreen? I had a curious case the other day with a subtly broken one that randomly made the cursor dance all over the shop and click on things.