Video data processing method, device and computer-readable storage medium
By estimating the total size of video data after being written to the executable file in the Windows system, if the limit is exceeded, an independent data file is created and the executable file is associated with the executable file is solved, and centralized storage and convenient management of video data are realized.
Patent Information
- Application Number
- CN202210392547.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2042-04-15
AI Technical Summary
The Windows system's limitation on the size of the executable file leads to a large amount of video data being stored scattered, causing inconvenience to post-query and management.
By estimating the total size of video data after being written to the executable file, if the system limit is exceeded, an independent data file is created to associate it with the executable file, bypass the system limit, and realize centralized storage.
It realizes centralized storage of a large amount of video data, which facilitates post-transfer and viewing, and avoids the management troubles caused by scattered files.
Smart Images

Figure CN114817626B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of video storage technology, and in particular to a video data processing method, device and computer-readable storage medium. Background Art
[0002] To meet public security and management needs, many shopping malls and office buildings are equipped with numerous surveillance cameras. These cameras operate continuously throughout the day, accumulating vast amounts of video footage. To facilitate subsequent review and management, administrators extract relatively important or suspicious video clips and package them together with the video clips into a single executable file for easy viewing.
[0003] However, this method has some drawbacks. Windows systems limit executable file size to 4GB. This means that when exporting multiple video sources or video clips from multiple time periods, they must be exported separately. This results in a large number of fragmented files, making subsequent querying and management inconvenient. Summary of the Invention
[0004] To solve the above problem and bypass the system's own limitation on the size of executable files, the present invention provides a video data processing method, device and computer-readable storage medium.
[0005] Specifically, the technical solution of the present invention is:
[0006] A video data processing method, the video data processing method comprising:
[0007] Video data export and storage process:
[0008] Step S1, determining the video data to be exported according to the received export instruction, and creating an executable file, wherein the executable file includes a player boot program, a player resource file, and header information of the video data, wherein the player boot program is used to guide the execution of the player resource file, and the player resource file includes files required to run the player;
[0009] Step S2, calculating, based on the size of the video data: if the video data is written into the executable file, the estimated file size of the executable file after writing;
[0010] Step S3, determining whether the estimated file size is greater than a specified value; if so, executing step S4 and then terminating the process; otherwise, executing step S5;
[0011] Step S4, creating an independent data file, wherein the data file includes the video data and corresponding video index data, and associating the data file with the executable file to complete the export;
[0012] Step S5: Write the video data and the corresponding video index data into the executable file to complete the export.
[0013] Preferably, the video data includes multiple videos from multiple camera devices, and step S4 includes:
[0014] Creating the data file and writing the video data into the data file;
[0015] Storing the data file and the executable file in the same directory, thereby associating the data file with the executable file;
[0016] Writing device information of each camera device among the multiple camera devices and the video index data into the data file;
[0017] The step S5 comprises:
[0018] Writing the video data into the executable file in units of picture groups;
[0019] The device information of each camera device among the plurality of camera devices and the video index data are written into the executable file.
[0020] Preferably, the video data processing method is applied to a Windows system, and the specified value is 4GB.
[0021] Preferably, the export instruction includes video time period information and executable file name information, and step S1 further includes:
[0022] After receiving the export instruction and before creating the executable file, determine whether the executable file name contained in the export instruction is legal and whether there is a video in the video time period contained in the export instruction; if so, create the executable file according to the export instruction.
[0023] Preferably, the method further comprises:
[0024] The video data playback process:
[0025] Step S6, executing the executable file to start the player boot program, execute the player resource file, and run the player;
[0026] In step S7, the player obtains the video data from the executable file according to the received play instruction and plays it, or automatically loads the data file in the same directory as the executable file, obtains the video data in the data file and plays it.
[0027] Preferably, the executable file or the data file further includes device information of each of the multiple camera devices, and the step S7 includes:
[0028] Step S71, the player reads the device information and video index data of the video data from the executable file or the data file;
[0029] Step S72, reading the video data from the executable file or the data file according to the play instruction and the video index data, playing the videos from different camera devices in different play windows respectively, and displaying corresponding device information in each play window; or
[0030] The video data is read from the executable file or the data file according to the play instruction and the video index data, and the same video from the same camera device is played respectively in different play windows.
[0031] Preferably, the step S71 includes:
[0032] Step S711, determining whether the video data is password protected, if so, executing step S712, otherwise executing step S713;
[0033] Step S712: Password verification is performed, and step S713 is executed after the password verification is successful;
[0034] Step S713: Load the device information and video index data of the video data.
[0035] Preferably, step S7 includes:
[0036] Before playing the acquired video data, a cyclic redundancy check is performed on the video data. If the check passes, the video data is loaded and played.
[0037] A video data processing device comprises a memory and a processor, wherein the memory stores at least one program, and the processor executes the at least one program to implement the steps of the video data processing method as described above.
[0038] A computer-readable storage medium stores at least one program, and the at least one program is executed by a processor to implement the steps of the video data processing method as described above.
[0039] Beneficial technical effects of the present invention:
[0040] Before writing the video data to be exported into an executable file, the total file size of the executable file after writing the video data is estimated. If the total file size exceeds the system upper limit, the video data will not be written into the executable file. Instead, a data file associated with the executable file is created to store the video data to be exported, bypassing the system's own limit on the size of executable files. Even if a large amount of video data needs to be exported, centralized storage of the data can be achieved, which is convenient for later transfer and viewing. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A flowchart of the process of exporting and storing video data;
[0042] Figure 2 is a flowchart of the video data playback process;
[0043] Figure 3 A file structure diagram of an executable file containing video data;
[0044] Figure 4 The file structure diagram of a specific executable file is shown in FIG. DETAILED DESCRIPTION
[0045] The present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0046] Example 1:
[0047] This embodiment provides a video data processing method, which includes the process of exporting and storing video data. Figure 1 As shown, the process includes:
[0048] Step S1, determining the video data to be exported according to the received export instruction and creating an executable file;
[0049] The video data to be exported can be video data of a single or multiple time periods from a single or multiple video sources; the export instruction is generated by user input and can include the video time period information, executable file name information, and video source information (which can be the device information of the camera device) entered by the user. According to the export instruction, it can be determined which time period and video source the user needs to export, as well as the file name of the executable file (EXE file). To ensure smooth export, it is necessary to first determine whether the file name is legal and whether there is corresponding video data in the time period, that is, whether it meets the export conditions.
[0050] The created executable file contains at least the player bootloader, player resource files, and header information for the video data to be exported. The player bootloader is used to execute the player resource files, which contain files required to run the player, such as the player interface library. You can first package the player resource files into a ZIP archive and then include it in the executable file.
[0051] Step S2, calculating, based on the size of the video data to be exported, the estimated file size of the executable file after writing the video data into the executable file;
[0052] The size of the subsequent device information and video index data is negligible compared to the size of the video data. Therefore, the device information and video index data do not need to be specifically considered when calculating the estimated file size.
[0053] Step S3, determining whether the estimated file size is greater than a specified value, if so, executing step S4 and then terminating the process; otherwise, executing step S5;
[0054] The specified value is a pre-set value. Currently, Windows systems limit executable file sizes to 4GB, so simply setting the specified value to 4GB bypasses the Windows executable file size limit. Of course, in other application scenarios, the executable file size requirements may differ, and you can simply set the specified value accordingly.
[0055] Step S4, creating an independent data file (the data file contains video data and corresponding video index data), and associating the data file with the executable file to complete the export;
[0056] Step S5: Write the video data and the corresponding video index data into an executable file to complete the export.
[0057] When the video data includes multiple videos from multiple camera devices, step S4 specifically includes the following steps:
[0058] Create an independent data file and write all video data into the data file;
[0059] Associating data files with executable files by storing them in the same directory as the executable file;
[0060] Writing device information and video index data of each camera device in the plurality of camera devices into a data file;
[0061] Step S5 includes:
[0062] Write video data into an executable file in units of picture groups;
[0063] The device information and video index data of each camera device among the plurality of camera devices are written into an executable file.
[0064] When writing video data to an executable file, multiple videos from multiple cameras are written simultaneously. Since the write positions are discontinuous, the hard disk head will frequently jump and seek when reading each frame of data, which will reduce its IO performance. Therefore, the video data is written continuously in units of group of pictures (GOP) to reduce the frequent jump and seek of the hard disk head.
[0065] Device information and video index data can be appended to the end of the EXE file in protocol buffer format. Figure 3 In order to write video data, device information, and video index data into an executable file, the file structure diagram of the exported executable file is shown. The executable file contains a regular executable program part (the content is the player boot program) and an additional data part (the content is the player resource file, video data header information, video data, device information, and video index data).
[0066] In addition to video screen data, video data also includes audio data and overlay information corresponding to the video screen data. The overlay information includes text and / or image information superimposed on the video screen, which can be the marking information of the video data in the original system, such as the alarm event information associated with the video. These overlay information can make the exported video more convenient for subsequent playback and viewing operations.
[0067] The above-mentioned video data processing method also includes a video data playback process, which is achieved by running an executable file. The executable file can be stored on the original computer (the computer that performs the video data export and storage process) or on another computer. The other computer can obtain the executable file from the original computer through data transmission. Figure 2 As shown, the video data playback process includes:
[0068] Step S6, executing the executable file to start the player boot program, execute the player resource file, and run the player;
[0069] For player resource files packaged into ZIP compressed files, during the execution of the player boot program, the player resource files can be first decompressed to a temporary directory, and then the player interface library in the temporary directory can be executed to generate the player interface.
[0070] In step S7, the player obtains the video data from the executable file and plays it according to the received play instruction, or automatically loads the data file in the same directory as the executable file, obtains the video data in the data file and plays it.
[0071] The play instruction is generated by user input and may include video time period information and video source information input by the user. According to the play instruction, it can be determined which time period and video source the user needs to play.
[0072] In this embodiment, the video data includes multiple video segments from multiple camera devices, and the executable file or data file also includes device information of each of the multiple camera devices. Step S7 specifically includes the following steps:
[0073] Step S71, the player reads device information and video index data of the video data from the executable file or data file;
[0074] When the executable file is run, the data file in the same directory is automatically loaded and the validity of the data file is determined. Specifically, the validity of the data content in the data file can be determined using a cyclic redundancy check (CRC) to prevent loading invalid or tampered files. In this embodiment, step S7 includes performing a cyclic redundancy check on the acquired video data before playing it. If the check passes, the video data is loaded for playback.
[0075] Figure 4 The following is a file structure diagram of a specific implementation of an executable file, wherein a conventional EXE file includes a PE file header. When verifying the validity of a data file, the PE header of a conventional EXE file can be used to verify whether the file is an EXE file, thereby avoiding loading non-EXE files. For EXE files, additional data is further read. For example, the protocol buffer parsing protocol of the Google open source library can be used, and the validity of the additional data in the EXE file can be verified by CRC within the protocol buffer.
[0076] In step S72, the player reads the video data from the executable file or the data file according to the play instruction and the video index data, and decodes and plays the corresponding video.
[0077] Video playback can be divided into the following two situations:
[0078] The first method is to play videos from different video cameras in different play windows according to the play instructions, and display corresponding device information in each play window.
[0079] This situation can be categorized as synchronous playback or asynchronous playback. Synchronous playback means that at any given moment, the videos played in each playback window are at the same time. Synchronous playback is achieved by periodically querying each video source for the earliest video after the current playback time. The video source corresponding to this earliest video is used as the time reference for synchronous playback, allowing for synchronized playback of multiple video sources in separate windows.
[0080] Asynchronous playback means that each window plays the video independently without time synchronization.
[0081] The second method is to play the same video from the same camera device in different playback windows.
[0082] In this case, a video is played in multiple independent playback windows, and the windows are not synchronized in time.
[0083] In this embodiment, after receiving the export instruction and before starting to export the video data, the step of receiving a password input by the user is also included; before completing the export, the step of setting password protection for the video data is also included. Accordingly, step S71 includes:
[0084] Step S711, determining whether the video data is password protected, if so, executing step S712, otherwise executing step S713;
[0085] Step S712: Password verification is performed, and step S713 is executed after the password verification is successful;
[0086] Step S713: Load device information and video index data of the video data.
[0087] Example 2:
[0088] This embodiment provides a video data processing device, which includes a memory and a processor. The memory stores at least one program, which is executed by the processor to implement the steps of the video data processing method provided in Example 1. What is implemented can be the process of exporting and storing video data, the process of playing video data, or both.
[0089] In this embodiment, the device includes a processor, a memory, a bus, and a computer program stored in the memory and capable of running on the processor. The processor includes one or more processing cores. The memory is connected to the processor via a bus. The memory is used to store program instructions. When the processor executes the computer program, the steps in the above-mentioned method embodiment of the first embodiment of the present invention are implemented.
[0090] Furthermore, as an executable solution, the video data processing device can be a computer unit, which can be a computing device such as a desktop computer, laptop, PDA, or cloud server. The computer unit may include, but is not limited to, a processor and memory. Those skilled in the art will understand that the above-described computer unit structure is merely an example and does not constitute a limitation of the computer unit. The computer unit may include more or fewer components than those described above, or a combination of certain components, or different components. For example, the computer unit may also include input and output devices, network access devices, buses, etc., which are not limited in the embodiments of the present invention.
[0091] Furthermore, as an executable solution, the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc. The processor is the control center of the computer unit, and various parts of the entire computer unit are connected using various interfaces and lines.
[0092] The memory can be used to store the computer program, and the processor implements the various functions of the computer unit by running or executing the computer program stored in the memory and calling the data stored in the memory. The memory can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system and at least one application required for a function; the data storage area can store data created based on the use of the mobile phone, etc. In addition, the memory can include a high-speed random access memory and can also include a non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), at least one disk storage device, a flash memory device, or other volatile solid-state storage device.
[0093] Example 3:
[0094] This embodiment provides a computer-readable storage medium, which stores at least one program. The at least one program is executed by a processor to implement the steps of the video data processing method provided in Example 1. What is implemented can be the process of exporting and storing video data, the process of playing video data, or both.
[0095] The computer-readable storage medium may include: any entity or device capable of carrying program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), and software distribution medium, etc.
[0096] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. It should be noted that any modifications, equivalent replacements, improvements, etc. made by those skilled in the art after reading this specification within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A video data processing method, characterized in that: The video data processing method comprises: Video data export and storage process: Step S1, determining the video data to be exported according to the received export instruction, and creating an executable file, wherein the executable file includes a player boot program, a player resource file, and header information of the video data, wherein the player boot program is used to guide the execution of the player resource file, and the player resource file includes files required to run the player; Step S2, calculating, based on the size of the video data: if the video data is written into the executable file, the estimated file size of the executable file after writing; Step S3, determining whether the estimated file size is greater than a specified value; if so, executing step S4 and then terminating the process; otherwise, executing step S5; Step S4, creating an independent data file, wherein the data file includes the video data and corresponding video index data, and associating the data file with the executable file to complete the export; Step S5: Write the video data and the corresponding video index data into the executable file to complete the export.
2. The video data processing method according to claim 1, wherein: The video data includes multiple videos from multiple camera devices, and step S4 includes: Creating the data file and writing the video data into the data file; Storing the data file and the executable file in the same directory, thereby associating the data file with the executable file; Writing device information of each camera device among the multiple camera devices and the video index data into the data file; The step S5 comprises: Writing the video data into the executable file in units of picture groups; The device information of each camera device among the plurality of camera devices and the video index data are written into the executable file.
3. The video data processing method according to claim 1, wherein: The video data processing method is applied to a Windows system, and the specified value is 4GB.
4. The video data processing method according to claim 1, wherein: The export instruction includes video time period information and executable file name information, and step S1 further includes: After receiving the export instruction and before creating the executable file, determine whether the executable file name contained in the export instruction is legal and whether there is a video in the video time period contained in the export instruction; if so, create the executable file according to the export instruction.
5. The video data processing method according to claim 2, wherein: The method further comprises: The video data playback process: Step S6, executing the executable file to start the player boot program, execute the player resource file, and run the player; In step S7, the player obtains the video data from the executable file according to the received play instruction and plays it, or automatically loads the data file in the same directory as the executable file, obtains the video data in the data file and plays it.
6. The video data processing method according to claim 5, wherein: The executable file or the data file further includes device information of each of the multiple camera devices, and the step S7 includes: Step S71, the player reads the device information and video index data of the video data from the executable file or the data file; Step S72, reading the video data from the executable file or the data file according to the play instruction and the video index data, playing the videos from different camera devices in different play windows respectively, and displaying corresponding device information in each play window; or The video data is read from the executable file or the data file according to the play instruction and the video index data, and the same video from the same camera device is played respectively in different play windows.
7. The video data processing method according to claim 6, wherein: The step S71 includes: Step S711, determining whether the video data is password protected, if so, executing step S712, otherwise executing step S713; Step S712: Password verification is performed, and step S713 is executed after the password verification is successful; Step S713: Load the device information and video index data of the video data.
8. The video data processing method according to claim 5, wherein: The step S7 comprises: Before playing the acquired video data, a cyclic redundancy check is performed on the video data. If the check passes, the video data is loaded and played.
9. A video data processing device, characterized in that: The device includes a memory and a processor, the memory stores at least one program, and the at least one program is executed by the processor to implement the steps of the video data processing method according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that The storage medium stores at least one program, and the at least one program is executed by a processor to implement the steps of the video data processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
File operation method and apparatus
CN105550345A
Video processing method and device, electronic device and computer readable medium
CN109587546A