System for monitoring safety at a railroad crossing. With the help of cameras watching the crossing, the system detects and identifies vehicles within the crossing. At the same time, the system automatically detects the status of the traffic signal by analyzing the video stream – when a red phase is detected and a vehicle is identified at the crossing, the system automatically generates an alarm. In addition, the system can monitor the free space of the road behind the crossing by which it can detect congestion of the exit and potential danger to entering vehicles. Such a signal can be used to control an additional traffic signal mounted in front of the entrance.