Passenger flow recognition is the basis of railway passenger terminal station and railway operation department for daily management, it has an important significance for the adjustment of the operation plan, the choice of the passenger travel mode, the estimation of the travel time and so on. It is especially important for the optimization of the operating plan for the railway route under the railway transportation mode. Therefore, considering the instability and complexity of passenger flow change in the railway passenger terminal station, this paper combines the cost theory(CT) and automatic frequency control(AFC) into the passenger flow prediction. Firstly, in order to obtain the volume of passenger loss due to the detained passenger flow reaching the threshold value, the angle cost formed by the railway travel of the passengers is analyzed. On this basis, an angle cost model is constructed to calculate the passenger loss rate. Then, with the volume of passenger lost calculated, combined with the passenger flow data obtained by the AFC, a passenger flow recognition algorithm for the railway passenger terminal station based on the dynamic video technology is put forward. Subsequently, the passenger flow recognition law between the flow of passenger waiting at the station and the actual passengers carried by the train that has passed by is analyzed, and the passenger flow impact dynamic exchange model is put forward. In addition, the algorithm for solving the model is analyzed and studied. Finally, a railway line is taken as an example for case study. The recognition results can provide a theoretical and methodological support for the optimization of the railway passenger transportation operating plan and serve as a reference for the temporary adjustment of the operational planning, the passenger flow recognition, the supplementation of the guidance model and so on.