There are several background subtraction methods in the literature that can be suitable for your purposes. I have worked in long-term video-surveillance and I recommend you the BGS library (BackGround Subtraction library):
http://code.google.com/p/bgslibrary/
https://github.com/andrewssobral/bgslibrary
I am sure that the code included in the BGS library will help you a lot!