Due to the densely population and mobility characteristics of the crowd, generally accidents happened in assembly occupancies will trigger a chain reaction, and then bring heavy casualties and property loss, and result disastrous consequences. In the context of safety regulation resources limited, building risk classification system of assembly occupancies is important for "scientific predicting, and hierarchical controlling” In this paper, a software with a graphical user interface is designed using MATLAB GUI to analyze and calculate risks of stampede accident caused by gathered crowds in the video. A velocity extraction method based on cross-correlation algorithm is adopted, and the risk characteristic parameters such as velocity variance is also applied. In this way, real-time analysis and early-warning for risks of stampede accident in time and space can be achieved. Also, the algorithm is applied to the surveillance video of the stampede in Shanghai and its feasibility is proved. Empirical research shows that, the assembly occupancies risk rating model built in this paper has good effectiveness, simplicity and practicability, applies to the government safety regulation and organization safety management, and can improve the safety situation of assembly occupancies effectively.