Method and system for non-intrusive analysis of sub-video under access of national standard protocol
By capturing and parsing network packets using the libpcap library and obtaining the national standard stream using SSRC, the video access problem under the GB28181 protocol in security video surveillance systems is solved, achieving non-intrusive and efficient diagnosis and improving the efficiency of video access analysis and visualization.
Patent Information
- Application Number
- CN202410789904.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-19
- Publication Date
- 2026-01-13
- Estimated Expiration
- 2044-06-19
AI Technical Summary
When existing security video surveillance systems access video under the GB28181 protocol, video playback issues are difficult to analyze intuitively. Manual packet capture puts a lot of IO pressure on the system and makes data packet analysis difficult.
The libpcap library is used to capture network packets, parse SIP messages, and obtain national standard streams through SSRC to display media negotiation and streaming media frame information, thus achieving non-intrusive diagnosis.
It eliminates the need to intrude on the platform's diagnostic interface, reducing system I/O pressure and improving diagnostic efficiency. The process can be intuitively understood through visualization, simplifying the analysis of video access problems.
Smart Images

Figure CN118764471B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of security video surveillance technology, specifically a method and system for non-intrusive analysis of national standard protocols to access lower-level video feeds. Background Technology
[0002] The security industry is a crucial sector for building a comprehensive social security and prevention system and maintaining national security and social stability. With the development of optoelectronic information technology, microelectronics technology, microcomputer technology, and video image processing technology, traditional security systems are gradually evolving from digitalization and networking to intelligentization. Video surveillance, as an important sub-sector of the security industry, enables functions such as video acquisition, processing, control, and emergency command at monitored locations, and is widely used in public safety, transportation, water conservancy, banking, and other fields. In recent years, with the advancement of projects such as safe cities and smart cities, security systems based on the GB28181 protocol for access and cascading have become increasingly widely used.
[0003] With the development of networks, big data, and artificial intelligence, security video surveillance systems have become indispensable in maintaining public order. They are widely used in fields such as public security, transportation, water conservancy, and banking, giving rise to an increasing number of business scenarios.
[0004] However, due to the complexity of SIP signaling and streaming media negotiation in the GB28181 protocol, as well as the streaming media format and network environment, it is sometimes difficult to intuitively analyze the cause of the problem through logs when video playback issues occur. In production environments, countless video streams often exist simultaneously, and the instantaneous data packets captured manually can be extremely large. This puts a lot of I / O pressure on the system, affecting platform stability, and the transfer and analysis of such large data packet files are also quite difficult. Summary of the Invention
[0005] The purpose of this invention is to provide a non-intrusive method and system for analyzing national standard protocols to access lower-level videos, so as to solve the problems mentioned in the background art.
[0006] To achieve the above objectives, the present invention provides the following technical solution: a method for non-intrusive analysis of national standard protocol access to lower-level video, the method comprising the following steps:
[0007] Capture data packets passing through the specified network interface;
[0008] Capture and record media negotiations;
[0009] Obtain the national standard flow based on SSRC;
[0010] Display the diagnostic results.
[0011] Preferably, the specific operations for capturing data packets passing through a specified network interface include:
[0012] Using libpcap as a network packet capture library, which provides a C function interface, it is used to capture packets passing through a specified network interface, count traffic data, and add filtering rules to analyze packet data content.
[0013] Preferably, the specific operations for capturing and recording media negotiation include:
[0014] Use the filtering functionality provided by libpcap to obtain signaling packets on a specified service port;
[0015] The data packets are parsed into SIP messages, and the network packets related to a media negotiation transaction of a specified device are filtered out by the national standard encoding. The negotiation process is recorded according to each packet in the transaction.
[0016] If media negotiation is successful, the negotiation result is recorded, including the media mode (TCP primary / passive, UDP), the upstream receiving address, the downstream sending address, and the SSRC synchronization source identifier for subsequent media streams.
[0017] Preferably, the specific steps for obtaining the national standard flow based on SSRC include:
[0018] Different media streams are distinguished by the SSRC synchronization source identifier in RTP;
[0019] After monitoring media negotiation transactions and obtaining the negotiation results, libpcap is used to filter out the RTP stream based on the send and receive stream addresses. By parsing the RTP, the SSRC of each RTP packet is obtained. The RTP stream with the SSRC of this negotiation is filtered out, thus obtaining the national standard format payload in the RTP stream. The filtered RTP payload is generally in PS format and is recorded for later debugging and further parsing. Finally, the h264 / h265 raw bitstream is obtained, and the data of each frame is parsed out.
[0020] Preferably, the specific operations for displaying diagnostic results include:
[0021] The media negotiation process and streaming frame information are displayed.
[0022] A non-intrusive system for analyzing national standard protocol access to lower-level video, the system consists of a data packet capture module, a media negotiation capture module, an international stream acquisition module, and a result display module;
[0023] The packet capture module captures data packets passing through the specified network interface;
[0024] The media negotiation capture module captures and records media negotiations.
[0025] The international stream acquisition module retrieves the national standard stream based on SSRC.
[0026] The results display module shows the diagnostic results.
[0027] Preferably, the packet capture module uses libpcap as a network packet capture function library, providing a C function interface for capturing packets passing through a specified network interface, statistically analyzing traffic data, and adding filtering rules to analyze packet data content.
[0028] Preferably, the media negotiation capture module uses the filtering function provided by libpcap to obtain signaling interaction packets on a specified service port;
[0029] The data packets are parsed into SIP messages, and the network packets related to a media negotiation transaction of a specified device are filtered out by the national standard encoding. The negotiation process is recorded according to each packet in the transaction.
[0030] If media negotiation is successful, the negotiation result is recorded, including the media mode (TCP primary / passive, UDP), the upstream receiving address, the downstream sending address, and the SSRC synchronization source identifier for subsequent media streams.
[0031] Preferably, the international stream acquisition module distinguishes different media streams using the SSRC synchronization source identifier in RTP;
[0032] After monitoring media negotiation transactions and obtaining the negotiation results, libpcap is used to filter out the RTP stream based on the send and receive stream addresses. By parsing the RTP, the SSRC of each RTP packet is obtained. The RTP stream with the SSRC of this negotiation is filtered out, thus obtaining the national standard format payload in the RTP stream. The filtered RTP payload is generally in PS format and is recorded for later debugging and further parsing. Finally, the h264 / h265 raw bitstream is obtained, and the data of each frame is parsed out.
[0033] Preferably, the result display module displays the media negotiation process and the streaming media frame information.
[0034] Compared with the prior art, the beneficial effects of the present invention are:
[0035] This invention proposes a non-intrusive method and system for analyzing lower-level video streams accessed via the national standard protocol. Based on libpcap, it does not require a diagnostic interface from the platform and is non-intrusive. It performs diagnostics on a specific video stream accessed via the national standard without storing packets across the entire network interface, thus minimizing system I / O pressure. The national standard video access process is relatively complex, and manual problem diagnosis is time-consuming and labor-intensive; automated diagnosis improves the efficiency of the entire process. Visualization provides a simple and intuitive understanding of the entire process. Attached Figure Description
[0036] Figure 1 This is a flowchart illustrating the process of capturing and recording media negotiation in this invention;
[0037] Figure 2 This is a flowchart of the data packet processing of the present invention;
[0038] Figure 3 This is a diagram showing the media negotiation results of the present invention;
[0039] Figure 4 This is a diagram showing the media stream parsing results of this invention;
[0040] Figure 5 This is a flowchart of the method of the present invention. Detailed Implementation
[0041] To make the objectives, technical solutions, and advantages of the present invention clear and complete, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only some, not all, embodiments of the present invention, and are merely illustrative of the embodiments of the present invention. They are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0042] Example 1
[0043] Please see Figures 1 to 5 This invention provides a technical solution: a method for non-intrusive analysis of national standard protocols to access lower-level video, the method comprising the following steps:
[0044] 1. Capture data packets passing through the specified network interface
[0045] Use the libpcap library: libpcap is a cross-platform network traffic capture library that provides APIs for network packet capture. Besides libpcap, you can also consider using other similar libraries, such as WinPcap (Windows platform).
[0046] Network interface selection: Ensure that all data packets passing through the target network interface can be captured. In large networks, select the correct interface to ensure that the target data is captured.
[0047] Traffic statistics and filtering: In addition to capturing data packets, it counts network traffic and applies filtering rules to capture only the data packets of interest.
[0048] 2. Capture and record media negotiations
[0049] Signaling packets: Typically, media negotiation is conducted via signaling protocols such as SIP. libpcap's filtering capabilities can be used to capture these signaling packets.
[0050] SIP message parsing: Parses captured data packets into SIP messages and identifies messages related to media negotiation.
[0051] Transaction Log: Records the entire media negotiation process, including the start, intermediate steps, and end of the transaction. This helps in diagnosing problems and understanding the negotiation process.
[0052] Negotiation Result Record: Records the results of media negotiation, including media transmission mode (such as TCP active / passive, UDP), upstream receiving address, downstream sending address, and key information such as SSRC.
[0053] 3. Obtain the national standard flow based on SSRC
[0054] RTP and SSRC: RTP (Real-Time Transport Protocol) is used to transmit real-time multimedia data. SSRC (Synchronization Source Identifier) is a key field in RTP used to identify and distinguish different media streams.
[0055] RTP stream filtering: Based on the send and receive stream addresses recorded in the media negotiation, libpcap is used to filter out RTP streams.
[0056] RTP packet parsing: Parse each RTP packet, extract the SSRC field, and filter out RTP streams that match the negotiated SSRC.
[0057] Payload parsing: Record the RTP payload (usually in PS format) and parse out the raw H.264 / H.265 bitstream. Further parse these raw bitstreams to obtain the data for each frame.
[0058] 4. Present the diagnostic results
[0059] Media negotiation process demonstration: The recorded media negotiation process will be displayed in graphical or text form so that users or developers can intuitively understand the negotiation process.
[0060] Streaming Frame Information Display: Displays detailed information about H.264 / H.265 frames parsed from the RTP stream, such as frame type, timestamp, size, etc.
[0061] Logs and Reports: In addition to displaying diagnostic results in real time, the results are logged to a log file, and detailed diagnostic reports are generated for subsequent analysis and archiving.
[0062] Example 2
[0063] Based on Example 1, a non-intrusive analysis system for accessing lower-level videos using the national standard protocol is proposed. The system consists of a data packet capture module, a media negotiation capture module, an international stream acquisition module, and a result display module.
[0064] The packet capture module captures data packets passing through a specified network interface. It uses libpcap as the network packet capture function library, providing a C function interface for capturing data packets passing through a specified network interface, statistically analyzing traffic data, and adding filtering rules to analyze the content of the data packets.
[0065] The media negotiation capture module captures and records media negotiations; it uses the filtering functionality provided by libpcap to obtain signaling interaction packets on a specified service port.
[0066] The data packets are parsed into SIP messages, and the network packets related to a media negotiation transaction of a specified device are filtered out by the national standard encoding. The negotiation process is recorded according to each packet in the transaction.
[0067] If media negotiation is successful, the negotiation result is recorded, including the media mode (TCP primary / passive, UDP), the upstream receiving address, the downstream sending address, and the SSRC synchronization source identifier for subsequent media streams.
[0068] The international stream acquisition module retrieves the national standard stream based on SSRC; it distinguishes different media streams using the SSRC synchronization source identifier in RTP.
[0069] After monitoring media negotiation transactions and obtaining the negotiation results, libpcap is used to filter out the RTP stream based on the send and receive stream addresses. By parsing the RTP, the SSRC of each RTP packet is obtained. The RTP stream with the SSRC of this negotiation is filtered out, thus obtaining the national standard format payload in the RTP stream. The filtered RTP payload is generally in PS format and is recorded for later debugging and further parsing. Finally, the h264 / h265 raw bitstream is obtained, and the data of each frame is parsed out.
[0070] The results display module shows the diagnostic results, the media negotiation process, and the streaming media frame information.
[0071] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.
Claims
1. A method for non-intrusive analysis of a sub-video accessed under a national standard protocol, characterized by: The method comprises the following steps: Capturing data packets through a specified network interface; Capturing and recording media negotiation; Obtaining a national standard stream according to an SSRC; Displaying a diagnosis result; The specific operation of capturing data packets through a specified network interface comprises: Using libpcap as a network data packet capturing function library to provide a C function interface, for capturing data packets through a specified network interface, counting traffic data, and adding a filtering rule to analyze data packet data content; The specific operation of capturing and recording media negotiation comprises: Using a filtering function provided by libpcap to obtain signaling interaction packets on a specified service port; Parsings the data packets into sip messages, filtering out network packets related to a media negotiation transaction of a specified device according to a national standard code, and recording a negotiation process according to each packet in the transaction; If the media negotiation is successful, recording a negotiation result, including a media mode tcp active / passive, udp, a receiving stream address of a superior, a sending stream address of an inferior, and an SSRC synchronization source identifier of a subsequent media stream; the specific operation of obtaining a national standard stream according to an SSRC comprises: Distinguishing different media streams through an SSRC synchronization source identifier in RTP; After obtaining the negotiation result by monitoring the media negotiation transaction, filtering out RTP streams according to the receiving and sending stream addresses by using libpcap, obtaining the SSRC of each RTP packet by parsing the RTP, filtering out RTP streams with the SSRC of the negotiation SSRC, thus obtaining national standard format payloads in the RTP streams, recording the obtained RTP payloads in a PS format to facilitate subsequent debugging, and performing a next step of analysis, finally obtaining h264 / h265 bare code streams and parsing data of each frame.
2. The method for non-invasive analysis of accessing sub-video under GB protocol according to claim 1, characterized in that: The specific operation of displaying a diagnosis result comprises: Displaying a media negotiation process and stream media frame information.
3. The non-invasive analysis of the state protocol access to the lower video system according to any one of claims 1-2, characterized in that: The system comprises a data packet capturing module, a media negotiation capturing module, an international stream obtaining module, and a result display module; The data packet capturing module captures data packets through a specified network interface; The media negotiation capturing module captures and records media negotiation; The international stream obtaining module obtains a national standard stream according to an SSRC; The result display module displays a diagnosis result; The data packet capturing module uses libpcap as a network data packet capturing function library to provide a C function interface, for capturing data packets through a specified network interface, counting traffic data, and adding a filtering rule to analyze data packet data content; The media negotiation capturing module uses a filtering function provided by libpcap to obtain signaling interaction packets on a specified service port; Parsings the data packets into sip messages, filtering out network packets related to a media negotiation transaction of a specified device according to a national standard code, and recording a negotiation process according to each packet in the transaction; If the media negotiation is successful, recording a negotiation result, including a media mode tcp active / passive, udp, a receiving stream address of a superior, a sending stream address of an inferior, and an SSRC synchronization source identifier of a subsequent media stream; the international stream obtaining module distinguishes different media streams through an SSRC synchronization source identifier in RTP; Through monitoring media negotiation affairs, obtaining negotiation results, filtering out RTP streams according to sending and receiving flow addresses by libpcap, obtaining the SSRC of each RTP packet by analyzing RTP, filtering out the RTP stream with the SSRC as the SSRC of the negotiation, and obtaining the national standard format load in the RTP stream, the RTP load obtained by filtering is generally recorded in PS format for subsequent debugging, and the next step of analysis is performed, and finally, the h264 / h265 bare code stream is obtained, and the data of each frame is analyzed.
4. The system for non-invasive analysis of accessing sub-video under national standard protocol according to claim 3, characterized in that: The result display module, media negotiation process display, and stream media frame information display.
Citation Information
Patent Citations
Monitoring system for internal network video files based on message interception
CN102082709A
Method for analyzing and reducing SQL (Structured Query Language) command in TNS (Transparent Network Substrate) protocol in by-pass manner
CN102801714A