High frame rate video recording method, device, computer equipment and storage medium

By using binary streams to save frame data in high frame rate video recording and using a circular linked list to manage file names, the problems of frame drop and memory exhaustion in high frame rate video shooting are solved, and real-time recording of high frame rate video and efficient management of the storage system are achieved.

CN114969429BActive Publication Date: 2025-09-09PING AN TECH (SHENZHEN) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210548612.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-20
Publication Date
2025-09-09
Estimated Expiration
2042-05-20

AI Technical Summary

Technical Problem

Existing high-frame-rate video shooting methods have problems with frame drops and memory exhaustion. Especially when shooting high-frame-rate videos, untimely frame data processing leads to memory accumulation and system crashes.

Method used

Frame data is saved as file data in the form of binary stream, and a circular linked list is used to manage file names. Independent threads read and write video files one by one in the order in which the files are saved to avoid frame data accumulation. A circular linked list is used to manage the reuse of file names to reduce storage fragmentation.

Benefits of technology

It enables real-time recording of high-frame-rate video, avoids frame drops and memory exhaustion, improves recording functionality and user experience, and reduces storage system fragmentation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969429B_ABST
    Figure CN114969429B_ABST
Patent Text Reader

Abstract

The present application discloses a high frame rate video recording method, device, computer equipment and storage medium. The method includes: obtaining frame data generated during the high frame rate video recording process, saving the frame data as file data in the form of a binary stream; naming the file data according to the set naming rules, and using a circular linked list to record the file names of all file data, each file name corresponds to a node in the circular linked list; using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video; marking the file data written into the video file corresponding to the file name in the circular linked list as available. While realizing real-time recording of high frame rate video, the present application avoids frame loss and frame drop caused by slow processing, and will not cause memory exhaustion, while avoiding excessive fragmentation of the storage system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing technology, and in particular to a high frame rate video recording method, apparatus, computer equipment, and storage medium. Background Art

[0002] With the rapid development of the mobile phone industry, many mobile phones are now capable of shooting high-frame-rate videos. When shooting high-frame-rate videos, in order to control parameters such as exposure and frame rate, it is not possible to use the system's highly encapsulated shooting functions, but must use basic APIs (Application Programming Interfaces) to achieve this. Using basic APIs requires developers to handle the saving of each frame themselves. During the processing, if the frame-spitting thread is busy or blocked, the system will automatically discard the subsequent frames. In addition, when writing a frame to a video file of a specific format, there will be intermediate processing, and it is not simply appending the data.

[0003] Currently, high-frame-rate video capture typically uses a simultaneous capture and storage method in memory, meaning each frame is saved as the system camera outputs it. For standard frame rates (e.g., 30 fps), the relatively long frame interval (typically around 33 milliseconds) allows for simultaneous frame storage. However, at high frame rates (240 fps), the shorter frame interval and device performance factors mean that the time required to write a frame may exceed the camera's frame output interval, resulting in frame drops. Furthermore, because the system uses the same memory for both frame output and frame storage, if the frame output thread is busy or blocked, saving the frame cannot be executed in a separate thread. Copying the frame data to another memory block before saving it in a separate thread can lead to frame accumulation, memory exhaustion, and ultimately a program crash. Therefore, simultaneous capture and storage in memory is not advisable for high-frame-rate video capture. Summary of the Invention

[0004] The present application provides a high frame rate video recording method, apparatus, computer equipment and storage medium, aiming to solve technical problems such as frame drops and memory exhaustion due to frame accumulation in existing high frame rate video shooting methods.

[0005] In order to solve the above technical problems, the technical solutions adopted in this application are:

[0006] A high frame rate video recording method, comprising:

[0007] Acquire frame data generated during high frame rate video recording, and save the frame data as file data in the form of a binary stream;

[0008] The file data is named according to a set naming rule, and a circular linked list is used to record the file names of all file data, each file name corresponds to a node in the circular linked list;

[0009] Using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video;

[0010] The file data written into the video file is marked as available in the circular linked list corresponding to the file name.

[0011] The technical solution adopted in the embodiment of the present application further includes: saving the frame data as file data in the form of a binary stream includes:

[0012] The frame data is saved as file data in the form of a binary stream using the ofstream class in the C++ system library.

[0013] The technical solution adopted in the embodiment of the present application also includes: the naming rule of the file data is specifically: user parameters + video recording time + current cumulative number of video frames.

[0014] The technical solution adopted by the embodiment of the present application also includes: using an independent thread to read the file data one by one according to the storage order of the file data and write them into the video file specifically:

[0015] Use the ifstream class in the C++ system library to read file data and write it to the video file.

[0016] The technical solution adopted by the embodiment of the present application further includes: after marking the file data written into the video file and the corresponding file name in the circular linked list as available, the following steps are further included:

[0017] Determine whether the current high frame rate video recording has ended. If the recording has ended,

[0018] Determine whether to record a new high frame rate video. If so,

[0019] Re-save the frame data generated during the high frame rate video recording process as file data in the form of a binary stream, and query whether there is an available file name from the circular linked list according to the set query rules. If so,

[0020] The available file names in the circular linked list are used as file names for newly saved file data.

[0021] The technical solution adopted by the embodiment of the present application further includes: if there is no available file name in the circular linked list, re-saving the frame data generated during the high frame rate video recording process in the form of a binary stream as file data further includes:

[0022] The newly saved file is named according to the set naming rule, and the file name is inserted into the circular linked list as a new node.

[0023] The technical solution adopted by the embodiment of the present application also includes: the querying whether there is an available file name from the circular linked list according to the set query rules is specifically as follows:

[0024] Two pointers are set up, one pointer points to the most recently inserted node in the circular linked list, and the other pointer points to the last node marked as available in the circular linked list. When querying whether there is an available file name from the circular linked list, start from the most recently inserted node and traverse to the last node marked as available.

[0025] Another technical solution adopted in the embodiment of the present application is: a high frame rate video recording device, comprising:

[0026] Data storage module: used to obtain frame data generated during high frame rate video recording and save the frame data as file data in the form of binary stream;

[0027] The first file naming module is used to name the file data according to the set naming rules, and use a circular linked list to record the file names of all file data, each file name corresponds to a node in the circular linked list;

[0028] File reading module: used to use an independent thread to read file data one by one according to the storage order of the file data and write them into the video file to generate a complete high frame rate video;

[0029] Linked list updating module: used for marking the file name corresponding to the file data written into the video file in the circular linked list as available.

[0030] Another technical solution adopted in the embodiment of the present application is: a computer device, the computer device comprising:

[0031] a memory storing executable program code;

[0032] a processor connected to the memory;

[0033] The processor calls the executable program code stored in the memory to execute the high frame rate video recording method as described in the above high frame rate video recording method.

[0034] Another technical solution adopted in the embodiment of the present application is: a storage medium storing program instructions executable by a processor, wherein the program instructions are used to execute the above-mentioned high frame rate video recording method.

[0035] The high-frame-rate video recording method, apparatus, computer equipment, and storage medium of the embodiments of the present application utilize file transfer to save real-time captured frame data in the form of a binary stream as file data, and then read the file data one by one into the video file in the order in which the files are saved, thereby forming a complete high-frame-rate video. While achieving real-time high-frame-rate video recording, it avoids frame loss and dropped frames caused by slow processing and does not cause memory exhaustion. At the same time, the present application utilizes a circular linked list to manage the reuse of file names to avoid excessive fragmentation of the storage system. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 1 is a flowchart of a high frame rate video recording method according to a first embodiment of the present application;

[0037] Figure 2 2 is a flow chart of a high frame rate video recording method according to a second embodiment of the present application;

[0038] Figure 3 Schematic diagram of the structure of a high frame rate video recording device according to an embodiment of the present application;

[0039] Figure 4 is a schematic diagram of the computer device structure of an embodiment of the present application;

[0040] Figure 5 It is a schematic diagram of the storage medium structure of an embodiment of the present application. DETAILED DESCRIPTION

[0041] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0042] The terms "first," "second," and "third" in this application are used only for descriptive purposes and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first," "second," or "third" may explicitly or implicitly include at least one of such features. In the description of this application, "multiple" means at least two, for example, two, three, etc., unless otherwise specifically defined. All directional indications in the embodiments of this application (such as up, down, left, right, front, back...) are only used to explain the relative positional relationship, movement, etc. between the components under a specific posture (as shown in the accompanying drawings). If the specific posture changes, the directional indications also change accordingly. In addition, the terms "including" and "having," as well as any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, system, product, or device that includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products, or devices.

[0043] References herein to "embodiments" mean that a particular feature, structure, or characteristic described in connection with the embodiments may be included in at least one embodiment of the present application. The appearance of this phrase in various places in the specification does not necessarily refer to the same embodiment, nor does it constitute an independent or alternative embodiment that is mutually exclusive of other embodiments. It is understood, both explicitly and implicitly, by those skilled in the art that the embodiments described herein may be combined with other embodiments.

[0044] See also Figure 1 , is a flow chart of a high frame rate video recording method according to the first embodiment of the present application. The high frame rate video recording method according to the first embodiment of the present application comprises the following steps:

[0045] S100: Acquire frame data generated during high frame rate video recording, and save the frame data as file data in the form of a binary stream;

[0046] Specifically, the frame data generated during high-frame-rate video capture is saved as a binary stream to a file using the ofstream (output file stream) class in the C++ system library. Because this is directly stored without any intermediate processing, saving the file data takes less time than writing the frame data to the video file, avoiding blocking the system's frame output thread and maintaining the recorded video's frame rate.

[0047] S110: Naming the file data according to the set naming rules, and using a circular linked list to record the file names of all file data, each file name corresponds to a node in the circular linked list;

[0048] Among them, the naming rule of file data is specifically: user parameters + video recording time + current cumulative number of frames of the video. For example, the file name of a certain file data is: PA_2022_04_24_25, where PA is the user parameter, 2022_04_24 is the video recording time, and 25 is the current cumulative number of frames of the video. A circular linked list is another form of chain storage structure. The characteristic of a circular linked list is that the pointer field of the last node in the table points to the head node, and the entire linked list forms a loop, so other nodes in the table can be found from any node in the table. In the embodiment of the present application, each file name corresponds to a node in the circular linked list, and the circular linked list is used to uniformly manage all file names, which facilitates the reuse of file names in the subsequent process and avoids excessive fragmentation of the storage system.

[0049] S120: Using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video;

[0050] In order to achieve real-time recording, an independent thread is opened to read the file data one by one in the order in which the file data is saved and write the read data to the video file until all the file data of the current video is read, thereby avoiding memory exhaustion caused by frame accumulation and ensuring the normal operation of the app. Taking IOS as an example, the independent thread can use the dispatch_async of the GCD API provided by the IOS system. The specific way for the independent thread to read file data is: use the ifstream class in the C++ system library to read the file data and write it to the video file, thereby avoiding frame loss due to busy or blocked frame spitting threads and memory exhaustion caused by frame accumulation, which is conducive to improving the function, performance and user experience of high frame rate video recording.

[0051] S130: Mark the file data written into the video file and the file name corresponding to it in the circular linked list as available;

[0052] When the saved file data is processed, the corresponding file name in the circular linked list is marked as available. The next time new file data is saved, the file name marked as available in the circular linked list is directly used as the file name for the newly saved file data. This avoids excessive storage space and storage system fragmentation caused by using a unique file name for each file data. If there is no available file name in the circular linked list, a new file name is generated and inserted as a new node in the circular linked list.

[0053] See also Figure 2, is a flow chart of a high frame rate video recording method according to a second embodiment of the present application. The high frame rate video recording method according to the second embodiment of the present application comprises the following steps:

[0054] S200: Enable high frame rate video recording;

[0055] S210: saving the frame data generated during the high frame rate video recording process as file data in the form of a binary stream;

[0056] This step saves the frame data generated during high-frame-rate video capture as a binary stream to a file using the ofstream (output file stream) class in the C++ system library. Because this is direct storage without any intermediate processing, saving the file data takes less time than writing the frame data to the video file, avoiding blocking the system's frame output thread and maintaining the recorded video's frame rate.

[0057] S220: Name each file data in the binary stream form according to the set naming rules, and use a circular linked list to record all file names;

[0058] In this step, the naming rule of the file data is specifically: user parameters + video recording time + current cumulative number of frames of the video. For example, the file name of a certain file data is: PA_2022_04_24_25, where PA is the user parameter, 2022_04_24 is the video recording time, and 25 is the current cumulative number of frames of the video. A circular linked list is another form of chain storage structure. The characteristic of a circular linked list is that the pointer field of the last node in the table points to the head node, and the entire linked list forms a loop, so other nodes in the table can be found from any node in the table. In the embodiment of the present application, each file name corresponds to a node in the circular linked list, and the circular linked list is used to uniformly manage all file names, which facilitates the reuse of file names in the subsequent process and avoids excessive fragmentation of the storage system.

[0059] S230: Using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video;

[0060] In this step, to achieve real-time recording, an independent thread is started to read the file data one by one in the order in which the file data is saved and write the read data to the video file until all the file data for the current video is read. This avoids memory exhaustion caused by frame accumulation and ensures the normal operation of the app. Taking iOS as an example, the independent thread can use the dispatch_async method of the GCD API provided by the iOS system. The specific method for the independent thread to read file data is to use the ifstream class in the C++ system library to read the file data and write it to the video file.

[0061] Based on the above, this application uses file transfer to generate real-time recorded high-frame rate video. There may be a short delay after the user manually stops the video recording (unfinished file data needs to be processed). A waiting status can be displayed to inform the user, but it avoids frame loss due to busy or blocked frame spitting threads and memory exhaustion caused by frame accumulation, which is conducive to improving the function, performance and user experience of high-frame rate video recording.

[0062] S240: For the processed file data, mark the corresponding file name in the circular linked list as available;

[0063] S250: Determine whether the current high frame rate video recording is finished. If not, continue to execute S210; if finished, execute S260:

[0064] S260: Determine whether to perform a new high frame rate video recording. If a new high frame rate video recording is performed, execute S270:

[0065] S270: re-save the frame data generated during the high frame rate video recording process as file data in the form of a binary stream, and query whether there is an available file name from the circular linked list according to the set query rule. If so, execute S280; otherwise, execute S290;

[0066] In this step, since the size of each frame data is the same, the file data is directly overwritten with the newly generated frame data, without having to search for another space block in the system to store the frame data, thus avoiding excessive storage fragmentation.

[0067] S280: Using the available file names in the circular linked list as the file names of the newly saved file data, and re-execute S230;

[0068] S290: Name the newly saved file according to the set naming rule, insert the file name as a new node into the circular linked list, and re-execute S230;

[0069] In the above steps, after the file data of preservation is processed and finishes, the file name corresponding in the circular linked list is marked as available, when preserving new file data next time, directly the file name marked as available in the circular linked list is used as the file name of the new preservation file data, avoid the excessive storage space and storage system fragmentation that each file data uses a unique file name to cause. If there is no available file name in the circular linked list, regenerate a new file name, and insert this file name into the circular linked list as a new node. Simultaneously, because the length of the circular linked list is longer, when querying available file names, if traversing the whole circular linked list can be more time-consuming. In order to speed up query speed, the embodiment of the application is by setting up two pointers, wherein one of them points to the node most recently inserted in the circular linked list, and another pointer points to the last node that is marked as available in the circular linked list. When querying available file names, starting from the node most recently inserted, traversing to the last node that is marked as available finishes, thereby greatly speeding up the query speed of available file names.

[0070] Based on the above, the high-frame-rate video recording method of the second embodiment of the present application uses a file transfer method to save the real-time frame data in the form of a binary stream as file data, and then reads the file data into the video file one by one according to the file storage order to form a complete high-frame-rate video. While achieving real-time high-frame-rate video recording, it avoids frame loss and dropped frames caused by slow processing and does not cause memory exhaustion. At the same time, the present application uses a circular linked list to manage the reuse of file names to avoid excessive fragmentation of the storage system.

[0071] In an optional embodiment, it is also possible to upload the results of the high frame rate video recording method to the blockchain.

[0072] Specifically, corresponding summary information is obtained based on the results of the high-frame-rate video recording method. Specifically, the summary information is obtained by hashing the results of the high-frame-rate video recording method, for example, using the sha256s algorithm. Uploading the summary information to the blockchain ensures its security and fairness and transparency to users. Users can download the summary information from the blockchain to verify whether the results of the high-frame-rate video recording method have been tampered with. The blockchain referred to in this example is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Blockchain is essentially a decentralized database, a string of data blocks generated using cryptographic methods. Each data block contains information about a batch of network transactions, which is used to verify the validity of the information (to prevent counterfeiting) and generate the next block. Blockchain can include the blockchain underlying platform, the platform product service layer, and the application service layer.

[0073] See also Figure 3, is a schematic diagram of the structure of a high frame rate video recording device according to an embodiment of the present application. The high frame rate video recording device 40 according to an embodiment of the present application comprises:

[0074] Data storage module 41: This module is used to obtain the frame data generated during high-frame-rate video recording and save the frame data as a file using a binary stream. Specifically, the data storage module saves the frame data generated during high-frame-rate video recording as a file using the ofstream (output filestream) class in the C++ system library. Because this is direct storage without the need for additional intermediate processing, the time required to save the file data is less than the time required to write the frame data to the video file, avoiding blocking the system's frame-spitting thread and ensuring the frame rate of the recorded video.

[0075] The first file naming module 42 is used to name file data according to a predefined naming rule and uses a circular linked list to record the file names of all file data. Each file name corresponds to a node in the circular linked list. The file data naming rule is as follows: user parameter + video recording time + current cumulative video frame count. For example, the file name of a file data may be: PA_2022_04_24_25, where PA is the user parameter, 2022_04_24 is the video recording time, and 25 is the current cumulative video frame count. A circular linked list is another form of chained storage structure. A characteristic of a circular linked list is that the pointer field of the last node in the list points to the head node, forming a loop. Therefore, starting from any node in the list, other nodes in the list can be found. In this embodiment of the present application, each file name corresponds to a node in the circular linked list. Using the circular linked list to uniformly manage all file names facilitates subsequent reuse of file names and avoids excessive fragmentation in the storage system.

[0076] File reading module 43: used to use an independent thread to read file data one by one in the order in which the file data is saved and write it into the video file to generate a complete high frame rate video; wherein, in order to achieve real-time recording, by opening an independent thread, the file data is read one by one in the order in which the file data is saved and the read data is written into the video file until all the file data of the current video is read, thereby avoiding memory exhaustion caused by frame accumulation and ensuring the normal operation of the app. Taking IOS as an example, the independent thread can use the dispatch_async of the GCD API provided by the IOS system. The specific way for the independent thread to read file data is: use the ifstream class in the c++ system library to read the file data and write it into the video file, thereby avoiding frame loss due to busy or blocked frame spitting threads and memory exhaustion caused by frame accumulation, which is conducive to improving the function, performance and user experience of high frame rate video recording.

[0077] The linked list updating module 44 is used to mark the file data written into the video file and the corresponding file name in the circular linked list as available.

[0078] Furthermore, the high frame rate video recording device of the embodiment of the present application further includes:

[0079] The second file naming module 45 is used to query whether there is an available file name from the circular linked list according to the set query rules when re-recording high frame rate video. If so, the available file name in the circular linked list is used as the file name of the newly saved file data; otherwise, the newly saved file is named according to the set naming rules, and the file name is inserted into the circular linked list as a new node. In the above, when the saved file data is processed, the corresponding file name in the circular linked list is marked as available. When saving new file data next time, the file name marked as available in the circular linked list is directly used as the file name of the newly saved file data, avoiding excessive storage space and storage system fragmentation caused by using a unique file name for each file data. If there is no available file name in the circular linked list, a new file name is regenerated and inserted into the circular linked list as a new node. At the same time, due to the long length of the circular linked list, it will be time-consuming to traverse the entire circular linked list when querying for available file names. In order to speed up the query speed, the embodiment of the present application sets up two pointers, one of which points to the most recently inserted node in the circular linked list, and the other pointer points to the last node marked as available in the circular linked list. When querying available file names, it starts from the most recently inserted node and traverses to the last node marked as available, thereby greatly speeding up the query speed of available file names.

[0080] Based on the above, the high-frame-rate video recording device of the embodiment of the present application uses a file transfer method to save the real-time frame data in the form of a binary stream as file data, and then reads the file data one by one into the video file according to the file storage order to form a complete high-frame-rate video. While achieving real-time high-frame-rate video recording, it avoids frame loss and dropped frames caused by slow processing and does not cause memory exhaustion. At the same time, the present application uses a circular linked list to manage the reuse of file names to avoid excessive fragmentation of the storage system.

[0081] See also Figure 4 , is a schematic diagram of the computer device structure of an embodiment of the present application. The computer device 50 includes:

[0082] A memory 51 storing executable program code;

[0083] a processor 52 connected to the memory 51;

[0084] The processor 52 calls the executable program code stored in the memory 51 to execute the following steps of the high frame rate video recording method: obtaining the frame data generated during the high frame rate video recording process, and saving the frame data as file data in the form of a binary stream; naming the file data according to the set naming rules, and using a circular linked list to record the file names of all file data, each file name corresponds to a node in the circular linked list; using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video; marking the file data written into the video file corresponding to the file name in the circular linked list as available.

[0085] The processor 52 may also be referred to as a CPU (Central Processing Unit). The processor 52 may be an integrated circuit chip having signal processing capabilities. The processor 52 may also be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, a discrete gate or transistor logic device, or a discrete hardware component. The general-purpose processor may be a microprocessor or any conventional processor.

[0086] The computer device of the embodiment of the present application uses a file transfer method to save the real-time frame data in the form of a binary stream as file data, and then reads the file data one by one into the video file according to the file storage order, forming a complete high-frame rate video. While achieving real-time high-frame rate video recording, it avoids frame loss and dropped frames caused by slow processing and does not cause memory exhaustion. At the same time, the present application uses a circular linked list to manage the reuse of file names to avoid excessive fragmentation of the storage system.

[0087] See also Figure 5 , Figure 5 The present invention is a schematic diagram of the structure of the storage medium of the embodiment of the present invention. The storage medium of the embodiment of the present invention stores a program file 61 capable of implementing the following steps: obtaining frame data generated during high frame rate video recording, saving the frame data as file data in the form of a binary stream; naming the file data according to a set naming rule, and using a circular linked list to record the file names of all file data, each file name corresponding to a node in the circular linked list; using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video; marking the file data written into the video file as available in the circular linked list.

[0088] The program file 61 may be stored in the aforementioned storage medium in the form of a software product, including a number of instructions for causing a computer device (which may be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: a USB flash drive, a mobile hard drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disk, etc., which can store program code, or a terminal device such as a computer, server, mobile phone, or tablet.

[0089] The storage medium of the embodiment of the present application uses a file transfer method to save the real-time frame data in the form of a binary stream as file data, and then reads the file data one by one into the video file according to the file storage order, forming a complete high-frame rate video. While achieving real-time high-frame rate video recording, it avoids frame loss and dropped frames caused by slow processing and does not cause memory exhaustion. At the same time, the present application uses a circular linked list to manage the reuse of file names to avoid excessive fragmentation of the storage system.

[0090] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0091] In addition, each functional unit in each embodiment of the present application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of a software functional unit. The above is only an implementation method of the present application and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A high frame rate video recording method, characterized in that: include: Acquire frame data generated during high frame rate video recording, and save the frame data as file data in the form of a binary stream; The file data is named according to a set naming rule, and a circular linked list is used to record the file names of all file data, each file name corresponds to a node in the circular linked list; Using an independent thread to read the file data one by one in the order in which the file data is saved and write them into the video file to generate a complete high frame rate video; Mark the file data written into the video file and the corresponding file name in the circular linked list as available; After marking the file data written into the video file as available in the circular linked list, the following further comprises: Determine whether the current high frame rate video recording has ended. If the recording has ended, Determine whether to record a new high frame rate video. If so, Re-save the frame data generated during the high frame rate video recording process as file data in the form of a binary stream, and query whether there is an available file name from the circular linked list according to the set query rules. If so, Using the available file names in the circular linked list as the file names of the newly saved file data; The querying of whether there is an available file name from the circular linked list according to the set query rules is specifically as follows: Two pointers are set up, one pointer points to the most recently inserted node in the circular linked list, and the other pointer points to the last node marked as available in the circular linked list. When querying whether there is an available file name from the circular linked list, start from the most recently inserted node and traverse to the last node marked as available.

2. The high frame rate video recording method according to claim 1, wherein: Saving the frame data as file data in the form of a binary stream includes: The frame data is saved as file data in the form of a binary stream using the ofstream class in the C++ system library.

3. The high frame rate video recording method according to claim 1, wherein: The specific naming rule of the file data is: user parameters + video recording time + current cumulative number of video frames.

4. The high frame rate video recording method according to claim 2, wherein: The method of using an independent thread to read the file data one by one according to the storage order of the file data and write them into the video file is specifically as follows: Use the ifstream class in the C++ system library to read file data and write it to the video file.

5. The high frame rate video recording method according to claim 1, wherein: If there is no available file name in the circular linked list, re-saving the frame data generated during the high frame rate video recording process as file data in the form of a binary stream further includes: The newly saved file is named according to the set naming rule, and the file name is inserted into the circular linked list as a new node.

6. A high frame rate video recording device, the device being used to implement the high frame rate video recording method according to any one of claims 1 to 5, characterized in that: include: Data storage module: used to obtain frame data generated during high frame rate video recording and save the frame data as file data in the form of binary stream; The first file naming module is used to name the file data according to the set naming rules, and use a circular linked list to record the file names of all file data, each file name corresponds to a node in the circular linked list; File reading module: used to use an independent thread to read file data one by one according to the storage order of the file data and write them into the video file to generate a complete high frame rate video; Linked list updating module: used for marking the file name corresponding to the file data written into the video file in the circular linked list as available.

7. A computer device, characterized in that: The computer device comprises: a memory storing executable program code; a processor connected to the memory; The processor calls the executable program code stored in the memory to execute the high frame rate video recording method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: Program instructions executable by a processor are stored, and the program instructions are used to execute the high frame rate video recording method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Vehicle data flow recording method and system, and related equipment

    CN109671184A

  • Video recording method, device, storage medium and terminal equipment

    CN113766241A