If you decide using Motion as the video engine, I can guide further if you get stuck but you have to give more detailed Q's of the problems you encounter in that case. I think the links I gave you should be enough as starter to install & configure Motion properly. From there the next step would be to get the streams into the dashboard, that is the easy part
If you decide for anything else, I might not be able to guide but there might be other users jumping in
Further more (advanced) discussions around the topic & to add AI is really interestingly discussed here: