A method and apparatus for generating video stream data, and a medium
Patent Information
- Application Number
- CN202310350576.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-30
- Publication Date
- 2026-10-16
- Estimated Expiration
- 2043-03-30
AI Technical Summary
前者读取多路摄像机通道模拟实时视频数据会出现IO或者转发瓶颈,同时从存储系统中读取的数据需要进行解码操作后方可验证数据存储的正确性,流程上复杂且消耗大量的服务器资源
[0049] In addition, the present invention also provides a video stream data generation apparatus and medium, which have the same beneficial effects as the video stream data generation method described above.
Smart Images

Figure CN116320442B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer technology, and in particular to a method, apparatus and medium for generating video stream data. Background Technology
[0002] During the research and development of video storage, the high cost of cameras prevents the large-scale purchase of actual cameras. Consequently, the real-time video stream data cannot accurately reflect the data in actual projects, hindering the effective verification of the video storage system's concurrency capabilities, read / write capabilities, and stability. To ensure the quality and product specifications of the video storage system, developing a service program that simulates real-time video stream data to construct practical application scenarios is an essential step.
[0003] There are two existing methods for simulating real-time video stream data. One method involves repeatedly reading video files to simulate video stream data and writing it to the storage system. The other method generates random numbers within a fixed-size buffer and writes them to the storage system. The former method, which reads data from multiple camera channels to simulate real-time video, encounters I / O or forwarding bottlenecks. Furthermore, the data read from the storage system requires decoding to verify its correctness, making the process complex and resource-intensive. While the latter method avoids I / O or forwarding bottlenecks, the randomness of the data makes it impossible to verify storage correctness, thus failing to accurately simulate real-world usage scenarios.
[0004] Therefore, finding a method for simulating video stream data is a problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this invention is to provide a method, apparatus, and medium for generating video stream data. By reading data from the storage system, it avoids I / O or forwarding bottlenecks. At the same time, it verifies the correctness of the data by continuously incrementing the frame data in the fixed frame rate data packet, saving resources and accurately simulating actual usage scenarios, thus ensuring the quality and product performance of the video storage system.
[0006] To address the aforementioned technical problems, this invention provides a method for generating video stream data, comprising:
[0007] The data packet format of the actual video stream data is obtained, and a fixed frame rate data packet is generated by simulating the data packet format. The frame structure of the fixed frame rate data packet includes key frames and non-key frames. The frame data in the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number.
[0008] The fixed frame rate data packet is written to the storage system, and the generated fixed frame rate data packet is parsed and restored while reading the video stream data from the storage system.
[0009] The correctness of data storage is verified by restoring the fixed frame rate data packets to obtain the verification result.
[0010] Preferably, the data packet format includes at least a data packet length, a keyframe length, a non-keyframe length threshold, and a frame rate, and the step of simulating and generating a fixed frame rate data packet according to the data packet format includes:
[0011] The number of data frames contained in the data packet and the time interval between each data frame are obtained based on the frame rate.
[0012] The first frame of the fixed frame rate data packet is used as the key frame, wherein the length of the key frame is a threshold of the data packet length of the current fixed frame rate data packet;
[0013] The non-key frames are determined based on the relationship between the data packet length and the key frame length;
[0014] Obtain the server's current time as the frame time of the fixed frame rate data packet;
[0015] The frame data corresponding to the key frame and the non-key frame are continuously incremented;
[0016] The fixed frame rate data packet is generated according to the data packet format, the number of data frames, the time interval, the key frame, the non-key frame, the frame time, and the frame data.
[0017] Preferably, before writing the fixed frame rate data packet to the storage system, the method further includes:
[0018] Obtain the channel cache data list of the camera channel corresponding to the actual video stream data;
[0019] Create a thread corresponding to the camera channel to generate a list object of the channel cache data list corresponding to the camera channel;
[0020] The fixed frame rate data packet is inserted at the end of the list object, and the process proceeds to the step of writing the fixed frame rate data packet to the storage system.
[0021] Preferably, before inserting the fixed frame rate data packet at the end of the list object, the method further includes:
[0022] Determine if the current list object is full;
[0023] If so, discard the fixed frame rate data packet and record it in the variable parameter of the failed data packet;
[0024] If not, proceed to the step of inserting the fixed frame rate data packet at the end of the list object.
[0025] Preferably, writing the fixed frame rate data packet to the storage system includes:
[0026] Obtain the header frame data of the current list object;
[0027] The header frame data is packaged into data of the data structure corresponding to the storage system;
[0028] Determine whether the data has been written to the storage system;
[0029] If so, the data will be recorded in the variable parameter field of the successfully written data packet;
[0030] If not, the data is recorded in the variable parameter of the failed write data packet.
[0031] Preferably, the step of parsing and restoring the generated fixed frame rate data packet when reading the video stream data from the storage system includes:
[0032] Obtain query rules and perform video retrieval in the storage system according to the query rules to obtain a list of video time period information. The query rules include at least the channel name, start time and end time. The video time period information list stores at least the time period ID, the service address of the node where the time period is located, and the start time and end time of the video time period.
[0033] Based on the list of recording time periods, determine the node where the current recording time period is located and read the video stream data;
[0034] The video stream data is parsed to obtain the restored fixed frame rate data packet.
[0035] Preferably, the step of verifying the correctness of data storage based on the restored fixed frame rate data packets to obtain a verification result includes:
[0036] Obtain the restored fixed frame rate data packet and the corresponding original fixed frame rate data packet written to the storage system;
[0037] Obtain the fixed frame rate data packet and the corresponding data structure and frame data of the original fixed frame rate data packet;
[0038] If the data structure corresponding to the fixed frame rate data packet and the original fixed frame rate data packet is the same, then it is determined whether the increment number corresponding to the frame data of the fixed frame rate data packet and the original fixed frame rate data packet is the same.
[0039] If the increments are the same, then the restored fixed frame rate data packet is correct.
[0040] To address the aforementioned technical problems, the present invention also provides a video stream data generation apparatus, comprising:
[0041] The generation module is used to obtain the data packet format of the actual video stream data and simulate and generate a fixed frame rate data packet according to the data packet format. The frame structure of the fixed frame rate data packet includes key frames and non-key frames. The frame data in the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number.
[0042] The writing module is used to write the fixed frame rate data packet to the storage system, and to parse and restore the generated fixed frame rate data packet when reading the video stream data of the storage system;
[0043] The verification module is used to verify the correctness of data storage based on the restored fixed frame rate data packets to obtain the verification result.
[0044] To address the aforementioned technical problems, the present invention also provides a video stream data generation apparatus, comprising:
[0045] Memory, used to store computer programs;
[0046] A processor is configured to execute the computer program to implement the steps of the video stream data generation method as described above.
[0047] To address the aforementioned technical problems, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the video stream data generation method described above.
[0048] This invention provides a method for generating video stream data, comprising: acquiring the data packet format of actual video stream data, and simulating the generation of a fixed frame rate data packet based on the data packet format, wherein the frame structure of the fixed frame rate data packet includes keyframes and non-keyframes, the frame data within the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number; writing the fixed frame rate data packet to a storage system, and parsing and restoring the generated fixed frame rate data packet while reading video stream data from the storage system; and verifying the correctness of data storage based on the restored fixed frame rate data packet to obtain a verification result. This method generates a fixed frame rate data packet identical to the actual video stream data packet in real time, which includes keyframes and non-keyframes, avoiding the complex operation of decoding data read from the storage system before verifying data correctness. Compared to existing decoding operations, the fixed frame rate data packet of this application does not require decoding of keyframes during the reading process, saving decoding operations. By reading data from the storage system, it avoids I / O or forwarding bottlenecks, and by verifying data correctness based on the continuously incrementing frame data within the fixed frame rate data packet, it saves resources and accurately simulates actual usage scenarios, ensuring the quality and product performance of the video storage system.
[0049] In addition, the present invention also provides a video stream data generation apparatus and medium, which have the same beneficial effects as the video stream data generation method described above. Attached Figure Description
[0050] To more clearly illustrate the embodiments of the present invention, the accompanying 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.
[0051] Figure 1 A flowchart illustrating a method for generating video stream data according to an embodiment of the present invention;
[0052] Figure 2 A schematic diagram illustrating a method for simulating and generating video stream data according to an embodiment of the present invention;
[0053] Figure 3 A structural diagram of a video stream data generation device provided in an embodiment of the present invention;
[0054] Figure 4 This is a structural diagram of another video stream data generation device provided in an embodiment of the present invention. Detailed Implementation
[0055] 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 of ordinary skill in the art without creative effort are within the protection scope of the present invention.
[0056] The core of this invention is to provide a method, apparatus, and medium for generating video stream data. By reading data from the storage system, it avoids I / O or forwarding bottlenecks. At the same time, it verifies the correctness of the data by continuously incrementing the frame data in the fixed frame rate data packet, saving resources and accurately simulating actual usage scenarios, thus ensuring the quality and product performance of the video storage system.
[0057] To enable those skilled in the art to better understand the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0058] It should be noted that existing methods that simulate video stream data writing to the storage system by repeatedly reading video files require multiple simulation service programs to operate concurrently. Furthermore, the data read from the storage system must be decoded and played back to verify the correctness of the data storage. This process is complex and consumes significant server resources. Because the simulation program consumes substantial server resources during data read / write operations, a dedicated server is needed to run the simulation service program and ensure the accuracy of the video storage system's metrics, making it impossible to realistically simulate actual project usage scenarios. Additionally, defining a fixed-size buffer space for each camera channel and generating a fixed-size random number for each frame results in a uniform frame size, which differs from real-time video stream data and also fails to accurately simulate real-world usage scenarios. Based on these two methods, the video stream data generation method provided by this invention generates fixed-frame-rate data packets identical to real video stream data packets in real time and writes these simulated fixed-frame-rate data packets to the storage system.
[0059] Figure 1 A flowchart of a method for generating video stream data provided in an embodiment of the present invention is shown below. Figure 1 As shown, the method includes:
[0060] S11: Obtain the data packet format of the actual video stream data, and simulate and generate fixed frame rate data packets based on the data packet format;
[0061] The frame structure of a fixed frame rate data packet includes key frames and non-key frames. The frame data in a fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number.
[0062] S12: Write the fixed frame rate data packet to the storage system, and parse and restore the generated fixed frame rate data packet while reading the video stream data from the storage system;
[0063] S13: Verify the correctness of data storage based on the restored fixed frame rate data packets to obtain the verification result.
[0064] It should be noted that the data packet format for acquiring the actual video stream data is not limited to any particular format of the actual video stream data. Typically, it is a Group of Pictures (GOP) data set, which is a group of consecutive images within a video encoded by the Moving Picture Experts Group (MPEG). Each video encoded using the MPEG standard consists of several consecutive image sets. A fixed frame rate data packet is generated based on this data packet format. The frame result of this data packet includes keyframes and non-keyframes. The frame data within the fixed frame rate data packet is a continuously incrementing number, with the first frame data set having a preset value. In other words, the data packet contains multiple frames, and the relationship between these frames is a continuously incrementing number.
[0065] As one embodiment, the data packet format includes at least the data packet length, keyframe length, non-keyframe length threshold, and frame rate. Simulating and generating a fixed frame rate data packet based on the data packet format includes:
[0066] The number of data frames contained in the data packet and the time interval between each data frame are obtained based on the frame rate.
[0067] The first frame of a fixed frame rate data packet is used as the key frame, where the key frame length is a threshold of the current fixed frame rate data packet length.
[0068] Non-key frames are determined based on the relationship between data packet length and keyframe length;
[0069] Obtain the server's current time as the frame time for fixed frame rate data packets;
[0070] Set the frame data corresponding to key frames and non-key frames as continuously incrementing numbers;
[0071] Generate corresponding fixed frame rate data packets based on the data packet format, number of data frames, time interval, key frames, non-key frames, frame time, and frame data.
[0072] Specifically, a global variable is defined whose data packet format is the same as that of the actual video stream data packets. This data packet format includes at least the data packet length, keyframe length, non-keyframe length threshold, and frame rate. The number of data frames contained in the data packet and the time interval between each data frame are obtained based on the frame rate. For example, a frame rate of 25 means 25 frames per second, with a time interval of 40ms per frame.
[0073] The first frame of a fixed frame rate data packet is designated as the keyframe, and its length is a threshold of the current fixed frame rate data packet length. Non-keyframes are determined based on the relationship between the data packet length and the keyframe length. For example, the keyframe length is 1 / 4 of the data packet length, and the length of all remaining non-keyframes is 3 / 4 of the data packet length. The threshold can be set according to actual conditions and is not limited here.
[0074] Understandably, the length of non-critical frames is a random number between half the average length of non-critical frames and the average length of non-critical frames, the frame time is the server's current time, and the frame data is a continuously incrementing number. A corresponding fixed frame rate data packet is generated based on the set data frame format, number of data frames, time interval, critical frames, non-critical frames, frame time, and frame data.
[0075] Keyframes are fully coded frames that can be decoded without participating in other frame data. Non-keyframes can be P-frames and / or B-frames. P-frames are called forward predictive coded frames, which need to be decoded with reference to the preceding I-frames and P-frames. P-frame data only encodes the difference between itself and the preceding I / P-frame data, thus reducing the amount of data after encoding. B-frames are called bidirectional predictive coded frames, which are predicted by the preceding I / P-frames and the following P-frames. This can greatly reduce the amount of data after encoding.
[0076] The simulated fixed frame rate data packets are written to the storage system, and then parsed and reconstructed by reading the video stream data from the storage system. It should be noted that the fixed frame rate data packets written to and read from the storage system are not necessarily the same data at the same moment. Due to the interval between writing and reading, the fixed frame rate data packets currently written to the storage system may be read at another time; their writing and reading are asynchronous. However, they are fixed frame rate data packets of the same format.
[0077] When video stream data is read from the storage system, it is parsed and restored to obtain a restored fixed frame rate data packet. The restored data is then compared with the previously written data to verify its correctness.
[0078] As one embodiment, verifying the correctness of data storage based on the restored fixed frame rate data packets to obtain a verification result includes:
[0079] Obtain the restored fixed frame rate data packet and the corresponding original fixed frame rate data packet written to the storage system;
[0080] Obtain fixed frame rate data packets and the corresponding data structure and frame data of the original fixed frame rate data packets;
[0081] If the data structures corresponding to the fixed frame rate data packets and the original fixed frame rate data packets are the same, then determine whether the increments corresponding to the frame data of the fixed frame rate data packets and the original fixed frame rate data packets are the same.
[0082] If the increments are the same, then the restored fixed frame rate data packets are correct.
[0083] Understandably, the data structure and frame data of the data written and read are compared separately. The order of comparison between the data structure and frame data is not important. If either comparison result is different, the verification result is incorrect. Only when both comparison results are the same is the verification result correct. This implementation first compares the data structure. If the data structure comparison results are the same, it then checks whether the increment of the frame data is the same. If they are the same, the verification result is correct.
[0084] For example: verify the correctness of data packets and frame rates based on the parsed frame time, frame type, and frame data size, and continuously store the frame data content in a local temporary file; read the data in the temporary file and verify the correctness of the data content by judging whether the data is a continuous incrementing number.
[0085] Figure 2 This is a schematic diagram of a method for simulating and generating video stream data according to an embodiment of the present invention, as shown below. Figure 2 As shown, the data generation stage involves generating fixed-frame-rate data packets in real time, following the same method as real video stream GOP data packets. The data writing stage involves packaging the generated real-time frame data into the data structure required by the storage system and continuously writing the data stream according to the storage system's writing requirements. The data reading stage involves randomly reading data from a specific channel's time range from the storage system, parsing and restoring it to the original generated frame data, verifying the correctness of the data packets and frame rate through frame time, frame type, and frame data size, and verifying the correctness of data storage by detecting whether the frame data content is a continuously incrementing number.
[0086] This invention provides a method for generating video stream data, comprising: acquiring the data packet format of actual video stream data, and simulating the generation of a fixed frame rate data packet based on the data packet format, wherein the frame structure of the fixed frame rate data packet includes keyframes and non-keyframes, the frame data within the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number; writing the fixed frame rate data packet to a storage system, and parsing and restoring the generated fixed frame rate data packet while reading video stream data from the storage system; and verifying the correctness of data storage based on the restored fixed frame rate data packet to obtain a verification result. This method generates a fixed frame rate data packet identical to the actual video stream data packet in real time, which includes keyframes and non-keyframes, avoiding the complex operation of decoding data read from the storage system before verifying data correctness. Compared to existing decoding operations, the fixed frame rate data packet of this application does not require decoding of keyframes during the reading process, saving decoding operations. By reading data from the storage system, IO or forwarding bottlenecks are avoided. Simultaneously, verifying data correctness based on the continuously incrementing frame data within the fixed frame rate data packet saves resources and accurately simulates actual usage scenarios, ensuring the quality and product performance of the video storage system.
[0087] Based on the above embodiments, before writing the fixed frame rate data packet to the storage system in step S12, the method further includes:
[0088] Obtain the channel cache data list of the camera channel corresponding to the actual video stream data;
[0089] Create a thread corresponding to the camera channel to generate a list object of the channel cache data list corresponding to the camera channel;
[0090] Insert the fixed frame rate data packet at the end of the list object and proceed to the step of writing the fixed frame rate data packet to the storage system.
[0091] Specifically, in defining global variables, in addition to defining the data packet format, it is also necessary to obtain the channel cache data list of the camera channel corresponding to the actual video stream data, then create a data generation thread for each channel, and generate a list object of the cache data list for that channel. The simulated fixed frame rate data packets generated in the above embodiment are inserted at the end of the list object to facilitate the subsequent writing of the fixed frame rate data packets to the storage system.
[0092] Additionally, as an example, the method further includes, before inserting fixed frame rate packets at the end of the list object:
[0093] Determine if the current list object is full;
[0094] If so, discard the fixed frame rate data packet and record it in the variable parameter of the failed data packet;
[0095] If not, proceed to the step of inserting fixed frame rate packets at the end of the list object.
[0096] The system checks if the current list object is full. If so, it discards the current fixed frame rate data packet and records it in the variable parameter of the failed data packet. If not, it inserts it at the end of the list object. If the list is full, the frame is discarded, and the size of the discarded frame is appended to the variable recording the size of the failed write. This simulates the process of a real camera generating a stream and discarding some newly received frame data when data writing is too slow.
[0097] As one embodiment, writing the fixed frame rate data packet to the storage system in step S12 includes:
[0098] Get the header frame data of the current list object;
[0099] Pack the header frame data into data of the corresponding data structure of the storage system;
[0100] Determine whether data has been written to the storage system;
[0101] If so, the data will be recorded in the variable parameter field where the data packet was successfully written.
[0102] If not, the data will be recorded in the variable parameter of the failure write data packet.
[0103] Specifically, the header frame data of the current list object is obtained, and the header frame data is packaged into corresponding data according to the data structure of the storage system. The data is written to the storage system, and it is determined whether the data was written successfully. If the writing is successful, the data is recorded in the variable parameter of the successfully written data packet; if the writing fails, the data is written to the variable parameter of the failed writing data packet.
[0104] For example: create a write thread for each channel based on the number of channels; retrieve a frame of data from the head of the corresponding list for a certain channel; if the data retrieval is successful, proceed to the next step; package the retrieved data into the data structure required by the storage system; write the data to the storage system; if the write is successful, append the size of the frame of data to the variable recording the successfully written data; if the write fails, append the size of the frame of data to the variable recording the failed write data.
[0105] The process of writing data to the storage system provided in this embodiment packages the generated real-time frame data into the data structure required by the storage system, continuously writes the data stream according to the writing requirements of the storage system, and records and counts the number of bytes successfully written and the number of bytes that failed to write based on the success or failure of the writing result, so as to facilitate the subsequent reading of the data from the storage system.
[0106] Based on the above embodiments, step S12, which involves parsing and restoring the generated fixed frame rate data packets while reading the video stream data from the storage system, includes:
[0107] Obtain the query rules and perform video retrieval in the storage system according to the query rules to obtain a list of video time period information. The query rules include at least the channel name, start time and end time. The video time period information list stores at least the time period ID, the service address of the node where the time period is located, and the start time and end time of the video time period.
[0108] Based on the list of recording time periods, determine the node where the current recording time period is located and read the video stream data;
[0109] The video stream data is parsed to obtain the restored fixed frame rate data packets.
[0110] Specifically, the process involves obtaining query rules, retrieving recordings from the storage system based on these rules to obtain a list of recording time periods, determining the node containing the current recording time period, and then reading the video stream data at that node. This video stream data is then parsed to obtain the restored fixed frame rate data packets.
[0111] It should be noted that the query rules must include at least the channel name, start time, and end time. Since the camera has multiple channels, the node location needs to be found based on the current channel and the channel name. The recording time period information list must at least store the time period identification document (ID), the service address of the node containing the time period, and the start and end times of the recording time period.
[0112] The specific data reading process is as follows:
[0113] (1) Search the storage system for video recordings based on query conditions such as channel name, start time, and end time;
[0114] (2) Receive the list of recording time period information returned by the storage system. The recording time period information includes the time period ID, the service address of the node service where the time period is located, the start time, the end time, and other information.
[0115] (3) Read data from the node service where the recording is located based on the time period ID, start time, end time and other information;
[0116] (4) Parse the data read from the storage system.
[0117] In this embodiment of the invention, the storage system is a cluster system, and the reading process needs to determine the location of the node in order to improve the reading speed.
[0118] The foregoing has described in detail various embodiments corresponding to the video stream data generation method. Based on this, the present invention also discloses a video stream data generation apparatus corresponding to the above-described method. Figure 3 This is a structural diagram of a video stream data generation device provided in an embodiment of the present invention. Figure 3 As shown, the device for generating video stream data includes:
[0119] The generation module 11 is used to obtain the data packet format of the actual video stream data and simulate the generation of a fixed frame rate data packet according to the data packet format. The frame structure of the fixed frame rate data packet includes key frames and non-key frames. The frame data in the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number.
[0120] The writing module 12 is used to write fixed frame rate data packets to the storage system, and to parse and restore the generated fixed frame rate data packets when reading the video stream data from the storage system.
[0121] The verification module 13 is used to verify the correctness of data storage based on the restored fixed frame rate data packets to obtain the verification result.
[0122] Since the embodiments of the device part correspond to the embodiments described above, please refer to the embodiments described in the method part for the embodiments of the device part, and will not be repeated here.
[0123] For a description of the video stream data generation apparatus provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above video stream data generation method.
[0124] Figure 4 A structural diagram of another video stream data generation device provided in an embodiment of the present invention is shown below. Figure 4 As shown, the device includes:
[0125] Memory 21 is used to store computer programs;
[0126] Processor 22 is used to implement the steps of a method for generating video stream data when executing a computer program.
[0127] The video stream data generation device provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0128] The processor 22 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 22 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 22 may also include a main processor and a coprocessor. The main processor, also known as the Central Processing Unit (CPU), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 22 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 22 may also include an Artificial Intelligence (AI) processor, which handles computational operations related to machine learning.
[0129] The memory 21 may include one or more computer-readable storage media, which may be non-transitory. The memory 21 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 21 is used to store at least the following computer program 211, which, after being loaded and executed by the processor 22, is capable of implementing the relevant steps of the video stream data generation method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 21 may also include an operating system 212 and data 213, etc., and the storage method may be temporary storage or permanent storage. The operating system 212 may include Windows, Unix, Linux, etc. The data 213 may include, but is not limited to, the data involved in the video stream data generation method, etc.
[0130] In some embodiments, the video stream data generation apparatus may further include a display screen 23, an input / output interface 24, a communication interface 25, a power supply 26, and a communication bus 27.
[0131] Those skilled in the field can understand, Figure 4 The structure shown does not constitute a limitation on the means of generating video stream data and may include more or fewer components than shown.
[0132] The processor 22 implements the video stream data generation method provided in any of the above embodiments by calling instructions stored in the memory 21.
[0133] For a description of the video stream data generation apparatus provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above video stream data generation method.
[0134] Furthermore, the present invention also provides a computer-readable storage medium storing a computer program, which, when executed by processor 22, implements the steps of the video stream data generation method described above.
[0135] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0136] For an introduction to the computer-readable storage medium provided by the present invention, please refer to the above method embodiments. The present invention will not be described in detail here, but it has the same beneficial effects as the above video stream data generation method.
[0137] The foregoing has provided a detailed description of a video stream data generation method, a video stream data generation apparatus, and a medium provided by the present invention. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to the present invention without departing from the principles of the invention, and these improvements and modifications also fall within the protection scope of the claims of the present invention.
[0138] It should also be noted that, in this specification, 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 apparatus 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 apparatus. 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 apparatus that includes said element.
Claims
1. A method for generating video stream data, characterized in that, include: The data packet format of the actual video stream data is obtained, and a fixed frame rate data packet is generated by simulating the data packet format. The frame structure of the fixed frame rate data packet includes key frames and non-key frames. The frame data in the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number. The key frames do not need to be decoded. The fixed frame rate data packet is written to the storage system, and the generated fixed frame rate data packet is parsed and restored while reading the video stream data from the storage system. The correctness of data storage is verified based on the restored fixed frame rate data packets to obtain the verification result; Correspondingly, the data packet format includes at least the data packet length, keyframe length, non-keyframe length threshold, and frame rate, and the step of simulating and generating a fixed frame rate data packet according to the data packet format includes: The number of data frames contained in the data packet and the time interval between each data frame are obtained based on the frame rate. The first frame of the fixed frame rate data packet is used as the key frame, wherein the length of the key frame is a threshold of the data packet length of the current fixed frame rate data packet; The non-key frames are determined based on the relationship between the data packet length and the key frame length; Obtain the server's current time as the frame time of the fixed frame rate data packet; The frame data corresponding to the key frame and the non-key frame are continuously incremented; The fixed frame rate data packet is generated according to the data packet format, the number of data frames, the time interval, the key frame, the non-key frame, the frame time, and the frame data.
2. The method for generating video stream data according to claim 1, characterized in that, Before writing the fixed frame rate data packet to the storage system, the method further includes: Obtain the channel cache data list of the camera channel corresponding to the actual video stream data; Create a thread corresponding to the camera channel to generate a list object of the channel cache data list corresponding to the camera channel; The fixed frame rate data packet is inserted at the end of the list object, and the process proceeds to the step of writing the fixed frame rate data packet to the storage system.
3. The method for generating video stream data according to claim 2, characterized in that, Before inserting the fixed frame rate data packet at the end of the list object, the method further includes: Determine if the current list object is full; If so, discard the fixed frame rate data packet and record it in the variable parameter of the failed data packet; If not, proceed to the step of inserting the fixed frame rate data packet at the end of the list object.
4. The method for generating video stream data according to claim 2 or 3, characterized in that, The step of writing the fixed frame rate data packet to the storage system includes: Obtain the header frame data of the current list object; The header frame data is packaged into data of the data structure corresponding to the storage system; Determine whether the data has been written to the storage system; If so, the data will be recorded in the variable parameter field of the successfully written data packet; If not, the data is recorded in the variable parameter of the failed write data packet.
5. The method for generating video stream data according to claim 4, characterized in that, The step of parsing and restoring the generated fixed frame rate data packet when reading the video stream data from the storage system includes: Obtain query rules and perform video retrieval in the storage system according to the query rules to obtain a list of video time period information. The query rules include at least the channel name, start time and end time. The video time period information list stores at least the time period ID, the service address of the node where the time period is located, and the start time and end time of the video time period. Based on the list of recording time periods, determine the node where the current recording time period is located and read the video stream data; The video stream data is parsed to obtain the restored fixed frame rate data packet.
6. The method for generating video stream data according to claim 5, characterized in that, The step of verifying the correctness of data storage based on the restored fixed frame rate data packets to obtain the verification result includes: Obtain the restored fixed frame rate data packet and the corresponding original fixed frame rate data packet written to the storage system; Obtain the fixed frame rate data packet and the corresponding data structure and frame data of the original fixed frame rate data packet; If the data structure corresponding to the fixed frame rate data packet and the original fixed frame rate data packet is the same, then it is determined whether the increment number corresponding to the frame data of the fixed frame rate data packet and the original fixed frame rate data packet is the same. If the increments are the same, then the restored fixed frame rate data packet is correct.
7. A device for generating video stream data, characterized in that, include: The generation module is used to acquire the data packet format of the actual video stream data and simulate and generate a fixed frame rate data packet according to the data packet format. The frame structure of the fixed frame rate data packet includes key frames and non-key frames. The frame data in the fixed frame rate data packet is a continuously incrementing number, and the first frame data is a preset number. The key frames do not need to be decoded. The writing module is used to write the fixed frame rate data packet to the storage system, and to parse and restore the generated fixed frame rate data packet when reading the video stream data of the storage system; The verification module is used to verify the correctness of data storage based on the restored fixed frame rate data packets in order to obtain the verification result; Correspondingly, the data packet format includes at least the data packet length, keyframe length, non-keyframe length threshold, and frame rate, and the step of simulating and generating a fixed frame rate data packet according to the data packet format includes: The number of data frames contained in the data packet and the time interval between each data frame are obtained based on the frame rate. The first frame of the fixed frame rate data packet is used as the key frame, wherein the length of the key frame is a threshold of the data packet length of the current fixed frame rate data packet; The non-key frames are determined based on the relationship between the data packet length and the key frame length; Obtain the server's current time as the frame time of the fixed frame rate data packet; The frame data corresponding to the key frame and the non-key frame are continuously incremented; The fixed frame rate data packet is generated according to the data packet format, the number of data frames, the time interval, the key frame, the non-key frame, the frame time, and the frame data.
8. A device for generating video stream data, characterized in that, include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the steps of the method for generating video stream data as described in any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the video stream data generation method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Video code stream output control apparatus and method
CN105681825A
Data proofreading method, device and system, server and equipment
CN113064888A
Memory sub-system self-testing operations
US10984881B1