Abstract:This article addresses the issue of traditional video encryption systems being unable to balance real-time and security in encrypting large amounts of data, and designs and implements a video encryption scheme based on the SM2 algorithm. This scheme is based on the State Secrets SM2 algorithm and a lightweight stream cipher generated by the "xoshiro256ss" pseudo-random number generator. It uses hybrid encryption and "one-time encryption" to ensure data security. This solution achieves data exchange between devices and streaming media servers through the RTSP protocol, and can decrypt and play video data through QT, providing an effective solution to the problem of video surveillance encryption that cannot simultaneously balance security and real-time performance. After testing, the system has an encryption time of about 3 ms for I-frames.