A Multi-Mode Video Surveillance Data Acquisition Method

By employing a multi-mode video surveillance data acquisition method, combined with direct connection to the video platform and external screenshot services, the problems of network instability, single point of failure, and limited concurrent access in agricultural and pastoral scenarios have been solved, achieving high availability and stable video data acquisition.

CN123123544APending Publication Date: 2026-11-17SICHUAN STATE-OWNED ASSETS INVESTMENT MANAGEMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611292736.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-25
Publication Date
2026-11-17

AI Technical Summary

Technical Problem

Traditional video surveillance faces challenges in agricultural and pastoral settings, including unstable network environments, high risk of single-point failures, limited concurrent access, and a lack of fault tolerance mechanisms, resulting in poor video surveillance performance.

Method used

A multi-mode video surveillance data acquisition method is adopted, combining the direct connection mode of the video platform and the external screenshot service mode. Through parallel task processing, independent service scope and database, semaphore concurrency control, and failure retry mechanism, high-availability video data acquisition is achieved.

Benefits of technology

In unstable network environments, the video capture success rate was improved from 60% to 92%, ensuring the high availability and stability of the system, avoiding global failures caused by the failure of a single path, and achieving a balance between throughput and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123123544A_ABST
    Figure CN123123544A_ABST
Patent Text Reader

Abstract

This application discloses a multi-mode video surveillance data acquisition method, belonging to the field of video surveillance technology. The method is applied to a video surveillance system and includes: acquiring video data from multiple video data acquisition devices. The acquisition modes include a direct connection mode to a video platform and an external screenshot service mode. In the direct connection mode, the video data is acquired from the video platform to obtain real-time preview image streams from the video data acquisition devices. In the external screenshot service mode, video frames captured by the video data acquisition devices are obtained from the real-time streaming protocol address of the video data acquisition devices through an external screenshot service and converted into image streams. If the acquisition is successful, the video data acquisition devices are marked as normal; if the acquisition fails, the video data acquisition devices are marked as faulty. In response to the acquired video data from the multiple video data acquisition devices, the video data is acquired through parallel task processing. During acquisition, an independent service scope and an independent database are created for each task, and database operations are performed within the independent service scope. This application effectively improves the success rate, system availability, fault tolerance, and maintainability of video surveillance data acquisition in complex agricultural and pastoral network environments.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of video surveillance technology, and in particular relates to a multi-mode video surveillance data acquisition method. Background Technology

[0002] With the advancement of agricultural and pastoral modernization, video surveillance systems have become an important management tool for agricultural and pastoral sites such as ranches and farms. Traditional video surveillance solutions typically rely on a single video platform or direct connection to cameras, but they face the following technical challenges in agricultural and pastoral settings: 1. Unstable network environment Agricultural and pastoral sites are typically located in remote areas with relatively weak network infrastructure, limited bandwidth, and high network latency. When video surveillance relies entirely on cloud platforms, network fluctuations can cause problems such as video stuttering and failed screenshots, severely impacting monitoring effectiveness.

[0003] 2. High risk of single point of failure Traditional solutions use a single video acquisition channel. If this channel fails (such as platform interface downtime or network interruption), the entire monitoring system will fail and no video data can be acquired.

[0004] 3. Limited concurrent access When it is necessary to capture screenshots from a large number of cameras simultaneously, uncontrolled concurrent requests can lead to network congestion and rate limiting of video platform interfaces, thereby reducing the overall availability of the system.

[0005] 4. Lack of fault tolerance mechanism Traditional video acquisition methods typically involve a one-time request, which returns an error directly upon failure. They lack retry mechanisms and degradation strategies, and cannot cope with temporary network jitter or interface timeouts.

[0006] Taking Hikvision's video acquisition solution as an example, as a mainstream video surveillance platform, it provides rich API interfaces. However, in complex network environments, Hikvision's video acquisition solution often fails to acquire screenshots of the current video status due to poor network conditions, leading to incorrect system judgment of the camera's status. Therefore, high availability still needs further optimization. Summary of the Invention

[0007] The purpose of this application is to overcome the shortcomings of the existing technology and provide a multi-mode video surveillance data acquisition method that can achieve highly available video data acquisition in complex network environments in agriculture and animal husbandry.

[0008] The objective of this application is achieved through the following technical solution: A multi-mode video surveillance data acquisition method, applied to a video surveillance system, the method comprising: The system acquires video data from multiple video data acquisition devices. The data acquisition modes include a direct connection mode to the video platform and an external screenshot service mode. In the direct connection mode, the system acquires real-time preview image streams from the video platform. In the external screenshot service mode, the system acquires video frames captured by the video data acquisition devices from the real-time streaming protocol address of the video data acquisition devices through an external screenshot service and converts them into image streams. If the acquisition is successful, the video data acquisition device is marked as normal; if the acquisition fails, the video data acquisition device is marked as faulty. In response to video data acquired from multiple video data acquisition devices, the video data is acquired through parallel task processing. During acquisition, an independent service scope and an independent database are created for each task, and database operations are performed within the independent service scope.

[0009] Furthermore, the video platform direct connection mode for obtaining real-time preview image streams from the video data acquisition device from the video platform includes: Data retrieval requests are signed and authenticated using a hash algorithm; After signature authentication, the application programming interface is called to initiate an HTTP request to the video platform to obtain the real-time preview image stream from the video data acquisition device.

[0010] Furthermore, the external screenshot service mode obtains the video frames captured by the video data acquisition device from the real-time streaming protocol address of the video data acquisition device through the external screenshot service and converts them into image streams, including: Obtain the real-time protocol stream address of the video data acquisition device through the application programming interface of the video platform; Call an external screenshot service, passing in the real-time protocol stream address; The external screenshot service internally connects to the video data acquisition device streaming media server via a real-time protocol stream to capture video frames and convert them into image streams.

[0011] Furthermore, the method also includes: The video surveillance system is pre-configured with video platform information and external screenshot service information.

[0012] Furthermore, the method also includes: The system stores video platform information and external screenshot service information in a database configuration table, and dynamically modifies the acquisition mode during video surveillance system operation.

[0013] Furthermore, the step of marking the video data acquisition device as normal if the acquisition is successful and marking it as faulty if the acquisition fails includes: When the HTTP request fails, it will be retried after a preset time interval. If the request succeeds within no more than the preset number of retries, the status of the corresponding video data acquisition device will be updated to normal. Otherwise, the data acquisition will be performed using the external screenshot service mode. If the external screenshot service mode fails to capture data, it will retry after a preset time interval. If it still fails after reaching the preset maximum number of retries, the video data acquisition device will be marked as faulty.

[0014] Furthermore, the method also includes: The system automatically synchronizes video data acquisition devices at preset time intervals. Before executing the task, it synchronizes the latest device and video data acquisition device list from the video platform. New devices are inserted, and existing devices are updated.

[0015] Furthermore, the concurrency of the semaphore is 5.

[0016] The beneficial effects of this application are as follows: (1) This application integrates the two acquisition channels, "direct connection to video platform" and "external screenshot service", into the same system through a combination of "configuration-driven dual-mode intelligent switching + concurrency control + failure retry + database context isolation", with the two being redundant. When the platform interface crashes or a certain channel network is interrupted, it can switch to another mode to continue acquisition, avoiding the problem of "failure in one place, failure in the whole" in the traditional single-channel solution.

[0017] (2) The multi-mode video surveillance data acquisition method proposed in this application is designed for the network characteristics of remote, weak, and high-latency agricultural and pastoral areas. The external screenshot service pushes the screenshot calculation down to the local / edge external service, which only needs to obtain a lightweight RTSP address from the platform once, avoiding the failure of repeatedly calling the platform's heavy interface under weak network conditions. In actual tests in unstable network environments, the acquisition success rate has been improved from about 60% in single mode to about 92%.

[0018] (3) This application uses semaphores to control the concurrency of batch acquisition, which ensures the acquisition throughput while avoiding local network congestion and platform interface rate limiting caused by uncontrolled concurrency. The stress test shows that the success rate is only 45% with no limit on concurrency and frequent timeouts, while the success rate is about 97% with 5 concurrency and normal response, achieving the optimal balance between throughput and stability.

[0019] (4) This application introduces a retry mechanism, which enables temporary network jitter and instantaneous interface timeout to be recovered automatically through retry without manual intervention, thereby further improving the success rate of data collection.

[0020] (5) This application creates an independent service scope and an independent database instance for each parallel task, eliminating connection competition and thread unsafety issues caused by multiple tasks sharing the same context, and ensuring the correctness and stability of data writing during batch parallel acquisition.

[0021] (6) This application can dynamically select independently configured platform clients according to industry codes (such as agriculture, animal husbandry, coal mining, and non-coal mining) through multi-client configuration and factory mode. Each client uses an independent key to realize the reuse of a set of data collection systems for multiple industries and platforms. Attached Figure Description

[0022] Figure 1 This is a flowchart of a multi-mode video surveillance data acquisition method according to an embodiment of this application; Figure 2 This is a schematic diagram of dual-mode switching in an embodiment of this application; Figure 3 This is a schematic diagram of the video platform direct connection mode process according to an embodiment of this application; Figure 4 This is a timing diagram of the core API signature algorithm in an embodiment of this application; Figure 5 This is a schematic diagram of the external screenshot service mode process in an embodiment of this application; Figure 6 This is a flowchart illustrating the concurrency control process in an embodiment of this application; Figure 7 This is a flowchart of the retry mechanism in an embodiment of this application; Figure 8 This is a flowchart of the timed task scheduling process in an embodiment of this application. Detailed Implementation

[0023] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments, and various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. It should be noted that, unless otherwise specified, the following embodiments and features in the embodiments can be combined with each other.

[0024] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] Current video surveillance technology in agricultural and pastoral settings suffers from problems such as unstable network environment, high risk of single point of failure, limited concurrent access, and lack of fault tolerance mechanisms.

[0026] To address the aforementioned technical problems, the following embodiments of a multi-mode video surveillance data acquisition method are proposed in this application.

[0027] This embodiment provides a multi-mode video surveillance data acquisition method, referring to... Figure 1 ,like Figure 1 The diagram shown is a flowchart of a multi-mode video surveillance data acquisition method according to this embodiment. The method specifically includes the following steps: Step 1: Acquire video data from multiple video data acquisition devices. The data acquisition modes include direct connection mode to the video platform and external screenshot service mode.

[0028] Specifically, the video platform direct connection mode obtains the real-time preview image stream of the video data acquisition device from the video platform, while the external screenshot service mode obtains the video frames captured by the video data acquisition device from the real-time streaming protocol address of the video data acquisition device through the external screenshot service and converts them into image streams.

[0029] Reference Figure 2 ,like Figure 2 The diagram shown is a schematic of the dual-mode switching in this embodiment, and the specific process is as follows: Set the video screenshot acquisition mode according to the current network status. If the current network status is good, that is, the success rate of the video platform to obtain the real-time preview image stream of the video data acquisition device is higher than 95%, or the network packet loss rate of the video platform server is lower than 5%, then use the platform direct connection method; otherwise, set the external service screenshot method and start the video screenshot data acquisition service.

[0030] Step 2: If the acquisition is successful, mark the video data acquisition device as normal; if the acquisition fails, mark the video data acquisition device as faulty.

[0031] Step 3: In response to the video data acquired from multiple video data acquisition devices, the video data is acquired through parallel task processing. During acquisition, an independent service scope and an independent database are created for each task, and database operations are performed within the independent service scope.

[0032] In practical applications, step 1 also includes pre-configuring video platform information and external screenshot service information in the system, including: Video platform information: including platform code, AppKey (public identifier), AppSecret (accompanying private key), host address, port, and whether HTTPS is enabled.

[0033] External screenshot service information: including whether the external service flag is enabled and the service URL address.

[0034] As one implementation method, this embodiment also stores the above configuration through a database configuration table, supporting dynamic modification of the acquisition mode at runtime.

[0035] Select one of the following two modes to acquire camera video data based on the configuration: Mode 1: Direct connection to video platform, refer to... Figure 3 ,like Figure 3 The diagram shown is a flowchart of the video platform direct connection mode in this embodiment. The specific process is as follows: API requests are signed and authenticated using the HMACSHA256 algorithm. Construct a request header that includes parameters such as Content-MD5 (content MD5 digest), timestamp, Nonce (one-time random number), and signature header; Send an HTTP request to the video platform to obtain a real-time preview image stream from the camera; Reference Figure 4 ,like Figure 4 The diagram shown is a timing diagram of the core API signature algorithm in this embodiment. In this embodiment, the signature algorithm specifically includes: Prepare request parameters; Calculate the MD5 value of the request body and Base64 encode it; Construct a signature string in the following format: HTTP method + "\n" + Accept + "\n" + Content-MD5 + "\n" + Content-Type + "\n" + signature header + URL; Use APPSecret as the key to perform HMACSHA256 calculation on the signature string; Add the calculation result to the x-ca-signature field in the request header.

[0036] Mode 2: External screenshot service mode, refer to Figure 5 ,like Figure 5 The diagram shown is a flowchart of the external screenshot service mode in this embodiment. The specific process is as follows: First, obtain the RTSP stream address of the camera through the video platform API; Then, an external screenshot service is called, passing in the RTSP stream address; The external screenshot service internally connects to the camera streaming media server via the RTSP protocol, captures video frames, and converts them into image streams for return.

[0037] Reference Figure 6 ,like Figure 6 The diagram shown is a flowchart of the concurrency control in this embodiment. The specific process is as follows: Use semaphores (SemaphoreSlim) to limit the number of cameras that can be processed simultaneously; The default maximum concurrency is set to 5; When the number of concurrent tasks reaches the limit, subsequent tasks enter the waiting queue; After each task is completed, a semaphore is released, allowing waiting tasks to continue execution.

[0038] Reference Figure 7 ,like Figure 7 The diagram shown is a flowchart of the retry mechanism in this embodiment. The specific process is as follows: This embodiment uses the Polly retry strategy component to implement request retries; The maximum number of retries is set to 3. The retry interval is set to 1 second; Log the current number of retries and the time of the next retry before retrying; If all three retries fail, log the error and mark the data collection as a failure.

[0039] To eliminate connection contention and thread unsafety issues caused by multiple tasks sharing the same context, this embodiment also proposes an independent database context mechanism: Use IServiceScopeFactory (service scope factory interface) to create an independent service scope for each parallel task; Obtain an independent DbContext (database context) instance within each scope; Avoid connection contention issues caused by multiple tasks accessing the same DbContext concurrently.

[0040] The scope and DbContext resources are automatically released upon completion of the task.

[0041] This embodiment also includes a camera status update mechanism: Check the screenshot to see if the camera status was successfully updated. If the screenshot is successful, the status will be updated to "normal". If a screenshot fails and the maximum number of retries is reached, the status is updated to "fault". Record the time of the last successful data acquisition.

[0042] This embodiment also includes an image storage mechanism: Save the acquired image stream to the local file system; Create a directory structure based on the device to which the camera belongs: archives / cameras / {device number}; The file naming format can be: {camera name}-{camera number}.PNG; Create or update OSS records in the database and associate them with image paths.

[0043] As one implementation method, this embodiment also proposes a timed task scheduling mechanism. (Refer to...) Figure 8 ,like Figure 8 The diagram shown is a flowchart of the timed task scheduling process according to an embodiment of this application. The specific process is as follows: Automatically synchronize camera data at preset time intervals (e.g., 10 minutes); Before executing the task, synchronize the latest list of devices and cameras from the video platform; Differentiate between newly added devices and existing devices, and perform insert and update operations respectively.

[0044] As one implementation method, the multi-mode video surveillance data acquisition method provided in this embodiment also supports configuring multiple video platform clients, such as "nmy" (agriculture and animal husbandry), "mk" (coal mine), "fm" (non-coal mine), etc., and dynamically selects the corresponding client instance (e.g., Hikvision client instance) according to the industry code. Each client uses independent AppKey and AppSecret configuration.

[0045] The present invention will now be described in detail with reference to specific embodiments.

[0046] Example 1: Direct Connection Mode to Video Platform In a large ranch monitoring system, 200 Hikvision cameras were deployed, distributed across 10 cattle sheds. The network environment was fiber optic broadband, with ample bandwidth and good stability.

[0047] At this time, the system is configured to use the video platform direct connection mode (UseExternalCaptureService = false): 1. Configuration initialization: Load Hikvision platform configuration from database: { "HikServerConfigs": { "Clients": { "nmy": { "APPkey": "xxx", "APPSecret": "xxx", "Host": "xxx.hik.com", "Port": 443, "IsHttps": true } } }} 2. Equipment synchronization: Call the / api / resource / v1 / device / getDeviceWithPage interface of the Hikvision platform to obtain information on all NVR devices, compare each item, and update the local database.

[0048] 3. Camera synchronization: Call the / api / resource / v1 / cameras interface to obtain all camera information, and filter the cameras belonging to each enterprise based on the enterprise's VideoUnitCode.

[0049] 4. Take a screenshot: Concurrency control: Set the maximum concurrency to 5, allowing a maximum of 5 cameras to be processed simultaneously at any given time. Signature authentication: Each request is signed using the HMACSHA256 algorithm. Request call: After signing with HMACSHA256, call the / nms / outv / nms / ui / operation / monitor / currentImage interface to obtain a real-time image. Retry policy: If the request fails, retry after 1 second, up to a maximum of 3 times. Status Update: If the screenshot is successful, update the camera status to "normal" and save the image to the local file system. Image storage: Saved in the format archives / cameras / {device number} / {camera name}-{camera number}.PNG 5. Execution result: The success rate of screenshots from 200 cameras was 98.5%. The main reason for the failures was that some cameras went offline briefly and then came back online.

[0050] Example 2: External Screenshot Service Mode In a monitoring system for a chicken farm in a remote mountainous area, 50 cameras were deployed. Due to the mountainous location and unstable network signal, direct calls to the Hikvision platform interface frequently timed out and failed.

[0051] The system is now configured to use the external screenshot service mode (UseExternalCaptureService = true): 1. Configuration Initialization In addition to loading the Hikvision platform configuration, it also loads the URL of an external screenshot service: { "VideoPlatformInfo": { "Code": "nmy", "UseExternalCaptureService": true, "ExternalCaptureServiceUrl": "http: / / 192.168.1.100:8080" }} 2. Screenshot Acquisition Process First, the preview address retrieval interface / api / video / v1 / cameras / previewURLs of the Hikvision platform is called to obtain the RTSP (Real-Time Streaming Protocol) stream address of the camera. Then, it calls an external screenshot service, http: / / external-service / Video / Capture, and passes in the RTSP address. The external screenshot service connects to the camera via the RTSP protocol, acquires the video stream, captures the current frame, and returns a JPEG image stream. The retry strategy also applies, with a maximum of 3 retries. 3. Downgrade processing When the external screenshot service also fails, mark the camera status as "faulty" and log detailed error information.

[0052] 4. Execution Results In environments with unstable networks, the system successfully increased the screenshot success rate from 60% in single mode to 92% through dual-mode switching and retry mechanisms.

[0053] Example 3: Concurrency Control Optimization Based on Example 1, a stress test was conducted on the concurrency control, and the test results are shown in Table 1: Table 1. Results of Concurrent Control Stress Test Taking all factors into consideration, it is recommended to set the default concurrency level to 5, which can be dynamically adjusted according to the actual platform load capacity.

[0054] The above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A multi-mode video surveillance data acquisition method, characterized in that, Applied to a video surveillance system, the method includes: The system acquires video data from multiple video data acquisition devices. The data acquisition modes include a direct connection mode to the video platform and an external screenshot service mode. In the direct connection mode, the system acquires real-time preview image streams from the video platform. In the external screenshot service mode, the system acquires video frames captured by the video data acquisition devices from the real-time streaming protocol address of the video data acquisition devices through an external screenshot service and converts them into image streams. If the acquisition is successful, the video data acquisition device is marked as normal; if the acquisition fails, the video data acquisition device is marked as faulty. In response to video data acquired from multiple video data acquisition devices, the video data is acquired through parallel task processing. During acquisition, an independent service scope and an independent database are created for each task, and database operations are performed within the independent service scope.

2. The multi-mode video surveillance data acquisition method as described in claim 1, characterized in that, The video platform direct connection mode obtains real-time preview image streams from the video data acquisition device via the video platform, including: Data retrieval requests are signed and authenticated using a hash algorithm; After signature authentication, the application programming interface is called to initiate an HTTP request to the video platform to obtain the real-time preview image stream from the video data acquisition device.

3. The multi-mode video surveillance data acquisition method as described in claim 1, characterized in that, The external screenshot service mode obtains video frames captured by the video data acquisition device from the real-time streaming protocol address of the video data acquisition device and converts them into image streams, including: Obtain the real-time protocol stream address of the video data acquisition device through the application programming interface of the video platform; Call an external screenshot service, passing in the real-time protocol stream address; The external screenshot service internally connects to the video data acquisition device streaming media server via a real-time protocol stream to capture video frames and convert them into image streams.

4. The multi-mode video surveillance data acquisition method as described in claim 1, characterized in that, The method further includes: The video surveillance system is pre-configured with video platform information and external screenshot service information.

5. The multi-mode video surveillance data acquisition method as described in claim 4, characterized in that, The method further includes: The system stores video platform information and external screenshot service information in a database configuration table, and dynamically modifies the acquisition mode during video surveillance system operation.

6. The multi-mode video surveillance data acquisition method as described in claim 2, characterized in that, The statement that if the acquisition is successful, the video data acquisition device is marked as being in normal condition, and if the acquisition fails, the video data acquisition device is marked as being in fault condition includes: When the HTTP request fails, it will be retried after a preset time interval. If the request succeeds within no more than the preset number of retries, the status of the corresponding video data acquisition device will be updated to normal. Otherwise, the data acquisition will be performed using the external screenshot service mode. If the external screenshot service mode fails to capture data, it will retry after a preset time interval. If it still fails after reaching the preset maximum number of retries, the video data acquisition device will be marked as faulty.

7. The multi-mode video surveillance data acquisition method as described in claim 1, characterized in that, The method further includes: The system automatically synchronizes video data acquisition devices at preset time intervals. Before executing the task, it synchronizes the latest device and video data acquisition device list from the video platform. New devices are inserted, and existing devices are updated.

8. The multi-mode video surveillance data acquisition method as described in claim 1, characterized in that, The method further includes: Semaphores are used to control the concurrency of batch data acquisition. When the number of concurrent tasks reaches the upper limit, subsequent tasks enter the waiting queue. After each task is completed, the semaphore is released, allowing the waiting tasks to continue to execute.

9. The multi-mode video surveillance data acquisition method as described in claim 8, characterized in that, The concurrent number of the semaphore is 5.