Added exception handling to video analysis code