Method, device, electronic device and storage medium for generating alarm video

By using a 64-bit unsigned integer to unify the timestamp in the streaming media system to generate alarm videos, the problem of mismatch between alarm videos and alarm frames caused by machine clock asynchrony and network latency is solved, thus improving the accuracy and reliability of the monitoring system.

CN119865581BActive Publication Date: 2025-10-28CHINA TELECOM ARTIFICIAL INTELLIGENCE TECHNOLOGY (BEIJING) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411849014.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-13
Publication Date
2025-10-28
Estimated Expiration
2044-12-13

AI Technical Summary

Technical Problem

In intelligent monitoring systems, due to asynchronous machine clocks and network latency, the timestamps of alarm frames deviate from the actual recording time, resulting in a mismatch between alarm videos and alarm frames, which affects the accuracy and reliability of the monitoring system.

Method used

By using a 64-bit unsigned integer unified timestamp in the streaming media system to generate full-volume recorded video data, and determining the target alarm frame from the recorded video data based on the converted timestamp to generate the target alarm video, the problem of timestamp deviation is solved.

Benefits of technology

It achieves precise time matching between alarm video and alarm frame, improving the accuracy and reliability of the monitoring system and preventing timestamp duplication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119865581B_ABST
    Figure CN119865581B_ABST
Patent Text Reader

Abstract

This invention provides a method, apparatus, electronic device, and storage medium for generating alarm videos. A streaming media system sends target streaming media data to a detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. Full-volume recorded video data is generated. The second target frame of the full-volume recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer. Alarm frame information generated by the detection system based on anomaly detection of the target streaming media data is received. The alarm frame information includes a third timestamp corresponding to the frame requiring an alarm; the data type of the third timestamp is a 32-bit unsigned integer. The third timestamp is converted to obtain a fourth timestamp, and the data type of the fourth timestamp is a 64-bit unsigned integer. Based on the fourth timestamp, the target alarm frame is determined from the full-volume recorded video data, and the target alarm video is generated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the technical field of alarm video generation, and in particular to an alarm video generation method, an alarm video generation apparatus, an electronic device, and a computer-readable storage medium. Background Technology

[0002] In intelligent monitoring systems, algorithms are used to detect anomalies and trigger alarms when an anomaly is detected, generating alarm frames. Alarm frames typically contain alarm information and a timestamp, used to notify the streaming media system to record the abnormal event.

[0003] However, due to machine clock asynchrony and network latency, the timestamp of the alarm frame deviates from the actual recording time, resulting in a mismatch between the alarm video and the alarm frame, which affects the accuracy and reliability of the monitoring system. Summary of the Invention

[0004] In view of the above problems, a method for generating alarm videos, an apparatus for generating alarm videos, an electronic device, and a computer-readable storage medium are proposed to overcome or at least partially solve the above problems, comprising:

[0005] A method for generating alarm videos, applied to a streaming media system connected to a detection system, the method comprising:

[0006] The streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data.

[0007] Generate full recording video data, wherein the second target frame of the full recording video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer;

[0008] The system receives alarm frame information generated by the detection system based on anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame that needs to be alarmed. The data type of the third timestamp is a 32-bit unsigned integer.

[0009] The third timestamp is converted to obtain a fourth timestamp, the data type of the fourth timestamp being a 64-bit unsigned integer;

[0010] Based on the fourth timestamp, the target alarm frame is determined from the full amount of recorded video data, and the target alarm video is generated based on the target alarm frame.

[0011] Optionally, the method further includes:

[0012] When the first timestamp is about to exceed a 32-bit unsigned integer, a new loop is started, and the target streaming media data is assigned a first timestamp starting from 0.

[0013] Optionally, the conversion of the third timestamp to obtain the fourth timestamp includes:

[0014] Determine the target number of iterations;

[0015] The fourth timestamp is determined based on the target number of cycles and the third timestamp.

[0016] Optionally, determining the target number of loops includes:

[0017] The target number of loops is determined based on the current second timestamp and the third timestamp.

[0018] Optionally, determining the fourth timestamp based on the target number of cycles and the third timestamp includes:

[0019] Calculate the product of the target number of iterations and the preset value to obtain the first product value;

[0020] The fourth timestamp is determined based on the first product value and the third timestamp.

[0021] Optionally, the full amount of recorded video data includes multiple video clips, and determining the target alarm frame from the full amount of recorded video data based on the fourth timestamp includes:

[0022] Based on the fourth timestamp, the target video segment is determined from the plurality of video segments;

[0023] And, based on the fourth timestamp, the target alarm frame is determined from the target video recording segment.

[0024] Optionally, generating a target alarm video based on the target alarm frame includes:

[0025] Based on multiple frames before and after the target alarm frame and the target alarm frame, a target alarm video of target length is generated.

[0026] This invention also provides an alarm video generation device for a streaming media system connected to a detection system. The device includes:

[0027] The sending module is used for the streaming media system to send target streaming media data to the detection system, wherein the first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer; the detection system is used to perform anomaly detection on the target streaming media data.

[0028] The first generation module is used to generate the full amount of recorded video data. The second target frame of the full amount of recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer.

[0029] The receiving module is used to receive alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame that needs to be alarmed. The data type of the third timestamp is a 32-bit unsigned integer.

[0030] A conversion module is used to convert the third timestamp to obtain a fourth timestamp, wherein the data type of the fourth timestamp is a 64-bit unsigned integer;

[0031] The second generation module is used to determine the target alarm frame from the full amount of recorded video data according to the fourth timestamp, and generate the target alarm video according to the target alarm frame.

[0032] Optionally, the device further includes:

[0033] The loop module is used to start a new loop when the first timestamp is about to exceed a 32-bit unsigned integer, and to assign the first timestamp to the target streaming media data starting from 0.

[0034] Optionally, the conversion module is used to determine the target number of loops; and to determine the fourth timestamp based on the target number of loops and the third timestamp.

[0035] Optionally, the conversion module is used to determine the target number of cycles based on the current second timestamp and the third timestamp.

[0036] Optionally, the conversion module is used to calculate the product of the target number of cycles and a preset value to obtain a first product value; and to determine the fourth timestamp based on the first product value and the third timestamp.

[0037] Optionally, the full amount of recorded video data includes multiple video segments, and the second generation module is used to determine a target video segment from the multiple video segments based on the fourth timestamp; and to determine the target alarm frame from the target video segment based on the fourth timestamp.

[0038] Optionally, the second generation module is used to generate a target alarm video of target length based on multiple frames before and after the target alarm frame and the target alarm frame.

[0039] This invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the above-described method for generating alarm videos.

[0040] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for generating alarm videos.

[0041] The embodiments of the present invention have the following advantages:

[0042] In this embodiment of the invention, the streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data. It generates full-volume recorded video data, and the second target frame of the full-volume recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer. It receives alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame requiring alarm; the data type of the third timestamp is a 32-bit unsigned integer. The third timestamp is converted to obtain a fourth timestamp, and the data type of the fourth timestamp is a 64-bit unsigned integer. Based on the fourth timestamp, the target alarm frame is determined from the full-volume recorded video data, and a target alarm video is generated based on the target alarm frame.

[0043] The present invention can solve the problem of mismatch between alarm video and alarm frame caused by the deviation between the timestamp of alarm frame and the actual recording time due to machine clock asynchrony and network latency, which affects the accuracy and reliability of the monitoring system.

[0044] Furthermore, the streaming media system standardizes the timestamps of the received RTP video streams to prevent timestamp duplication caused by abnormal timestamps. Attached Figure Description

[0045] To more clearly illustrate the technical solution of the present invention, the accompanying drawings used in the description of the present invention will be briefly introduced below. Obviously, the accompanying 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.

[0046] Figure 1 This is a flowchart illustrating the steps of a method for generating an alarm video according to an embodiment of the present invention;

[0047] Figure 2 This is a flowchart of another method for generating alarm videos according to an embodiment of the present invention;

[0048] Figure 3 This is an overall flowchart of generating an alarm video according to an embodiment of the present invention;

[0049] Figure 4 This is an overall interactive flowchart of generating an alarm video according to an embodiment of the present invention;

[0050] Figure 5 This is a flowchart of an embodiment of the present invention for obtaining a target alarm frame;

[0051] Figure 6 This is a schematic diagram of an RTP packet header according to an embodiment of the present invention;

[0052] Figure 7 This is a schematic diagram of the structure of an alarm video generation device according to an embodiment of the present invention. Detailed Implementation

[0053] 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. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without inventive effort are within the scope of protection of the present invention.

[0054] To address the issue of mismatched alarm videos and alarm frames caused by discrepancies between the timestamps of alarm frames and the actual recording time due to machine clock asynchrony and network latency, thus affecting the accuracy and reliability of the monitoring system, this invention proposes a method for generating alarm videos. This method embeds a precise timestamp (PTS, Presentation) into the alarm frame and uses this timestamp to retrieve the corresponding recording segment in the streaming media system to generate a short alarm video that precisely matches the time of the alarm frame.

[0055] For specific details, please refer to Figure 1 The diagram illustrates a flowchart of a method for generating an alarm video according to an embodiment of the present invention.

[0056] like Figure 1 As shown, the method for generating this alarm video may include the following steps:

[0057] Step 101: The streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp. The data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data.

[0058] In this embodiment of the invention, the method for generating alarm videos can be applied to streaming media systems. A streaming media system is a special type of network service system that allows users to receive and play audio, video, or other multimedia data streams in real time over a network. The core technology of a streaming media system is streaming transmission, meaning that data can be continuously transmitted to the client like flowing water. This is commonly used in scenarios where camera data or captured video footage is transmitted to the user side according to business needs.

[0059] For example, the streaming media system can connect to the detection system, and the streaming media system can transmit streaming media data to the detection system; the detection system can perform anomaly detection on the streaming media data, specifically, a preset time can be set; when the detection system detects a preset event in the streaming media data, it can notify the streaming media system to generate an alarm video.

[0060] Specifically, the streaming media system can send target streaming media data to the detection system; in practical applications, the streaming media system can send target streaming media data to the detection system based on RTP (Real-time Transport Protocol).

[0061] RTP is a network transport protocol widely used for real-time transmission of audio, video, and other media data. In real-time applications, it ensures that audio and video data arrive at the terminal in the appropriate order and at the correct rate. The timestamp in RTP represents 13 hours of real-time physical time; therefore, the data type of the first timestamp of the first target frame in the target streaming media data is a 32-bit unsigned integer.

[0062] The first target frame can be any frame in the target streaming media data, or it can be selected as a portion of the frames according to preset rules to set the first timestamp. This embodiment of the invention does not limit this.

[0063] For example, when a streaming system starts sending a video stream to a detection system, it generates an initial timestamp. This initial timestamp can be any value, but it is usually a large random number to avoid collisions with other streams.

[0064] The timestamp of each subsequent frame is calculated based on the timestamp of the previous frame plus a fixed increment. This increment depends on the video's frame rate. For example, if the unit of the timestamp is 1 / 90000, then the increment is 1 / 90000 of a second. This embodiment of the invention does not impose any limitations on this.

[0065] Step 102: Generate the full amount of recorded video data. The second target frame of the full amount of recorded video data corresponds to a second timestamp. The data type of the second timestamp is a 64-bit unsigned integer.

[0066] On the other hand, streaming media systems can also record and generate the full amount of recorded video data, that is, all the video data.

[0067] In this embodiment, the second target frame of the full recorded video data corresponds to a second timestamp; the second target frame can be each frame in the full recorded video data, or a portion of the frames can be selected as the second target frame to set the second timestamp according to preset rules. This embodiment does not limit this.

[0068] In practical applications, to reduce the number of timestamp loops in a streaming media system and thus avoid time duplication, the system can use uint64 to record internal timestamps, starting from 0. Specifically, the second timestamp of the entire recorded video data is a 64-bit unsigned integer. Compared to a 32-bit unsigned integer that can only represent 13 hours, a 64-bit unsigned integer effectively reduces the number of loops.

[0069] For example, the units of the first and second timestamps are 1 / 90000 of a second. The largest timestamp of a 32-bit unsigned integer corresponds to approximately 47721 seconds. The largest timestamp of a 64-bit unsigned integer corresponds to approximately 204963823041 seconds, or approximately 6500 years.

[0070] Step 103: Receive alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes the third timestamp corresponding to the frame that needs to be alarmed; the data type of the third timestamp is a 32-bit unsigned integer.

[0071] In practical applications, after receiving the target streaming media data, the detection system can perform anomaly detection on the target streaming media data, and when an anomaly is detected, generate alarm frame information for the frame corresponding to the anomaly. The alarm frame information may include the third timestamp corresponding to the frame that needs to be alarmed. Since the alarm frame is determined from the frame in the target streaming media data, the data type of the third timestamp of the frame that needs to be alarmed is also a 32-bit unsigned integer.

[0072] After generating the alarm frame information, the detection system can send the alarm frame information to the streaming media system.

[0073] Step 104: Convert the third timestamp to obtain the fourth timestamp, which is a 64-bit unsigned integer.

[0074] In some feasible embodiments, after receiving alarm frame information, the streaming media system can obtain a third timestamp from it and convert the third timestamp to obtain a fourth timestamp with a data type of 64-bit unsigned integer, so as to complete the unification of data types in the time dimension.

[0075] Step 105: Based on the fourth timestamp, determine the target alarm frame from the full amount of recorded video data, and generate the target alarm video based on the target alarm frame.

[0076] After determining the fourth timestamp of the alarm frame, the streaming media system can use the fourth timestamp to identify the target alarm frame from the full amount of recorded video data, and generate a target alarm video containing the target alarm frame based on the target alarm frame.

[0077] In this embodiment of the invention, the streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data. It generates full-volume recorded video data, and the second target frame of the full-volume recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer. It receives alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame requiring alarm; the data type of the third timestamp is a 32-bit unsigned integer. The third timestamp is converted to obtain a fourth timestamp, and the data type of the fourth timestamp is a 64-bit unsigned integer. Based on the fourth timestamp, the target alarm frame is determined from the full-volume recorded video data, and a target alarm video is generated based on the target alarm frame.

[0078] The present invention can solve the problem of mismatch between alarm video and alarm frame caused by the deviation between the timestamp of alarm frame and the actual recording time due to machine clock asynchrony and network latency, which affects the accuracy and reliability of the monitoring system.

[0079] Furthermore, the streaming media system standardizes the timestamps of the received RTP video streams to prevent timestamp duplication caused by abnormal timestamps.

[0080] Reference Figure 2 The diagram illustrates a flowchart of another method for generating alarm videos according to an embodiment of the present invention, which may include the following steps:

[0081] Step 201: The streaming media system sends the target streaming media data to the detection system.

[0082] The streaming media system can send target streaming media data to the detection system; in practical applications, the streaming media system can send target streaming media data to the detection system based on RTP.

[0083] In one embodiment of the present invention, the above method may further include the following steps:

[0084] When the first timestamp is about to exceed a 32-bit unsigned integer, start a new loop and assign the first timestamp to the target streaming media data starting from 0.

[0085] In some feasible implementations, the actual physical time represented by the RTP timestamp is 13 hours, and a loop will occur after 13 hours. To address this, a new loop can be started when the first timestamp is about to exceed a 32-bit unsigned integer, and a new frame of the target streaming media data can be assigned a first timestamp starting from 0.

[0086] Step 202: Generate the full amount of recorded video data. The second target frame of the full amount of recorded video data corresponds to a second timestamp.

[0087] On the other hand, streaming media systems can also record and generate the full amount of recorded video data, that is, all the video data.

[0088] In this embodiment, the second target frame of the full recorded video data corresponds to a second timestamp; the second target frame can be each frame in the full recorded video data, or a portion of the frames can be selected as the second target frame to set the second timestamp according to preset rules. This embodiment does not limit this.

[0089] In practical applications, to reduce the number of timestamp loops in a streaming media system and thus avoid time duplication issues, the streaming media system can use uint64 to record internal timestamps, starting from 0. Specifically, the second timestamp of the full recorded video data is a 64-bit unsigned integer.

[0090] Step 203: Receive alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data.

[0091] In practical applications, after receiving the target streaming media data, the detection system can perform anomaly detection on the target streaming media data, and when an anomaly is detected, generate alarm frame information for the frame corresponding to the anomaly. The alarm frame information may include the third timestamp corresponding to the frame that needs to be alarmed. Since the alarm frame is determined from the frame in the target streaming media data, the data type of the third timestamp of the frame that needs to be alarmed is also a 32-bit unsigned integer.

[0092] After generating the alarm frame information, the detection system can send the alarm frame information to the streaming media system.

[0093] Step 204: Determine the target number of iterations.

[0094] In practical applications, after receiving alarm frame information, the target number of iterations for the current loop can be determined first.

[0095] In one embodiment of the present invention, the target number of loops can be determined by the following method:

[0096] Determine the target number of loops based on the current second and third timestamps.

[0097] In some feasible embodiments, the target number of loops can be calculated based on the second and third timestamps of the current record of the full amount of recorded video data.

[0098] For example, the number of times the current record of the full video data is divided by the third timestamp and rounded down can be used to obtain the number of times the current RTP stream timestamps have looped, i.e., the target number of loops.

[0099] Step 205: Determine the fourth timestamp based on the target number of loops and the third timestamp.

[0100] In some feasible implementations, a fourth timestamp, in the form of a 64-bit unsigned integer, can be calculated based on the target number of loops and the third timestamp.

[0101] In one embodiment of the present invention, the fourth timestamp can be determined by the following method:

[0102] Calculate the product of the target number of iterations and the preset value to obtain the first product value; determine the fourth timestamp based on the first product value and the third timestamp.

[0103] In some feasible embodiments, the product of the target number of iterations and a preset value can be calculated first to obtain a first product value; wherein, the first product value is 47721.

[0104] Then, based on the first product value and the third timestamp, the fourth timestamp, which determines the data format as a 64-bit unsigned integer, can be calculated.

[0105] Step 206: The full amount of recorded video data includes multiple video clips. Based on the fourth timestamp, the target video clip is determined from the multiple video clips.

[0106] In some feasible embodiments, the full amount of recorded video data may include multiple recorded video segments; after determining the fourth timestamp, the streaming media system can determine the target recorded video segment from the multiple recorded video segments based on the fourth timestamp.

[0107] For example, each recorded video segment is assigned a timestamp of its starting frame, with the data format being a 64-bit unsigned integer.

[0108] After obtaining the fourth timestamp, we can first detect which two starting frame timestamps the fourth timestamp is located between; then, we can determine that the video segment corresponding to the starting frame with the smaller timestamp is the target video segment.

[0109] Step 207: Based on the fourth timestamp, determine the target alarm frame from the target video recording segment.

[0110] After identifying the target video segment, the target alarm frame can be determined from multiple frames of the target video segment based on the fourth timestamp.

[0111] Specifically, after determining the target video segment, the offset value of the frame that needs to be alarmed in the target video segment can be determined based on the fourth timestamp and the timestamp of the starting frame of the target video segment. Furthermore, based on the offset value, the frame at the position corresponding to the offset value in the target video segment can be determined as the target alarm frame, that is, the frame that needs to be alarmed.

[0112] Step 208: Generate a target alarm video of the target length based on multiple frames before and after the target alarm frame and the target alarm frame.

[0113] After determining the target alarm frame, a target alarm video of target length can be generated based on multiple frames before and after the target alarm frame and the target frame. The target length can be any length; specifically, the target length can be set according to actual business requirements, and this embodiment of the invention does not impose any restrictions on it.

[0114] For example, such as Figure 3 As shown, the streaming media system receives RTP streams to provide live streaming services; on the one hand, it can send RTP streams to the AI ​​recognition / detection service of the detection system, and on the other hand, it can generate full-volume recorded video data and report the full-volume recorded video data to the recording service.

[0115] The recording service of the streaming media system can receive alarm frame information sent by the AI ​​recognition / detection service. Based on the alarm frame information, the recording service can identify the target alarm frame, generate the target alarm video and return it to the AI ​​recognition / detection service, as well as store it in the database.

[0116] like Figure 4As shown, the business system can send video detection tasks to the detection system within the business system; the computing power module in the detection system can pull RTP streams from the streaming media system and call algorithm capabilities to detect the RTP streams.

[0117] When the algorithm capability module detects an anomaly, the alarm detection module in the detection system triggers an alarm and generates alarm frame information.

[0118] The timestamp synchronization module in the detection system is responsible for transmitting the PTS timestamp in the alarm frame information to the streaming media system.

[0119] In addition, the business system can also enable video recording, allowing the streaming media recording module of the streaming media system to start recording and obtain the full amount of recorded video data.

[0120] After receiving the PTS timestamp, the video clip retrieval module of the streaming media system retrieves the corresponding video clip from the database.

[0121] The offset determination module of the streaming media system determines the offset of the target alarm frame in the recorded video segment based on the PTS timestamp.

[0122] The alarm short video generation module retrieves the frames before and after the target alarm frame based on the offset, and generates the target alarm video to be returned to the business system.

[0123] like Figure 5 As shown, after the RTP stream is transmitted to the streaming media system, the streaming media system can record video and generate a full set of recorded video data with a data type of 64-bit unsigned integer. The full set of recorded video data can include multiple recorded video segments (recorded video segment 1, recorded video segment 2, ..., recorded video segment n).

[0124] In addition, the detection system can pull RTP streams with data type 32-bit unsigned integers from the streaming media system based on the RTP protocol for parsing; and when an anomaly is detected, it sends alarm frame information to the streaming media system.

[0125] The streaming media system can begin retrieving target alarm frames based on alarm frame information. Specifically, it can first divide the second timestamp by the third timestamp to obtain the target loop count. Then, it can calculate the product of the target loop count and a preset value, and based on the sum of the first product value and the third timestamp, map the third timestamp of the PTS to the fourth timestamp of the streaming media system, which is a 64-bit unsigned integer.

[0126] Based on the fourth timestamp, the target video segment can be identified; then, based on the timestamp of the starting frame of the target video segment and the fourth timestamp, the offset of the target alarm frame in the target video segment can be determined, thereby determining the position of the target alarm frame in the target video segment, and then generating the target alarm video.

[0127] To prevent incorrect timestamps in the upstream video stream, the timestamps in the RTP stream first need to be rewritten, such as... Figure 6 This illustrates an RTP header according to an embodiment of the present invention.

[0128] Bytes 0-1 represent: Version, Padding, Extension, and CSRC Count.

[0129] In byte 0, bits 0-1 represent the version; bit 2 represents padding; bit 3 represents extension; and bits 4-7 represent the CSRC count.

[0130] In 1 byte, bits 0-1 represent the payload type; bit 2 represents the marker; bytes 2-3 represent the sequence number.

[0131] 4-7 bytes: Timestamp;

[0132] Bytes 8-11: SSRC Identifier;

[0133] 12 bytes and beyond: CSRC Identifiers; if there are CSRC identifiers, they will start from 12 bytes, with one identifier every 4 bytes.

[0134] 12+4xCC bytes: Extension Header, which, if present, begins after the CSRC identifier.

[0135] 12+4xCC bytes: Extension Header ID;

[0136] 14 + 4xCC bytes: ExtensionHeaderLength - 16 bits;

[0137] 16 + 4xCC bytes: Extension Header Data

[0138] Version indicates the RTP version number. The current version is 2.

[0139] Padding indicates whether there are padding bytes at the end of the packet.

[0140] Extension indicates whether there is an RTP header extension.

[0141] CSRC Count indicates the number of CSRC identifiers.

[0142] PayloadType indicates the type of load.

[0143] Markers are used to mark important events, such as frame boundaries.

[0144] The sequence number (SequenceNumber) increments by 1 for each RTP packet sent and is used for packet loss detection and sorting.

[0145] The timestamp is 32 bits and indicates the sampling time.

[0146] The SSRC Identifier identifies the synchronization source.

[0147] CSRC Identifiers identify the source of a contribution.

[0148] The extension header contains additional header information.

[0149] Offsets refers to the offset, Octet refers to the byte, and bit refers to the bit position.

[0150] In this embodiment of the invention, the streaming media system sends target streaming media data to the detection system; generates full-volume recorded video data, with the second target frame of the full-volume recorded video data corresponding to a second timestamp; receives alarm frame information generated by the detection system based on anomaly detection of the target streaming media data; determines the target loop count; determines a fourth timestamp based on the target loop count and a third timestamp; the full-volume recorded video data includes multiple recorded video segments, and the target recorded video segment is determined from the multiple recorded video segments based on the fourth timestamp; the target alarm frame is determined from the target recorded video segment based on the fourth timestamp; and a target alarm video of target length is generated based on multiple frames before and after the target alarm frame and the target alarm frame.

[0151] The present invention can solve the problem of mismatch between alarm video and alarm frame caused by the deviation between the timestamp of alarm frame and the actual recording time due to machine clock asynchrony and network latency, which affects the accuracy and reliability of the monitoring system.

[0152] Furthermore, the streaming media system standardizes the timestamps of the received RTP video streams to prevent timestamp duplication caused by abnormal timestamps.

[0153] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0154] Reference Figure 7 The diagram shows a schematic of an alarm video generation device according to an embodiment of the present invention. This alarm video generation device can be applied to a streaming media system, which is connected to a detection system.

[0155] like Figure 7 As shown, the device for generating the alarm video may include the following modules:

[0156] The sending module 701 is used by the streaming media system to send target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data.

[0157] The first generation module 702 is used to generate the full amount of recorded video data. The second target frame of the full amount of recorded video data corresponds to a second timestamp. The data type of the second timestamp is a 64-bit unsigned integer.

[0158] The receiving module 703 is used to receive alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame that needs to be alarmed; the data type of the third timestamp is a 32-bit unsigned integer.

[0159] The conversion module 704 is used to convert the third timestamp to obtain the fourth timestamp, the data type of the fourth timestamp being a 64-bit unsigned integer;

[0160] The second generation module 705 is used to determine the target alarm frame from the full amount of recorded video data based on the fourth timestamp, and generate the target alarm video based on the target alarm frame.

[0161] In an optional embodiment of the present invention, the apparatus further includes:

[0162] Loop module 704 is used to start a new loop when the first timestamp is about to exceed a 32-bit unsigned integer, and to assign the first timestamp to the target streaming media data starting from 0.

[0163] In an optional embodiment of the present invention, the conversion module 704 is used to determine the target number of loops and to determine the fourth timestamp based on the target number of loops and the third timestamp.

[0164] In an optional embodiment of the present invention, the conversion module 704 is used to determine the target number of cycles based on the current second timestamp and third timestamp.

[0165] In an optional embodiment of the present invention, the conversion module 704 is used to calculate the product of the target number of cycles and a preset value to obtain a first product value; and to determine a fourth timestamp based on the first product value and a third timestamp.

[0166] In an optional embodiment of the present invention, the full amount of recorded video data includes multiple video segments. The second generation module 705 is used to determine a target video segment from the multiple video segments based on a fourth timestamp; and to determine a target alarm frame from the target video segment based on the fourth timestamp.

[0167] In an optional embodiment of the present invention, the second generation module 705 is used to generate a target alarm video of target length based on multiple frames before and after the target alarm frame and the target alarm frame.

[0168] In this embodiment of the invention, the streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data. It generates full-volume recorded video data, and the second target frame of the full-volume recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer. It receives alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame requiring alarm; the data type of the third timestamp is a 32-bit unsigned integer. The third timestamp is converted to obtain a fourth timestamp, and the data type of the fourth timestamp is a 64-bit unsigned integer. Based on the fourth timestamp, the target alarm frame is determined from the full-volume recorded video data, and a target alarm video is generated based on the target alarm frame.

[0169] The present invention can solve the problem of mismatch between alarm video and alarm frame caused by the deviation between the timestamp of alarm frame and the actual recording time due to machine clock asynchrony and network latency, which affects the accuracy and reliability of the monitoring system.

[0170] Furthermore, the streaming media system standardizes the timestamps of the received RTP video streams to prevent timestamp duplication caused by abnormal timestamps.

[0171] This invention also provides an electronic device, including a processor, a memory, and a computer program stored in the memory and capable of running on the processor. When the computer program is executed by the processor, it implements the above-described method for generating alarm videos.

[0172] This invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the above-described method for generating alarm videos.

[0173] As the device embodiment is basically similar to the method embodiment, the description is relatively simple, and relevant parts can be found in the description of the method embodiment.

[0174] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0175] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, apparatus, or computer program products. Therefore, embodiments of the present invention can take the form of entirely hardware embodiments, entirely software embodiments, or embodiments combining software and hardware aspects. Furthermore, embodiments of the present invention can take the form of computer program products implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0176] This invention is described with reference to flowchart illustrations and / or block diagrams of methods, terminal devices (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations and / or block diagrams. Figure 1 One or more processes and / or boxes Figure 1A device that provides the functions specified in one or more boxes.

[0177] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0178] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0179] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0180] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0181] The above provides a detailed description of a method for generating alarm videos, an apparatus for generating alarm videos, an electronic device, and a computer-readable storage medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for generating alarm videos, characterized in that, Applied to a streaming media system connected to a detection system, the method includes: The streaming media system sends target streaming media data to the detection system. The first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer. The detection system is used to perform anomaly detection on the target streaming media data. Generate full recording video data, wherein the second target frame of the full recording video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer; The system receives alarm frame information generated by the detection system based on anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame that needs to be alarmed. The data type of the third timestamp is a 32-bit unsigned integer. The third timestamp is converted to obtain a fourth timestamp, the data type of the fourth timestamp being a 64-bit unsigned integer; Based on the fourth timestamp, the target alarm frame is determined from the full amount of recorded video data, and the target alarm video is generated based on the target alarm frame.

2. The method according to claim 1, characterized in that, The method further includes: When the first timestamp is about to exceed a 32-bit unsigned integer, a new loop is started, and the target streaming media data is assigned a first timestamp starting from 0.

3. The method according to claim 2, characterized in that, The conversion of the third timestamp to obtain the fourth timestamp includes: Determine the target number of iterations; The fourth timestamp is determined based on the target number of cycles and the third timestamp.

4. The method according to claim 3, characterized in that, Determining the target number of iterations includes: The target number of loops is determined based on the current second timestamp and the third timestamp.

5. The method according to claim 4, characterized in that, Determining the fourth timestamp based on the target number of cycles and the third timestamp includes: Calculate the product of the target number of iterations and the preset value to obtain the first product value; The fourth timestamp is determined based on the first product value and the third timestamp.

6. The method according to claim 1, characterized in that, The full volume of recorded video data includes multiple video clips. Determining the target alarm frame from the full volume of recorded video data based on the fourth timestamp includes: Based on the fourth timestamp, the target video segment is determined from the plurality of video segments; And, based on the fourth timestamp, the target alarm frame is determined from the target video recording segment.

7. The method according to claim 1, characterized in that, The step of generating a target alarm video based on the target alarm frame includes: Based on multiple frames before and after the target alarm frame and the target alarm frame, a target alarm video of target length is generated.

8. An apparatus for generating alarm videos, characterized in that, Applied to a streaming media system connected to a detection system, the device includes: The sending module is used for the streaming media system to send target streaming media data to the detection system, wherein the first target frame of the target streaming media data corresponds to a first timestamp, and the data type of the first timestamp is a 32-bit unsigned integer; the detection system is used to perform anomaly detection on the target streaming media data. The first generation module is used to generate the full amount of recorded video data. The second target frame of the full amount of recorded video data corresponds to a second timestamp, and the data type of the second timestamp is a 64-bit unsigned integer. The receiving module is used to receive alarm frame information generated by the detection system based on the anomaly detection of the target streaming media data. The alarm frame information includes a third timestamp corresponding to the frame that needs to be alarmed. The data type of the third timestamp is a 32-bit unsigned integer. A conversion module is used to convert the third timestamp to obtain a fourth timestamp, wherein the data type of the fourth timestamp is a 64-bit unsigned integer; The second generation module is used to determine the target alarm frame from the full amount of recorded video data according to the fourth timestamp, and generate the target alarm video according to the target alarm frame.

9. An electronic device, characterized in that, It includes a processor, a memory, and a computer program stored in the memory and capable of running on the processor, wherein the computer program, when executed by the processor, implements the alarm video generation method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, which, when executed by a processor, implements the alarm video generation method as described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Alarm video generation method, alarm video display method and alarm video generation device

    CN112948627A

  • Video alarm method and device, storage medium and electronic equipment

    CN114051120A