An edge gateway-based media resource management system and a reverse access method thereof

By using a media resource management system based on edge gateways, the bottlenecks in central bandwidth and storage, security risks, and data management challenges of multimedia monitoring systems have been solved. It enables reverse access and data security protection for edge devices, meets the requirements for domestic production, reduces operation and maintenance costs, and ensures data integrity and traceability.

CN123184986APending Publication Date: 2026-11-27HUNAN QIANGSHI INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202611685877.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-29
Publication Date
2026-11-27

Smart Images

  • Figure CN123184986A_ABST
    Figure CN123184986A_ABST
Patent Text Reader

Abstract

The application belongs to the technical field of network communication and multimedia monitoring, and relates to a media resource management system based on an edge gateway and a reverse access method thereof. The system comprises a center gateway and an edge gateway. The center gateway and the edge gateway are deployed with the same set of media gateway software and are distinguished by role configuration. The center gateway is deployed in a data center and is used for receiving active registration and identity authentication of the edge gateway, maintaining a session list of all online edge gateways, receiving and issuing management instructions, receiving media data returned by the edge gateway and presenting the media data to a user. The edge gateway is deployed in a local area network / intranet and is used for accessing media devices in the local area network, realizing local storage, encryption and distribution, maintaining a long connection with the center gateway and responding to instructions issued by the center gateway. The application can realize reverse access and integrate functions of encrypted storage, permission control, network interruption fault-tolerant self-recovery synchronization and anti-leakage tracing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of network communication and multimedia monitoring technology, and in particular to a media resource management system based on an edge gateway and its reverse access method. Background Technology

[0002] With the continuous growth in demand for multimedia services such as video surveillance and conference recording from enterprises, schools, and other institutions, the number of network cameras (bullet cameras, PTZ cameras, etc.), storage devices, and client devices deployed within these organizations is constantly increasing. Traditional multimedia monitoring systems typically adopt a centralized architecture of "front-end acquisition - central storage - central distribution," where all media data needs to be transmitted back to the data center for storage and forwarding. With the increasing number of devices and storage, a new solution is needed to support this.

[0003] Currently, there are existing technologies for edge video gateways: Patent CN111193753A discloses an "Internet of Things Edge Intelligent Video Gateway System", which enables video access, transcoding and streaming playback by deploying video gateway devices at the edge of the project. Patent CN117439815A discloses an intranet penetration scheme based on reverse transparent bridging, which enables external network access to intranet services by deploying a relay server on the public network; Patent CN118784222A discloses an edge computing device based on the GB35114 standard and employing the SM1 / SM4 algorithm to encrypt video streams. Regarding the "edge storage + central on-demand access" architecture, existing technologies include: In the "edge NVR local recording + central remote preview" solution, NVR / DVR products from manufacturers such as Hikvision and Dahua Technology support local storage of recordings and remote viewing via the Internet. However, such solutions typically require edge devices to have public IP addresses or to use a third-party P2P cloud platform for relaying, while the central platform still needs to maintain device mapping relationships and online status. In addition, some solutions adopt a hybrid mode of "edge automatic synchronization + central centralized storage," where the center still stores video copies, failing to achieve the architectural goal of "zero video storage at the center."

[0004] In terms of network outage fault tolerance, data leakage prevention, and domestic production, existing technologies include: Regarding network outage fault tolerance: Some NVRs / edge devices support local recording when the network is down, but after the network is restored, they generally rely on manual export or re-upload using common protocols such as FTP and HTTP Range, lacking automatic self-healing, deduplication, and breakpoint resume orchestration mechanisms for large-scale gateway clusters. Regarding data leakage prevention and tracing: existing solutions mostly involve adding watermarks or post-event audits on the business platform side. However, video data lacks mandatory rate limits and watermark control at the edge gateway exit, making it difficult to effectively restrain internal personnel from downloading in bulk and to trace and hold them accountable. In terms of localization: Existing edge video gateway products are not sufficiently compatible with domestic CPUs (Phytium, Kunpeng, Loongson, Zhaoxin, Hygon, etc.) and domestic operating systems (Kylin, UnionTech UOS, Euler openEuler, etc.), making it difficult to meet the localization substitution and compliance requirements of high-security organizations.

[0005] In summary, the existing technology still has the following significant shortcomings: (a) Key bottlenecks include central bandwidth and storage: In a centralized architecture, all video streams from cameras need to be transmitted back to the data center. As the number of devices increases, the bandwidth demand at the center grows linearly. Organizations can only continuously expand bandwidth, which is costly and unsustainable. When the number of surveillance devices reaches a certain scale, operators cannot provide higher bandwidth, leaving organizations facing the dilemma of building their own networks or finding alternative solutions.

[0006] (ii) Public network exposure poses serious security risks: In traditional systems, data centers typically need to expose public IP addresses and multiple service ports to enable remote access. This exposes the system to risks such as network attacks and data theft. Criminals can use port scanning, vulnerability exploitation, and other methods to infiltrate the system and steal sensitive surveillance video information.

[0007] (iii) The center cannot access the edge device when it has no public IP address: Deploying media devices at the edge of the local area network can alleviate the bandwidth pressure on the central network, but edge devices usually do not have public IP addresses, which prevents the data center from actively accessing edge devices to retrieve monitoring resources or view them in real time.

[0008] (iv) Data sovereignty and centralized management are difficult to reconcile: Existing edge video gateway solutions are either completely independent and cannot be managed uniformly, or they are completely controlled by a central platform, resulting in a lack of data privacy protection and a lack of flexible and configurable permission management mechanisms.

[0009] (v) Insufficient storage security: The local storage of existing edge devices is mostly plaintext storage. If the device is stolen or the hard drive is removed, the recorded data will be directly leaked.

[0010] (vi) Data lost during network outages or unable to be recovered: In a centralized architecture, recording is lost when the network is down, resulting in blank recordings. Existing edge local recording solutions lack automatic retransmission, breakpoint resume, and deduplication mechanisms after network recovery, so data integrity cannot be guaranteed, and the center cannot know the recording gaps of each edge gateway.

[0011] (vii) Difficulty in tracing the source and assigning responsibility after video recordings are leaked: After sensitive surveillance footage was downloaded and leaked in bulk by internal personnel, the existing system lacks speed control measures at the media exit point and it is difficult to locate the source of the leak through watermarking and other technical means, thus failing to form an effective deterrent and chain of evidence for accountability.

[0012] (viii) Insufficient adaptation to the domestic production environment: Existing edge video gateways have limited support for domestic CPUs, domestic operating systems, and the full stack of Chinese cryptographic standards, making them difficult to deploy directly in domestic IT innovation environments and hindering their implementation in high-security scenarios. Summary of the Invention

[0013] The purpose of this invention is to provide a media resource management system based on an edge gateway and its reverse access method, aiming to: solve the technical problem that edge media devices cannot be accessed by the center when they lack a public IP address; achieve standardized interconnection between the center and the edge through peer-to-peer deployment of source software, reducing operational complexity; realize localized storage and encrypted protection of media data, ensuring data sovereignty and data security; provide a flexible permission management mechanism, balancing centralized operation and maintenance efficiency with sensitive data protection; significantly reduce central bandwidth consumption and network operation costs; achieve continuous recording during network outages and self-healing synchronization after network recovery, ensuring data integrity and continuity; provide rate limiting and watermark traceability control at the media egress point, suppressing internal leakage risks and enabling accountability for external leakage; and fully adapt to domestic CPUs and domestic operating systems, meeting the requirements of domestic IT innovation replacement and information security compliance.

[0014] To achieve the above objectives, the present invention provides the following solution: A media resource management system based on edge gateways includes: a central gateway and an edge gateway; The central gateway and the edge gateway are deployed with the same media gateway software and are distinguished by role configuration. The central gateway is deployed in the data center and is used to receive active registration and identity authentication from the edge gateways, maintain a session list of all online edge gateways, receive and issue management instructions, and receive media data returned by the edge gateways and present it to the user. The edge gateway is deployed within a local area network / internal network and is used to access media devices within the local area network, realize local storage, encryption and distribution, maintain a long connection with the central gateway, and respond to instructions issued by the central gateway. After the edge gateway starts up, it actively initiates a long connection request to the central gateway as a TCP client. After two-way authentication, a control channel is established. The central gateway sends an access request instruction to the edge gateway through the control channel. The edge gateway retrieves video files from local storage or pulls real-time streams from cameras according to the instruction, and returns them to the central gateway through the same control channel to realize reverse access of the edge device.

[0015] Optionally, the central gateway and the edge gateway have a built-in configurable switch for switching between private mode and central management mode: In privatization mode, the central gateway can only access data within the authorized scope, and media data can only be accessed within the local area network; In the centralized management mode, the central gateway, with user authorization, can perform at least one of the following operations: resource synchronization, planned cleanup, and resource statistics.

[0016] Optionally, the edge gateway includes: The streaming media service module is used to access network cameras to collect media data, maintain its own session management, perform adaptive bitrate adjustment and real-time transcoding according to network bandwidth conditions, and transmit the target stream data to the central gateway through the control channel according to a preset protocol. The local storage module is used to store the media data using a sharding storage strategy and to build a local index database; The encryption module is used to fully encrypt the media data, index file, and configuration file using the national standard SM4 symmetric encryption algorithm. The storage expansion interface is used to migrate local video files to an object storage system compatible with the S3 protocol, interface with third-party storage systems, implement automatic archiving strategies, tiered management of hot and cold data and retention periods, and verify the consistency of data between the source and target ends based on hash checks during the migration process. If the migration fails, it will automatically roll back and retain the source data. The rate limiting and watermarking module is used to limit the rate of media outflow based on the token bucket algorithm, overlay dynamic digital watermarks on the preview and playback screens in real time, control the download quota according to the user / role / time period configuration of the maximum number of downloads and the maximum cumulative duration, and record audit logs for each media outflow operation.

[0017] Optionally, the process of performing full encryption includes: Each gateway device has a unique device root key, generated by a hardware true random number generator. The encrypted data is stored in a protected partition and is bound to the device hardware characteristics for verification. Each video file uses an independent file key, derived from the device root key. Decryption requires verification of both the legitimate account password and the device root key.

[0018] Optionally, the edge gateway also includes a monitoring and early warning module, which is used to collect multi-dimensional resource monitoring indicators and monitor security events in real time, and to issue alarms according to severity, issue alarms according to preset alarm rules and alarm silence period configuration, and to aggregate alarm information to the central unified alarm platform through standard API.

[0019] Optionally, the edge gateway further includes a network outage fault tolerance module, which is used to continuously record local video during network interruption and mark newly generated video segments as pending synchronization, and automatically report a list of unsynchronized data blocks to the central gateway after the link is restored. After deduplication, the data blocks are transmitted in sequence and resumed from the breakpoint. The central gateway verifies the hash of the received data blocks, updates the synchronization status after confirmation, and sends a receipt to the edge gateway. The edge gateway releases the local cache according to the retention policy.

[0020] Optionally, the edge gateway also includes a domestic IT adaptation layer for adapting to domestic CPU architecture and domestic operating system, integrating SM2 digital signature, SM3 integrity verification and SM4 data encryption and decryption algorithms, and achieving cross-platform deployment through the construction of multiple architectures with the same source code, and realizing hybrid communication of heterogeneous combination of center and edge.

[0021] This invention also provides a reverse access method, applied to a media resource management system based on an edge gateway, comprising: Deploy central and edge gateways, and establish a control channel after two-way authentication; The edge gateway collects media data, writes it to local storage according to the segmentation strategy, and builds a local index database; When the center needs to preview or play back the recording in real time, it sends an access request command through the control channel. After receiving the command, the edge gateway retrieves the recording from local storage or pulls the real-time stream, performs rate limiting and watermark overlay, and then returns it to the central gateway through the control channel. During the network outage, the edge gateway continues to record, encrypt and store the recording locally. Each newly generated segment is marked as pending synchronization. After the link is restored, the edge gateway automatically reports the list of unsynchronized data blocks to the central gateway. The central gateway compares and deduplicates the data block list, pushes missing data blocks according to time, and automatically retransmits a single data block when transmission fails, and continues transmission from the position of failure. The central gateway performs hash integrity verification on the received data blocks. After the verification is successful, it updates the synchronization status and sends a receipt to the edge gateway. The edge gateway then releases its local cache according to the retention policy.

[0022] Optionally, after receiving the instruction, the edge gateway may perform an authorization verification, wherein the authorization verification includes: verifying whether the request source is a registered central gateway instance; checking whether the central gateway has obtained access authorization from the edge gateway; and verifying whether the role permissions of the central user allow the operation to be performed.

[0023] Optionally, the control channel adopts a multiplexing mechanism, with multiple media sessions sharing the same TCP connection, and is scheduled according to the priority of management commands, real-time streams, video playback, and batch synchronization.

[0024] The beneficial effects of this invention are as follows: The reverse access method based on peer-to-peer deployment of the same-origin gateway enables reverse access for edge devices without the need for a public network relay node; no port mapping or NAT configuration is required on the edge side; the center only needs to open one port (reusing 80 / 443), reducing the attack surface; the center and edge are deployed with the same source software, simplifying operation and maintenance; single-channel multiplexing + priority scheduling saves connection resources and ensures real-time services.

[0025] Limited access multi-level permission management mechanism: Data sovereignty is controllable, and central management permissions are opened as needed; all central access behavior is audited throughout the process.

[0026] Media files are encrypted and protected by national cryptographic standards: full encryption storage using national cryptographic standards, data is unreadable if the device is lost; the key is bound to the device and cannot be exported without the device.

[0027] Integrated lightweight deployment and automatic device discovery: One-click deployment and automatic device discovery.

[0028] Network outage fault tolerance and breakpoint resume self-healing synchronization mechanism: Recording is not interrupted during network outage, and automatic retransmission is performed after network recovery, with zero data loss; incremental deduplication + breakpoint resume saves bandwidth and shortens retransmission time.

[0029] Resource outflow rate limiting and digital watermarking to prevent leakage and traceability: Media outflow rate limiting suppresses internal bulk downloads and leakage; dynamic digital watermarking + audit logs enable traceability and accountability for leaks.

[0030] Fully domestically developed software and hardware adaptation: Fully domestically developed software and hardware adaptation and heterogeneous hybrid deployment meet the requirements of domestic replacement and information security compliance.

[0031] The on-demand access mechanism based on the reverse channel's decentralized storage means that edge video data is not uploaded to the center, resulting in zero video storage in the center and significantly reducing the center's storage costs and the risk of data leakage. The center can only access edge recordings on demand through the authorized reverse channel, and data sovereignty belongs entirely to the edge users. The triple linkage of on-demand access, rate-limited watermarking, and full auditing achieves a closed-loop security control system that ensures "visibility, slow downloads, and traceability of leaks." Attached Figure Description

[0032] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0033] Figure 1 This is a framework diagram of a media resource management system based on an edge gateway in an embodiment of the present invention. Detailed Implementation

[0034] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on 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.

[0035] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.

[0036] Example 1: like Figure 1 As shown, this embodiment proposes a media resource management system based on an edge gateway, including: a central gateway and an edge gateway; The central gateway and the edge gateway are deployed with the same media gateway software, and the central node and the edge node are distinguished by role configuration; The central gateway is deployed in the data center and is used to receive active registration and identity authentication from the edge gateways, maintain a session list of all online edge gateways, receive and issue management instructions, and receive media data returned by the edge gateways and present it to the user. The edge gateway is deployed within a local area network / internal network and is used to access media devices within the local area network, realize local storage, encryption and distribution, maintain a long connection with the central gateway, and respond to instructions issued by the central gateway. After the edge gateway starts up, it actively initiates a long connection request to the central gateway as a TCP client. After two-way authentication, a control channel is established. The central gateway sends an access request instruction to the edge gateway through the control channel. The edge gateway retrieves video files from local storage or pulls real-time streams from cameras according to the instruction, and returns them to the central gateway through the same control channel to realize reverse access of the edge device.

[0037] Specifically, the system consists of the following parts: (I) Data Center Side: Central Gateway (Central Node Instance): Deploy one or more instances of media gateway software on servers in the data center as a central aggregation node.

[0038] Network location: Deployed in a data center, with a fixed public IP address or trusted domain name; Port policy: Only one TCP port needs to be opened to the outside world, and ports 80 or 443 for HTTP / HTTPS can be reused; Core responsibilities: Receive proactive registration and authentication from edge gateways; maintain a session list of all online edge gateways; receive and issue management commands; receive media data (including images, video files, and media resource-related data) returned by edge gateways and present it to the user.

[0039] (ii) Edge side: Edge gateway (edge ​​node instance): Deploy a media gateway software instance within the local area network (which can run on embedded devices or x86 / ARM local servers).

[0040] Network location: Deployed in a local area network / internal network, without configuring a public IP address; Network policy: Only one-way access to the data center gateway is required; no inbound port mapping is needed. Core responsibilities: Connecting media devices such as cameras within the local area network; enabling local storage, encryption, and distribution; proactively maintaining a long-term connection with the central gateway; and responding to instructions issued by the central gateway.

[0041] (III) Connection mechanism between gateways: Connection establishment phase: After the edge gateway starts up, it actively initiates a long connection request to the data center gateway as a TCP client (target address: central gateway IP / domain name + port 80 / 443). After two-way authentication, a persistent control channel is established.

[0042] The communication phase includes downlink commands and uplink data: Downlink commands: The central gateway sends request commands to the edge gateway through the established control channel. Uplink data and edge gateways return media data to the central gateway through the same control channel.

[0043] Channel maintenance: The control channel is actively maintained by the edge gateway with a heartbeat, and it automatically reconnects after a disconnection.

[0044] (iv) Channel multiplexing and priority scheduling: The control channel adopts a multiplexing mechanism: multiple concurrent media sessions (such as multiple real-time previews, multiple video playbacks, and batch data synchronization) are distinguished by "session ID" on a single TCP long connection, avoiding the port and resource overhead caused by establishing a separate connection for each session, and allowing the center to carry all services by opening only a single port. Scheduling strategy: Management commands > Real-time stream > Video playback > Batch synchronization, ensuring low-latency delivery of control commands, while cooperating with a network outage fault-tolerant synchronization mechanism to achieve reasonable bandwidth utilization and avoid synchronization tasks crowding out real-time services.

[0045] The essential differences between the method in this embodiment and conventional solutions are shown in Table 1.

[0046] Table 1 Furthermore, the central gateway and the edge gateway have a built-in configurable switch for switching between private mode and central management mode: In privatization mode, the central gateway can only access data within the authorized scope, and media data can only be accessed within the local area network; In the centralized management mode, the central gateway, with user authorization, can perform at least one of the following operations: resource synchronization, planned cleanup, and resource statistics.

[0047] Furthermore, the edge gateway includes: The streaming media service module is used to access network cameras to collect media data, maintain its own session management, perform adaptive bitrate adjustment and real-time transcoding according to network bandwidth conditions, and transmit the target stream data to the central gateway through the control channel according to a preset protocol. The local storage module is used to store the media data using a sharding storage strategy and to build a local index database; The encryption module is used to fully encrypt the media data, index file, and configuration file using the national standard SM4 symmetric encryption algorithm. The storage expansion interface is used to migrate local video files to an object storage system compatible with the S3 protocol, interface with third-party storage systems, implement automatic archiving strategies, tiered management of hot and cold data and retention periods, and verify the consistency of data between the source and target ends based on hash checks during the migration process. If the migration fails, it will automatically roll back and retain the source data. The rate limiting and watermarking module is used to limit the rate of media outflow based on the token bucket algorithm, overlay dynamic digital watermarks on the preview and playback screens in real time, control the download quota according to the user / role / time period configuration of the maximum number of downloads and the maximum cumulative duration, and record audit logs for each media outflow operation.

[0048] Specifically, the streaming media service module is responsible for the access, transcoding, and distribution of camera media streams, serving as the core hub for media data flow within the system. The specific functions and technical implementation of this module are as follows: (1) Multi-protocol media stream access: Supports RTSP (Real Time Streaming Protocol) pull streaming access to mainstream network cameras (including Hikvision, Dahua Technology, Uniview Technologies, etc.), compatible with ONVIF Profile S / G standard protocol, and supports mainstream encoding formats such as H.264, H.265 / HEVC, and MJPEG; at the same time, it supports RTMP (Real-Time Messaging Protocol) push streaming access, and is compatible with the RTMP output capabilities of mainstream NVR / DVR devices.

[0049] (2) Adaptive bitrate and transcoding: Built-in lightweight transcoding engine (based on FFmpeg / GStreamer) supports real-time transcoding operations such as H.265 to H.264 and high resolution to low resolution. It can adaptively adjust the output bitrate according to the network bandwidth conditions (default range 512Kbps~8Mbps) to ensure that usable video quality can still be provided in bandwidth-limited scenarios.

[0050] (3) Multi-protocol distribution: Supports distribution of multiple streaming media protocols such as RTMP, HTTP-FLV (HTTP-based FLV encapsulation), and HLS (HTTP Live Streaming, natively supported by Apple's Safari browser) to meet the playback needs of different clients (Web browser, mobile app, PC client).

[0051] (4) Streaming media session management: When the role is configured as the central gateway, it maintains the status information of all active media sessions (session ID, camera ID, protocol type, bit rate, resolution, start and end time, etc.) and supports session creation, pause, resumption and destruction operations.

[0052] When the role is configured as an edge gateway, it maintains its own session management and supports the configuration of the maximum number of concurrent sessions (default 256, expandable to 1024).

[0053] (5) Edge-side streaming media optimization: The media stream is pulled and transcoded locally at the edge, and only the necessary streaming data is transmitted to the central gateway through the control channel, effectively reducing the central bandwidth consumption; it supports adaptive adjustment of video frame rate (such as reducing from 25fps to 15fps), further reducing the transmission bandwidth under the premise of acceptable image quality loss.

[0054] The local storage module is responsible for the local storage, index management, and historical playback of video files, and is a core component for system data persistence. The specific functions and technical implementation of this module are as follows: (1) Segmented storage strategy: The continuous recording is divided into independent data blocks according to a fixed duration (default 5 minutes / segment, configurable from 1 to 30 minutes). Each data block generates a unique data block ID (consisting of device ID + timestamp + sequence number) and SHA-256 hash fingerprint to ensure the global uniqueness and integrity verifiability of each data block.

[0055] (2) Local index database: Maintain a local index database based on SQLite / MySQL, which records metadata such as file ID, timestamp range, file size, encoding format, resolution, frame rate, and status (normal / pending synchronization / synchronized / deleted) for each data block. It supports efficient retrieval based on time range, camera ID, event tag and other conditions.

[0056] (3) Storage space management: Supports storage quota configuration (such as maximum storage space for a single camera, and the upper limit of total storage space). When the storage space reaches the threshold, the oldest data block is automatically cleaned up according to the "first in first out" (FIFO) strategy. Supports real-time monitoring and alarm of storage utilization.

[0057] (4) Historical playback service: Supports searching historical recordings by timeline, supports playback speed (0.25x / 0.5x / 1x / 2x / 4x / 8x), frame-by-frame playback, timestamp jump and other playback operations; supports multi-screen playback (up to 16 screens can be played back at the same time).

[0058] (5) Event video tagging: Supports integration with intelligent analysis events (such as motion detection, face recognition, boundary crossing detection, etc.) to specially tag the video recordings before and after the event (configurable 30 seconds before and after each time), making it easy to quickly locate key video segments.

[0059] The encryption module is responsible for the national standard cryptographic encryption storage and key management of media data, and is a core component for ensuring system data security. The specific functions and technical implementation of this module are as follows: (1) Full encryption of national cryptographic SM4: The national cryptographic SM4 symmetric encryption algorithm (block cipher, 128-bit key length, 128-bit block size) is used to fully encrypt the video file, index file, and configuration file. The encryption strength meets the requirements of the GM / T 0002-2012 "SM4 block cipher algorithm" standard.

[0060] (2) Device root key management: Each gateway device has a unique device root key (Kd), which is generated by a hardware true random number generator (TRNG) when the device is first started. After being encrypted with SM4, it is stored in a protected partition (such as a TEE trusted execution environment or security chip) and bound and verified with the device hardware characteristics (CPU serial number, eMMC CID, motherboard serial number, etc.) to achieve strong binding between the key and the device. The data cannot be read after the device is lost.

[0061] (3) File key derivation and isolation: Each video file uses an independent file key (Kf), which is derived from the device root key Kd through SM4 (Kf = SM4(Kd, file ID || random salt value)) to achieve key isolation. Even if a single file key is leaked, it will not affect the security of other files, preventing a single point of leakage from causing global risks.

[0062] (4) File storage structure: The storage structure of each encrypted file is as follows: file header (magic number 2 bytes + version number 1 byte + salt value 32 bytes + encrypted Kf 32 bytes + file header CRC32 checksum 4 bytes) + SM4 encrypted data body + tail SM3 hash value 32 bytes. This structure supports streaming encryption and decryption without loading the entire file into memory at once.

[0063] (5) Decryption verification process: SM3 hash verification of account password → read device root key Kd from protected partition → derived file key Kf → SM4 decryption of data body → tail SM3 hash integrity verification. If any step fails verification, access will be denied and a security alarm will be triggered.

[0064] The storage expansion interface provides flexible expansion capabilities for both local and external storage, and is a crucial component for system data asset management. The specific functions and technical implementation of this module are as follows: (1) S3 protocol compatible storage: Supports migrating local video files to S3 protocol compatible object storage systems (such as MinIO, Ceph RGW, Alibaba Cloud OSS, Huawei Cloud OBS, AWS S3, etc.), and supports optimization strategies such as chunked upload, breakpoint resume, and parallel upload to improve the efficiency of large file migration.

[0065] (2) Custom storage integration: Provides standardized RESTful API and SDK to support integration with third-party storage systems (such as NAS, SAN, distributed file system) to meet special storage architecture requirements.

[0066] (3) Storage strategy configuration: Supports flexible storage management functions such as automatic archiving strategy (e.g., automatically archive video to cold storage after 30 days), hot and cold data tiering (hot data is kept on local SSD / NVMe, and cold data is migrated to HDD / S3), retention period management (configure different retention strategies by camera / time period).

[0067] (4) Storage migration engine: Supports online data migration (without interrupting the recording service), automatically verifies the consistency of data between the source and target ends during the migration process (based on SHA-256 comparison), and automatically rolls back and retains the source data when the migration fails.

[0068] The rate limiting and watermarking module is responsible for the security control of media data outgoing routes and is a core component for preventing system data leakage. The specific functions and technical implementation of this module are as follows: (1) Token Bucket Rate Limiting: Based on the Token Bucket algorithm, the media outflow rate is limited. The default bucket capacity is 1MB and the default outflow rate is 2MB / s (configurable from 100Kbps to 100Mbps). Rate limiting policies are set according to user / role (administrators can exempt or set higher thresholds) to prevent batch downloads and fast fetching, while also protecting the central bandwidth.

[0069] (2) Dynamic digital watermark overlay: Based on the FFmpeg drawtext filter (or the GStreamer overlay plugin), a semi-transparent watermark is overlaid in real time on the preview / playback screen. The watermark content includes traceability information such as user ID, device name, timestamp, and session ID. The transparency is about 50%, and the display position rotates in the four corners of the screen every 30 seconds (top left, top right, bottom left, bottom right). It is difficult to remove by simple cropping or covering.

[0070] (3) Download quota control: Configure the maximum number of downloads and the maximum cumulative duration according to user / role / time period (e.g., a single user can download a maximum of 10 times per day and the cumulative duration cannot exceed 2 hours). If the limit is exceeded, the download will be automatically rejected and an alarm will be triggered to prevent malicious batch downloads.

[0071] (4) Full audit log: Each media outflow operation is recorded with a complete audit log (including operator, operation time, device ID, camera ID, data block ID, download duration, download volume, IP address, watermark snapshot, etc.). The log retention period is configurable (default 180 days) and supports export and integration with the central audit platform.

[0072] (5) Configurable switch: The above-mentioned speed limit, watermark, quota control and other functions can be turned on / off independently as needed, taking into account both convenience and security, and meeting the differentiated needs of different security level scenarios.

[0073] Furthermore, the edge gateway also includes a gateway management module, responsible for gateway registration, connection maintenance, and command execution, and is a core component of the system control plane. The specific functions and technical implementation of this module are as follows: (1) Active registration and two-way identity authentication: After the edge gateway starts, it sends a registration request (including device ID, device certificate, timestamp, and random number) to the central gateway. The central gateway verifies the validity of the device certificate (based on SM2 digital certificate) and the timestamp to prevent replay (within 1 minute of the time window). After both parties complete two-way authentication, a trust relationship is established.

[0074] (2) TCP long connection maintenance: Maintain a TCP long connection with the central gateway and detect the link status through a heartbeat mechanism (default 30-second interval, configurable 10~120 seconds). If no heartbeat is received for 3 consecutive times, the link is determined to be interrupted. Reconnection adopts an exponential backoff strategy (initial 1 second, doubled each time, with a maximum of 60 seconds) to avoid frequent reconnection from impacting the network.

[0075] (3) Command execution engine: Receives and executes management commands issued by the central gateway. Command types include: device management (device discovery, configuration update, firmware upgrade), video retrieval (real-time preview, video playback, video download), system management (configuration query, log export, restart / shutdown), scheduled tasks (timed recording, timed backup), etc.

[0076] (4) Command queue and priority processing: The built-in command queue is executed in order of priority (management command > real-time stream > video playback > batch synchronization). High-priority commands can interrupt low-priority tasks to ensure low-latency delivery of management commands.

[0077] (5) Operation status reporting: Periodically (default 60 seconds) report its own operation status (CPU / memory / disk / network utilization, number of online devices, recording duration, number of alarm events, etc.) to the center, and supports event-driven real-time reporting (such as device offline, disk full, security alarm, etc.).

[0078] Furthermore, the edge gateway also includes a monitoring and early warning module, which is used to collect multi-dimensional resource monitoring indicators and monitor security events in real time, and to issue alarms in a graded manner according to the severity, issue alarms according to preset alarm rules and alarm silence period configuration, and to aggregate alarm information to the central unified alarm platform through standard API.

[0079] Specifically, the monitoring and early warning module is responsible for real-time monitoring of system resources and anomaly alerts, and is a core component of system operation and maintenance management. The specific functions and technical implementation of this module are as follows: (1) Multidimensional resource monitoring: Real-time collection of indicators such as disk usage (default threshold 80%), CPU load (default threshold 85%), memory usage (default threshold 90%), network bandwidth (inbound / outbound, default threshold 80%), device online status (camera / storage device), system temperature, etc. The sampling interval is configurable (default 5 seconds).

[0080] (2) Security incident monitoring: Monitor security threats such as abnormal access behavior (e.g., consecutive failed login attempts, access during abnormal time periods), unauthorized device access (unregistered devices attempting to access), data anomalies (e.g., video file integrity verification failure), and system anomalies (e.g., process crashes, service unavailability).

[0081] (3) Tiered Alarm Mechanism: Alarm information is divided into four levels according to severity: Emergency (red, such as device offline, disk full), Severe (orange, such as continuous high CPU load), Warning (yellow, such as insufficient storage space), and Alert (blue, such as configuration change). It supports multiple notification methods such as in-site messages, emails, SMS, and WeChat / DingTalk robots.

[0082] (4) Custom alarm rules: The system supports administrators to customize alarm rules (such as "an alarm will be triggered if the heartbeat times out 3 times in a row" and "an alarm will be triggered if the disk usage exceeds 85% for 5 minutes"). It also supports alarm quiet period configuration (the same alarm will not be pushed repeatedly during the quiet period).

[0083] (5) Centralized alarm aggregation: Supports the aggregation of alarm information to the central unified alarm platform through standard API (RESTful / message queue), realizing centralized alarm management of multiple gateways and multiple sites.

[0084] Furthermore, the edge gateway also includes a network outage fault tolerance module, which is used to continuously record local video during network interruption and mark newly generated video segments as pending synchronization, and automatically report a list of unsynchronized data blocks to the central gateway after the link is restored. After deduplication, the data blocks are transmitted in sequence and resumed from the breakpoint. The central gateway verifies the hash of the received data blocks, updates the synchronization status after confirmation, and sends a receipt to the edge gateway. The edge gateway releases the local cache according to the retention policy.

[0085] Specifically, the network outage fault tolerance module is responsible for ensuring data integrity during network interruptions and automatic synchronization after recovery, and is a core component ensuring system high availability. The specific functions and technical implementation of this module are as follows: (1) Network disconnection detection: The link is determined by the heartbeat timeout (three consecutive heartbeat timeouts, i.e. 90 seconds). At the same time, the TCP connection status (SO_KEEPALIVE probe) is used for double determination to avoid false judgment.

[0086] (2) Resume recording after network outage: During the network outage, the streaming media service module and the local storage module continue to work, and the recording service is not interrupted. Each new segment is marked as "pending synchronization" and written to the local index database.

[0087] (3) Data block list management: Maintain an index list of unsynchronized data blocks (including data block ID, timestamp, size, hash fingerprint, and status), support incremental updates and persistent storage of the list, and ensure that the synchronization status is not lost after restart.

[0088] (4) Synchronization recovery mechanism: After the link is restored, the edge gateway automatically reports the list of unsynchronized data blocks to the center; the center compares the list to complete the deduplication (based on data block hash), and only requires the missing data blocks; the edge gateway pushes data blocks from old to new according to time, and automatically retransmits when a single data block fails to be transmitted (up to 3 times, with exponential backoff of 1s / 2s / 4s), and continues to transmit from the failed position instead of retransmitting the entire file.

[0089] (5) Integrity verification: The center performs SM3 hash verification on the received data blocks, updates the synchronization status after confirmation and sends a receipt to the edge gateway. The edge gateway releases the local cache according to the configurable retention policy (such as releasing immediately after synchronization or releasing after 7 days).

[0090] (6) Synchronization priority scheduling: Synchronization tasks automatically give way to real-time services. When there is a need for real-time preview / playback, the synchronization task is automatically paused or its priority is reduced to ensure that real-time services are not affected.

[0091] Furthermore, the edge gateway also includes a domestic IT application innovation (IT innovation) adaptation layer, which is used for the adaptation of domestic CPU architecture and domestic operating system. It integrates SM2 digital signature, SM3 integrity verification and SM4 data encryption and decryption algorithms, and realizes cross-platform deployment through the construction of multiple architectures with the same source code, and realizes hybrid communication of heterogeneous combination of center and edge.

[0092] Specifically, the domestic IT innovation adaptation layer is responsible for the comprehensive adaptation of domestic software and hardware environments and is a core component for the system to meet the compliance requirements of domestic IT innovation. The specific functions and technical implementation of this module are as follows: (1) Domestic CPU architecture adaptation: Supports domestic processor architectures such as Phytium (ARM64), Kunpeng (ARM64), Loongson (MIPS / LoongArch), Zhaoxin (x86), and Hygon (x86), while being compatible with standard x86 (Intel / AMD) and ARM (Cortex-A series) architectures. A single source code can be used to build multiple architectures through cross-compilation toolchains.

[0093] (2) Domestic operating system adaptation: Supports domestic operating systems such as Kylin (V10 / S10), Tongxin UOS (V20), and Euler openEuler (20.03 / 22.03), and adapts to package management tools (apt / yum / dnf), system service management (systemd), security policies (SELinux / national cryptographic security policy) of each system.

[0094] (3) Full-stack integration of national cryptographic algorithms: Fully integrated national cryptographic libraries (such as BabaSSL, Tongsuo / openssl-tls), supporting SM2 elliptic curve cryptography algorithm (for digital signature and key exchange), SM3 cryptographic hash algorithm (for data integrity verification and hash fingerprint), and SM4 block cipher algorithm (for data encryption and decryption), meeting the requirements of the national cryptographic algorithm series standards of GM / T 0002~0006-2012.

[0095] (4) Multi-architecture construction of source software: A single source code is used to automatically generate binary installation packages (deb / rpm / appimage) for each platform through the CMake / Makefile multi-architecture construction system, providing one-click deployment scripts and configuration migration tools, supporting smooth migration from x86 to domestic CPUs.

[0096] (5) Heterogeneous hybrid deployment capability: Supports multiple heterogeneous combinations such as "IT innovation center + IT innovation edge", "IT innovation center + ARM edge", "x86 center + IT innovation edge", etc., to meet the needs of gradual domestic replacement and ensure normal communication and data interaction between gateways with different architectures.

[0097] (6) Compliance support: The system design meets the relevant requirements of Level 3 of the Information Security Protection 2.0 and the Security Assessment of Commercial Cryptography Applications (Security Assessment), and provides complete cryptography application solution documents and assessment support materials.

[0098] Example 2: This embodiment provides a reverse access method applied to a media resource management system based on an edge gateway, including: Step 1: System Deployment and Initialization Deploy a central gateway instance in the data center, configure it as a central node, bind it to a public IP address / domain name, and open any port (HTTP / HTTPS, commonly used ports 80 and 443 are recommended). Deploy an edge gateway instance in the edge LAN, configure it as an edge node, configure the central gateway address, but do not configure a public IP address. After the edge gateway starts, it completes environment detection and automatic adaptation through the domestic IT adaptation layer, and actively initiates a registration request to the central gateway through the gateway management module. After two-way authentication, a persistent control channel is established.

[0099] Limited access control mechanism with multiple levels of permissions: The media gateway has a built-in configurable switch to toggle between "private mode" and "centralized management mode": Private mode (default): By enabling the private configuration option, the gateway can restrict access to the central network. The central network can only view data within a limited authorized scope, such as operation logs, but media data can only be accessed within the local area network. Centralized Management Mode (Activated by User): With user authorization, the center can perform operations such as resource synchronization, plan cleanup, and resource statistics.

[0100] The system records all access activities to the center, creating an auditable operation log. Users can revoke center management privileges at any time.

[0101] Step Two: Device Discovery and Media Access The edge gateway automatically scans for network cameras compliant with the ONVIF / RTSP standard within the local area network via the streaming media service module. After discovering the device, it automatically completes registration and configuration and begins pulling media streams. The media stream is encrypted by the encryption module and then written to local storage by the local storage module according to a segmentation strategy (e.g., 5 minutes / segment). Each segment generates a unique data block ID and hash fingerprint and is written to the index database.

[0102] The media files stored in the stored procedure are protected by national cryptographic encryption and key isolation, including: The national standard SM4 symmetric encryption algorithm is used to fully encrypt the video files, index files, and configuration files. Each gateway device has a unique device root key, which is bound to the device firmware / hardware characteristics; Each video file uses a unique file key, derived from the device root key; Decryption requires verification of both a valid account password and the device root key.

[0103] Integrated lightweight deployment and automated device discovery include: Cross-platform support: Embedded devices or x86 / ARM servers; Automatically scans network cameras within the local area network that conform to the ONVIF / RTSP standard; Automatically register with the central gateway; It provides a web configuration interface, allowing for deployment with minimal configuration.

[0104] Step 3: Real-time preview and video playback: When the center needs to preview or play back recorded videos in real time, it sends an access request command (including resource identifier, time range, and other parameters) through the established control channel. Upon receiving the command, the edge gateway's gateway management module schedules the streaming media service module to retrieve the video from local storage or pull the live stream from the camera. After the media data is rate-limited and watermarked by the rate-limiting and watermarking module, it is returned to the central gateway through the control channel. The control channel employs a multiplexing mechanism, allowing multiple media sessions to share the same TCP connection. Priorities are allocated according to management commands, live streams, video playback, and batch synchronization, ensuring low-latency delivery of control commands.

[0105] Step 4: Simultaneous Network Disconnection Fault Tolerance and Self-Healing: When the network is interrupted, the network outage tolerance module detects the link failure through heartbeat timeout, while the streaming media service module and local storage module continue to operate, ensuring uninterrupted recording. Recorded data is continuously encrypted and stored, with each new segment marked as pending synchronization. Upon link restoration, the network outage tolerance module automatically reports a list of unsynchronized data blocks (including block IDs and hash fingerprints) to the central system. The central system compares the list to remove duplicates, requesting only the missing data blocks. The edge gateway pushes data blocks from oldest to newest according to time. If a single data block transmission fails, it is automatically retransmitted (up to N times, with exponential backoff), resuming transmission from the point of failure. Synchronization tasks automatically give way to real-time services, ensuring uninterrupted real-time performance.

[0106] This embodiment solves the problem of lost video data and inability to automatically replenish it after recovery during a link interruption between the edge gateway and the central hub by using a self-healing synchronization mechanism that enables network outage fault tolerance and breakpoint resumption. The steps include: Step 1: Video Segmentation and Local Indexing: The edge gateway stores camera recordings in segments of fixed duration (e.g., 5 minutes). Each segment generates a unique data block ID (device ID + timestamp + sequence number) and hash fingerprint, and writes it to the local index database. Step 2: Network Disconnection Detection and Local Resumption of Recording: The link is determined by the heartbeat timeout. During the network outage, the edge gateway continues to record, encrypt and store the video locally, so the recording service is not interrupted at all. Step 3: Restore connection and submit list: After the link is restored, the edge gateway automatically reports the list of unsynchronized data blocks (including data block IDs and hash fingerprints) to the center. Step 4: Incremental deduplication and breakpoint resumption: The central comparison list completes deduplication, requiring only missing data blocks; the edge gateway pushes data in sequence, and automatically retransmits a single data block if the transmission fails (up to N times, exponential backoff), continuing transmission from the failed position instead of retransmitting the entire file. Step 5: Integrity Verification and Status Update The center verifies the hash of the received data block, updates the synchronization status after confirmation, and sends a receipt to the edge gateway. The edge gateway then releases its local cache according to a configurable retention policy.

[0107] Unlike conventional breakpoint resume (HTTP Range, FTP resume, etc. only support single file resume): This embodiment combines video segmentation, hash deduplication, multi-gateway self-healing orchestration and business priority scheduling. It requires no manual intervention, can be smoothly scaled to a large-scale gateway cluster, and works in conjunction with the reverse access channel reuse mechanism, so that synchronous tasks automatically give way to real-time services.

[0108] Step 5: Security Control and Auditing All media leaks are subject to strict rate limiting and watermarking modules. Dynamic watermarks are overlaid with user identification information in real time, forming a chain of evidence for tracing the source of leaks. The monitoring and early warning module continuously monitors system resources and security events, automatically issuing tiered alerts when anomalies occur. All central access activities are recorded in audit logs by the gateway management module, allowing users to review and revoke central management privileges at any time, ensuring data sovereignty.

[0109] Resource outflow rate limiting and digital watermarking for leak prevention and traceability include: Step 1: Configure speed limiting policy: Administrators configure media outflow rates (based on the token bucket algorithm, with adjustable default rates) and daily download quotas (number of downloads / duration) by user / role / time period. Step 2: Mandatory speed limit at the exit: The edge gateway uniformly applies rate limiting to both real-time and playback streams at the media egress point to prevent batch fetching and fast downloading, while also protecting the central bandwidth. Step 3: Dynamic watermark overlay: The preview and playback screens are overlaid with dynamic watermarks in real time (including user ID, device name, timestamp, and session ID). The watermarks are semi-transparent and their positions change dynamically over time, making them difficult to remove by simple cropping or obscuring. Step 4: Full audit record: Each media leak records conversation information, and the logs and watermarks form a dual chain of evidence to support the location and accountability of the leak incident; Step 5: Configurable switch: All of the above functions can be turned on / off as needed, balancing convenience and security.

[0110] Multidimensional resource monitoring and tiered early warning include: It collects real-time data on disk usage, CPU load, memory consumption, network bandwidth, device online status, and security incidents. Warning information is categorized by severity and supports multiple notification methods, including in-site messages, emails, and SMS, and can be aggregated to a unified central alarm platform.

[0111] Step Six: Storage Expansion and Data Management The storage expansion interface supports on-demand migration of local recordings to external storage systems such as S3, and supports storage policy configuration to achieve hot and cold data tiering and automatic archiving. Administrators can centrally manage the storage usage of each edge gateway through the central gateway, achieving centralized data asset management.

[0112] Furthermore, after receiving the instruction, the edge gateway performs an authorization verification, which includes: verifying whether the request source is a registered central gateway instance; checking whether the central gateway has obtained access authorization from the edge gateway; and verifying whether the central user's role permissions allow the operation to be performed.

[0113] Methods for achieving full domestic software and hardware adaptation for IT innovation include: (1) Domestic CPU adaptation: Supports domestic processor architectures such as Phytium, Kunpeng, Loongson, Zhaoxin, and Hygon, while also being compatible with x86 and ARM; (2) Domestic operating system compatibility: Supports domestic operating systems such as Kylin, UnionTech UOS, and Euler openEuler; (3) Full-stack integration of national cryptographic algorithms: SM2 signature verification, SM3 data integrity verification, and SM4 data encryption and decryption; (4) Construction of multiple architectures for software from the same source: one source code can be compiled into multiple architectures, providing one-click deployment packages and configuration migration tools; (5) Heterogeneous hybrid deployment capability: Supports heterogeneous combination hybrid deployment such as "IT innovation center + IT innovation edge" and "IT innovation center + ARM edge" to meet the needs of gradual domestic replacement; (6) Compliance support: Meets the relevant requirements of Level 3 of Cybersecurity Classified Protection 2.0 (Cybersecurity Classified Protection 2.0 Standard) and Security Assessment of Commercial Cryptographic Applications (Security Assessment).

[0114] This embodiment addresses the technical problem of "remotely viewing edge recordings without the center bearing video storage costs" through a reverse channel-based on-demand access mechanism without centralized storage. Its core principle is that video data is always stored solely at the edge gateway; the center does not retain any copies of video files and accesses them on demand only with user authorization via the established reverse channel. Step 1: Edge gateway local storage: The edge gateway encrypts and stores camera recordings on its local disk according to a segmentation strategy, without automatically synchronizing them to the data center. Each data block generates a unique ID and hash fingerprint, which is written to the local index database. The central side does not store any copies of video files, but only maintains the registration information and online status of the edge gateways.

[0115] Step 2: The center initiates an on-demand access request: When a central administrator needs to view the recordings of a certain edge gateway, they send an "on-demand access request" command to the edge gateway through the established control channel. The command includes parameters such as the target camera ID, time range, access type (real-time preview / recording playback), and resolution requirements.

[0116] Step 3: Gateway management module authorization verification: Upon receiving an access request, the gateway management module of the edge gateway performs the following authorization checks: (a) verifying whether the request originates from a registered central gateway instance; (b) checking whether the central gateway has obtained access authorization from the edge gateway (through the permission management mechanism in Innovation Point 2); and (c) verifying whether the central user's role permissions allow the operation. The next step can only proceed after the checks are passed.

[0117] Step 4: Edge-side streaming media processing and outbound control: The gateway management module schedules the streaming media service module to retrieve video files for a specified time period from local storage (or pull live streams from cameras). After being decrypted by the encryption module, the rate limiting and watermarking module implements exit control: it executes token bucket rate limiting and dynamic digital watermark overlay (including central user ID, device name, timestamp, and session ID), and then transmits the media data back to the central gateway through the control channel.

[0118] Step 5: Centralized Presentation and Auditing: The central gateway receives media data and presents it to the user on the client side. Simultaneously, the gateway management module records complete audit logs (including access time, user identity, device ID, camera ID, data block ID, operation type, data volume, etc.), and the log retention period is configurable. The central side does not save any copies of video files, only the audit logs.

[0119] Step 6: Revocation of Access Permissions: Users (edge ​​gateway administrators) can revoke access authorization to the central gateway at any time through the gateway management module. After authorization is revoked, the central gateway will immediately be unable to issue access request commands to that edge gateway, and any established media sessions will be forcibly terminated.

[0120] Unlike conventional solutions (NVR local recording + automatic synchronization / streaming from the center): This embodiment always retains the recorded data on the edge side, with zero video storage at the center, fundamentally eliminating the risk of video data leakage and storage costs at the center side; at the same time, through the authorization verification mechanism of the gateway management module, it is ensured that the center can only access the data as needed with explicit user authorization, and the data sovereignty belongs entirely to the edge side user.

[0121] Example 3: A reverse access method includes: Step 1: Gateway Deployment and Role Configuration: Deploy a media gateway software instance on the data center side, configure it as a "central node" role, bind it to a public IP address or domain name, and open any port to the outside world (it is recommended to use HTTP or HTTPS, commonly used ports 80 and 443).

[0122] Deploy the same media gateway software instance on the edge LAN side, configure it as an "edge node" role, configure the address information of the central gateway, and do not configure a public IP address.

[0123] Step 2: Edge gateway actively registers and establishes connection: After the edge gateway starts up, it actively initiates a connection request to the central gateway as a TCP client. After two-way authentication, a persistent control channel is established.

[0124] Step 3: The center issues instructions through the established channels: The central gateway sends access request instructions (including parameters such as resource identifier and time range) to the edge gateway through the established channel.

[0125] Step 4: The edge gateway executes the command and returns data: The edge gateway retrieves video files from local storage or pulls live streams from cameras and returns them to the central gateway through the same channel.

[0126] Step 5: Channel multiplexing and resource release: After data transmission is completed, the channel remains active for subsequent commands to be reused; multiple media sessions are multiplexed within the same channel using session IDs and scheduled according to the priority of "management commands > real-time stream > video playback > batch synchronization".

[0127] Specifically, system deployment: On the data center side: Standard servers (x86 or domestic CPUs) are used to deploy media gateway central node instances, bind trusted domain names, and only open one port to the outside (it is recommended to use common ports 80 and 443 for HTTP and HTTPS). The firewall is configured to only allow access to that port. Edge side: Deploy embedded gateway devices (such as the RK3588 platform, or a domestic CPU platform) or small servers within the campus / building LAN to connect network cameras such as bullet cameras and PTZ cameras within the LAN; Network topology: The edge gateway accesses the central port unidirectionally via the enterprise's egress NAT without any inbound port mapping; the control channel is based on a TCP long connection and uses national cryptographic TLS (SM2 / SM3 / SM4 suite) or standard TLS encryption.

[0128] Reverse Access Control Protocol: Control channel message frame format: Frame header (4-byte magic number 0x4D474154, 1-byte protocol version, 2-byte message type, 4-byte payload length) + 8-byte session ID + payload data + 4-byte CRC32 checksum; Message types include: registration request (0x01), registration response (0x02), heartbeat (0x03), command issuance (0x04), data feedback (0x05), synchronization list reporting (0x06), synchronization confirmation (0x07), etc. The default heartbeat cycle is 30 seconds. If no heartbeat is received for 3 consecutive times, the link is considered to be interrupted. Reconnection uses exponential backoff (1s, 2s, 4s... up to 60s). Multiplexing: Session ID identifies media sessions, and command frames and data frames are interleaved and transmitted within the same TCP channel without blocking each other.

[0129] National cryptographic encryption storage: When the device is first started, a hardware true random number generator generates a device root key Kd, which is encrypted with SM4 and stored in a protected partition. It is then bound to hardware features (such as CPU serial number and eMMC CID) for verification. Each video file generates an independent file key Kf=SM4(Kd, file ID‖random salt value), and the file storage structure is: file header (magic number + version + salt value + encrypted Kf + checksum) + encrypted data body + tail hash; Decryption process: SM3 hash verification of account password → verification of device root key Kd → derived file key Kf → SM4 decryption of data body → tail hash integrity verification.

[0130] Network outage fault tolerance and resume interrupted download: The video is divided into 5-minute segments, and each segment generates a data block ID (device ID + timestamp + sequence number) and a SHA-256 fingerprint. The metadata is written to a relational database such as MySQL or SQLite index table (data block ID, status, hash, time, size). During the network outage, the status of new fragments is marked as "pending synchronization"; after the link is restored, the edge gateway reports the list of fragments to be synchronized, and the center compares and deduplicates the list and sends back the list of missing fragments. The edge gateway pushes data blocks from oldest to newest according to time. If a single block fails, it can be retransmitted up to 3 times (backoff 1s / 2s / 4s). After success, the center sends an acknowledgment and the edge gateway releases the cache according to the retention policy. Synchronization priority: First, the critical time period associated with the alarm event is filled in, then the ordinary time period is filled in, and the synchronization task automatically gives way to real-time business. This embodiment also supports an on-demand data return mode: the administrator can configure the edge gateway to store data locally only and not upload it to the data center. When the data center needs to view the data, it sends a command through the control channel to access it in reverse. Automatic synchronization mode and on-demand data return mode are two configurable synchronization strategies. The former is suitable for automatic retransmission of regular recordings, while the latter is suitable for local retention of sensitive data. The two can be switched through configuration options and both reuse the same control channel and data block indexing mechanism.

[0131] Speed ​​limits and watermarking implementation include: Token bucket rate limit: Bucket capacity 1MB, outflow rate default 2MB / s configurable, set according to user role (administrators can be exempted). Dynamic watermark: Based on the FFmpeg drawtext filter, a watermark (user ID + device name + timestamp) is superimposed on the preview / playback screen with an opacity of about 50% and the display position rotates in the four corners of the screen every 30 seconds; Download quota: The daily download limit and cumulative duration limit for a single user are configurable. Downloads exceeding the limit will be automatically rejected and an alarm will be triggered.

[0132] This embodiment adopts an access mode of "edge storage, no central storage, and on-demand reverse access" to solve the technical problem that the center can achieve remote preview without bearing the video storage cost.

[0133] The difference between this embodiment and the "automatic synchronization mode" is that in automatic synchronization mode, recorded data is automatically pushed from the edge to the central storage, and the center has a copy of the video; while in on-demand access mode, recorded data always exists only at the edge, and the center only transmits it temporarily when a user actively initiates an access request, without retaining a copy. The two modes can be switched through configuration options, and both reuse the same control channel and data block indexing mechanism.

[0134] The embodiments described above are merely preferred embodiments of the present invention and are not intended to limit the scope of the present invention. Various modifications and improvements made to the technical solutions of the present invention by those skilled in the art without departing from the spirit of the present invention should fall within the protection scope defined by the claims of the present invention.

Claims

1. A media resource management system based on an edge gateway, characterized in that, include: Central gateway and edge gateway; The central gateway and the edge gateway are deployed with the same media gateway software and are distinguished by role configuration. The central gateway is deployed in the data center and is used to receive active registration and identity authentication from the edge gateways, maintain a session list of all online edge gateways, receive and issue management instructions, and receive media data returned by the edge gateways and present it to the user. The edge gateway is deployed within a local area network / internal network and is used to access media devices within the local area network, realize local storage, encryption and distribution, maintain a long connection with the central gateway, and respond to instructions issued by the central gateway. After the edge gateway starts up, it actively initiates a long connection request to the central gateway as a TCP client. After two-way authentication, a control channel is established. The central gateway sends an access request instruction to the edge gateway through the control channel. The edge gateway retrieves video files from local storage or pulls real-time streams from cameras according to the instruction, and returns them to the central gateway through the same control channel to realize reverse access of the edge device.

2. The media resource management system based on an edge gateway according to claim 1, characterized in that, The central gateway and the edge gateway have a built-in configurable switch for switching between private mode and central management mode: In privatization mode, the central gateway can only access data within the authorized scope, and media data can only be accessed within the local area network; In the centralized management mode, the central gateway, with user authorization, can perform at least one of the following operations: resource synchronization, planned cleanup, and resource statistics.

3. The media resource management system based on an edge gateway according to claim 1, characterized in that, The edge gateway includes: The streaming media service module is used to access network cameras to collect media data, maintain its own session management, perform adaptive bitrate adjustment and real-time transcoding according to network bandwidth conditions, and transmit target stream data to the central gateway through the control channel according to a preset protocol. The media data includes images, video files, and media resource-related data. The local storage module is used to store the media data using a sharding storage strategy and to build a local index database; The encryption module is used to fully encrypt the media data, index file, and configuration file using the national standard SM4 symmetric encryption algorithm. The storage expansion interface is used to migrate local video files to an object storage system compatible with the S3 protocol, interface with third-party storage systems, implement automatic archiving strategies, tiered management of hot and cold data and retention periods, and verify the consistency of data between the source and target ends based on hash checks during the migration process. If the migration fails, it will automatically roll back and retain the source data. The rate limiting and watermarking module is used to limit the rate of media outflow based on the token bucket algorithm, overlay dynamic digital watermarks on the preview and playback screens in real time, control the download quota according to the user / role / time period configuration of the maximum number of downloads and the maximum cumulative duration, and record audit logs for each media outflow operation.

4. The media resource management system based on an edge gateway according to claim 3, characterized in that, The process of performing full encryption includes: Each gateway device has a unique device root key, generated by a hardware true random number generator. The encrypted data is stored in a protected partition and is bound to the device hardware characteristics for verification. Each video file uses an independent file key, derived from the device root key. Decryption requires verification of both the legitimate account password and the device root key.

5. The media resource management system based on an edge gateway according to claim 1, characterized in that, The edge gateway also includes a monitoring and early warning module, which is used to collect multi-dimensional resource monitoring indicators and monitor security events in real time, and to issue alarms in a graded manner according to the severity, issue alarms according to preset alarm rules and alarm silence period configuration, and to aggregate alarm information to the central unified alarm platform through standard API.

6. The media resource management system based on an edge gateway according to claim 1, characterized in that, The edge gateway also includes a network outage fault tolerance module, which is used to continuously record local video during network interruption and mark newly generated video segments as pending synchronization, and automatically report a list of unsynchronized data blocks to the central gateway after the link is restored. After deduplication, the data blocks are transmitted in sequence and resumed from the breakpoint. The central gateway verifies the hash of the received data blocks, updates the synchronization status after confirmation, and sends a receipt to the edge gateway. The edge gateway releases the local cache according to the retention policy.

7. The media resource management system based on an edge gateway according to claim 1, characterized in that, The edge gateway also includes a domestic IT adaptation layer for adapting to domestic CPU architecture and domestic operating system. It integrates SM2 digital signature, SM3 integrity verification and SM4 data encryption and decryption algorithms. It achieves cross-platform deployment through the construction of multiple architectures with the same source code and realizes hybrid communication of heterogeneous combination of center and edge.

8. A reverse access method, applied to the media resource management system based on an edge gateway as described in any one of claims 1-7, characterized in that, include: Deploy central and edge gateways, and establish a control channel after two-way authentication; The edge gateway collects media data, writes it to local storage according to the segmentation strategy, and builds a local index database; When the center needs to preview or play back the recording in real time, it sends an access request command through the control channel. After receiving the command, the edge gateway retrieves the recording from local storage or pulls the real-time stream, performs rate limiting and watermark overlay, and then returns it to the central gateway through the control channel. During the network outage, the edge gateway continues to record, encrypt and store the recording locally. Each newly generated segment is marked as pending synchronization. After the link is restored, the edge gateway automatically reports the list of unsynchronized data blocks to the central gateway. The central gateway compares and deduplicates the data block list, pushes missing data blocks according to time, and automatically retransmits a single data block when transmission fails, and continues transmission from the position of failure. The central gateway performs hash integrity verification on the received data blocks. After the verification is successful, it updates the synchronization status and sends a receipt to the edge gateway. The edge gateway then releases its local cache according to the retention policy.

9. The reverse access method according to claim 8, characterized in that, After receiving the instruction, the edge gateway performs an authorization verification, which includes: verifying whether the request source is a registered central gateway instance; checking whether the central gateway has obtained access authorization from the edge gateway; and verifying whether the central user's role permissions allow the execution of the target operation.

10. The reverse access method according to claim 8, characterized in that, The control channel adopts a multiplexing mechanism, with multiple media sessions sharing the same TCP connection, and is scheduled according to the priority of management instructions, real-time streams, video playback, and batch synchronization.

Citation Information

Patent Citations

  • Internet of Things edge intelligent video gateway system

    CN111193753A