Reading method, device and storage medium for video playback data
By obtaining the preset array name from the video playback data and processing it using JavaScript assignment statements, the problem of large and complex video playback file parsing and playback is solved, achieving efficient storage and convenient playback.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-11-01
- Publication Date
- 2026-03-31
AI Technical Summary
Most existing video playback files are binary files, which require a lot of storage space, are complex to parse and play, and lack text readability.
By obtaining the preset array name of the target video playback data, the assignment statement in the JavaScript file is used to process the assignment, and the objects in the target array are traversed and restored to achieve video playback. The data format conforms to JavaScript and JSON syntax, reducing storage space and improving the convenience of parsing and playback.
While reducing storage space, it achieves readability and convenient playback of video playback data, avoiding dependence on other tools.
Smart Images

Figure CN115827574B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus and computer-readable storage medium for reading video playback data. Background Technology
[0002] Many existing video playback files are binary files, lacking text readability. They require additional tools to parse before playback. Furthermore, due to the large size of these files and the resulting high storage space requirements, they are typically compressed before storage. However, current compression methods still produce binary data after compression, necessitating further tools for parsing and playback, making the process quite complex. Summary of the Invention
[0003] The main objective of this application is to provide a method, device, and computer-readable storage medium for reading video playback data, aiming to reduce storage space usage and improve the convenience of parsing and playing stored video playback data.
[0004] Firstly, this application provides a method for reading video playback data, the method comprising the following steps:
[0005] Acquire target video playback data, wherein the target video playback data includes a preset array name;
[0006] Based on the preset assignment statements in the target file, the preset array name is assigned a value to obtain the target array name;
[0007] Traverse the processed target video playback data, and restore the objects in the target array according to the target array name to obtain the target object;
[0008] Play the video based on the target object in the target video playback data.
[0009] Secondly, this application also provides a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable by the processor, wherein when the computer program is executed by the processor, it implements the steps of the video playback data reading method described above.
[0010] Thirdly, this application also provides a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, it implements the steps of the video playback data reading method described above.
[0011] This application provides a method, device, and computer-readable storage medium for reading video playback data. The method involves acquiring target video playback data, which includes a preset array name; assigning values to the preset array name based on preset assignment statements in a target file to obtain a target array name; traversing the processed target video playback data and restoring objects in the target array according to the target array name to obtain target objects; and playing video based on the target objects in the target video playback data. The data format of the target video playback data conforms to JavaScript and JSON syntax. Assignment statements in a JavaScript file can be used to assign values to the array names in the video playback data, enabling the video playback data to be restored to playback data. This method reduces the storage space required during storage and eliminates the need for additional tools during data restoration and video playback, thus improving the convenience of parsing and playing stored video playback data. Attached Figure Description
[0012] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0013] Figure 1 A flowchart illustrating a method for reading video playback data provided in an embodiment of this application;
[0014] Figure 2 This is a schematic block diagram of the structure of a computer device according to an embodiment of this application.
[0015] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0016] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0017] The flowchart shown in the attached diagram is for illustrative purposes only and does not necessarily include all content and operations / steps, nor does it necessarily have to be performed in the order described. For example, some operations / steps can be broken down, combined, or partially merged, so the actual execution order may change depending on the actual situation.
[0018] This application provides a method for reading video playback data, a computer device, and a computer-readable storage medium. The method for reading video playback data can be applied to a terminal device, such as a tablet computer, laptop computer, or desktop computer. It can also be applied to a server, which can be a standalone server or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content delivery networks (CDNs), and big data and artificial intelligence platforms.
[0019] The following detailed description of some embodiments of this application is provided in conjunction with the accompanying drawings. Unless otherwise specified, the following embodiments and features can be combined with each other.
[0020] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for reading video playback data provided in an embodiment of this application.
[0021] like Figure 1 As shown, the method for reading video playback data includes steps S101 to S104.
[0022] Step S101: Obtain target video playback data, wherein the target video playback data includes a preset array name.
[0023] For example, the target video playback data to be played back is obtained. The target video playback data includes a preset array name. It can be understood that there are multiple preset array names and array information in the arrays corresponding to the preset array names in the target video playback data, so as to store the video playback data. That is, the corresponding video can be played back according to the video playback data.
[0024] For example, the number of characters in the preset array name is less than the number of characters in the array name before the video playback data is processed. Therefore, during the processing and storage of the video playback data, the space occupied by data storage can be reduced due to the smaller number of characters.
[0025] Step S102: Based on the preset assignment statements in the target file, assign values to the preset array name to obtain the target array name.
[0026] Optionally, the target file is a JavaScript file, which is used to support the normal operation of the runtime environment. For example, the JavaScript file is used to support the operation of the second runtime environment, so that in the second runtime environment, the preset assignment statement can be used to assign values to the preset array name to obtain the target array name, so as to restore the array name and enable the corresponding parsing processing based on the array name.
[0027] Optionally, in a second runtime environment that uses JavaScript as the programming language, the preset data name can be assigned a value according to a preset assignment statement.
[0028] For example, the default assignment statement is shown in the following statement:
[0029] varmyval={$map:{c:'controlId',s:'stationId',su:'statusUse'}
[0030] a:[{c:3001,s:12,su:0}]
[0031] Here, $map is used to indicate the assignment process, c, s, and su are used to indicate the preset array names, and controlId, stationId, and statusUse are used to indicate the values to be assigned; a:[{c:3001,s:12,su:0}] is used to indicate the array to be assigned; it can be understood that after the array to be assigned is assigned, the following result can be obtained: a:[{controlId:3001,stationId:12,statusUse:0}], which completes the assignment process of the preset array names in the array to be assigned.
[0032] Understandably, the objects in the array corresponding to the target array name can be parsed to enable video playback. At the same time, since the preset array name is still stored in a programming language format, such as JSON data format, it is readable.
[0033] Step S103: Traverse the processed target video playback data, determine the target array according to the target array name, restore the objects in the target array, and obtain the target object.
[0034] For example, the target video playback data after assignment is traversed, the target array is determined according to the target array name, and the objects in the target array are restored to obtain the target object, so that the video can be played according to the target object.
[0035] Understandably, after assigning values to the preset array names, the target array is determined based on the target array name, thereby excluding arrays that are not used for video playback and improving the efficiency of data conversion.
[0036] Step S104: Play the video according to the target object in the target video playback data.
[0037] For example, after obtaining the target object, video can be played based on the target object to achieve video playback based on video playback data. At the same time, the video playback data is not converted into binary data format and is readable, thus achieving the goal of reducing storage space while maintaining the readability of the stored video playback data.
[0038] In some embodiments, the method further includes determining an object class statement based on a first runtime environment; registering the object class statement in a second runtime environment, wherein the programming languages used by the first runtime environment and the second runtime environment are different; and traversing the processed target video playback data and restoring the objects in the target array according to the target array name to obtain the target object, comprising: in the second runtime environment, traversing the processed target video playback data, determining the target array according to the target array name, and restoring the objects in the target array according to the object class statement to obtain the target object.
[0039] Optionally, an object class statement is determined in the first runtime environment. The object class statement is used to restore the objects in the target array. After the object class statement is determined in the first runtime environment, it is registered in the second runtime environment so that the objects in the target array can be restored in the second runtime environment through the object class statement.
[0040] In the specific implementation process, registering object class statements to the second runtime environment includes registering object class statements to the target file used to support the second runtime environment.
[0041] Understandably, the programming languages used in the first and second runtime environments are different. Therefore, the object class statements written in the first runtime environment need to be registered in the second runtime environment before they can be used. In this way, the object class statements can be used in the second runtime environment to restore the objects in the target array.
[0042] Specifically, in the second runtime environment, the processed target video playback data is traversed. For example, the array names corresponding to each array in the target video playback data are obtained by traversing. The target array is determined based on the target array name, and then the object class statement is used to perform restoration processing on the objects in the target array to obtain the target object.
[0043] In some embodiments, the programming language used by the first runtime environment is C++, and the programming language used by the second runtime environment is JavaScript.
[0044] For example, object class statements can be written in a C++ runtime environment and then registered in a JavaScript engine. This allows the JavaScript engine to use object class statements to restore objects in a target array and obtain the target object.
[0045] In some embodiments, determining the object class statement based on the first runtime environment includes: determining the object class statement based on the inheritance relationship with the target class according to the first runtime environment.
[0046] For example, in a C++ runtime environment, object class statements can inherit from the target class, so that the object class statements have the target functional attributes, thereby enabling the corresponding functions to be implemented in the C++ runtime environment.
[0047] In the specific implementation process, the target class is the QObjective class. By inheriting the QObjective class, the object class statement has the properties controlId, stationId, and statusUse, which enables the restoration of objects in the target array.
[0048] Specifically, after the JavaScript engine completes the registration of the object class statement, it can restore the object properties in the target array according to the mapping table. In the specific implementation process, it is shown in the following statement:
[0049] (function composeObject(mp,v,o){for(k in mp){o[mp[k]]=v[k];}})
[0050] Here, mp is the mapping table, v is the object value in JavaScript, and o is the target object of the QObject to be exported. By traversing the values in the a array of the myval object and calling the above object class statement to restore it, the QAtsSection array is obtained, so as to restore the array and its objects, thereby enabling the QAtsSection array to run in the C++ runtime environment to play the corresponding video.
[0051] In some embodiments, playing a video based on a target object in the target video playback data includes: parsing the target object in a first operating environment to play the video corresponding to the target object.
[0052] For example, after obtaining the target object in the JavaScript engine, the target object is transmitted to the C++ runtime environment so that the target object can be parsed and the corresponding video can be played, thereby realizing video playback.
[0053] For example, in a C++ runtime environment, the QAtsSection array and its corresponding objects are parsed to play the corresponding video.
[0054] In some embodiments, the method further includes: acquiring a captured video; compressing the captured video to obtain video playback data; storing the video playback data in a video repository; the acquisition of target video playback data includes: acquiring target video playback data based on the video repository.
[0055] For example, acquiring captured video; alternatively, acquiring captured video via a capturing device.
[0056] For example, the captured video can be surveillance video, so it needs to be stored. However, storing the video directly will consume a lot of storage space. The captured video is compressed to obtain video playback data, and the video playback data is stored in a video storage repository to reduce the storage space occupied by storing the video.
[0057] For example, when acquiring target video playback data, a video repository can be used to acquire the target video playback data. For instance, the target video playback data can be identified and acquired from the video repository based on the video's shooting date or storage date.
[0058] In some embodiments, compressing the captured video to obtain video playback data includes: determining video information corresponding to the video, the video information including multiple array names and array information corresponding to each array; refining the array names to obtain preset array names; and determining video playback data based on the preset array names and array information corresponding to the arrays.
[0059] For example, the video information corresponding to the video is determined, where the video information includes the array names corresponding to multiple arrays and the array information corresponding to each array, for example, {"controlId":3001,"stationId":12,"statusUse":0}, where controlId, stationId, and statusUse are array names, and 3001, 12, and 0 are the corresponding array information; the array names are refined to obtain preset array names, for example, controlId, stationId, and statusUse are refined to reduce the number of characters used in the array names, thereby reducing the storage space occupied when storing the array names, and the video playback data is determined according to the preset array names and the array information corresponding to the arrays, so as to reduce the storage space occupied when storing video playback data.
[0060] In some embodiments, determining video playback data based on the preset array name and the array information corresponding to the array includes: determining a plurality of preset arrays based on the preset array name; classifying the array information into a plurality of preset arrays based on the correspondence between the array name and the preset array name, and the correspondence between the array name and the array information; and determining video playback data based on the plurality of preset arrays and their corresponding array information.
[0061] For example, after refining the array name, several preset arrays can be redefined. For instance, the refinement rule is to refine based on the first letter. For example, after refining controlId, the preset array name is c, and the array information of the controlId array is assigned to the c array to obtain the preset array. Optionally, when there are array names with the same first letter, other characters in the array name or the addition of preset characters can be used to distinguish them. For example, after refining stationId and statusUse, the preset array names are s, su or s1, s2, to distinguish them, and the array information of the stationId array is assigned to the corresponding s or s1 array. Similarly, the array information of the statusUse array is assigned to the corresponding su or s2 array. Optionally, when array names have the same first letter, they can be extracted into the same preset array name. For example, after extracting stationId and statusUse, the preset array name is s. That is, these two arrays are merged into one preset array. Therefore, the array information in these two arrays is classified into the array with the preset array name s, thus obtaining the preset array with the preset array name s. This can further reduce the storage space occupied during storage. It should be noted that when the array information in the two arrays is classified into the array s, it is necessary to distinguish them in order to restore them.
[0062] By reducing the number of characters in array names or merging arrays with the same characters, the storage space occupied during storage can be effectively reduced. Furthermore, if manual review or reading is required, the information contained in the data can be obtained using a relational mapping table, ensuring that the processed video playback data remains readable.
[0063] The video playback data reading method provided in the above embodiments involves acquiring target video playback data, which includes a preset array name; assigning values to the preset array name based on preset assignment statements in the target file to obtain a target array name; traversing the processed target video playback data, determining the target array according to the target array name, and restoring the objects in the target array to obtain the target object; and playing the video based on the target object in the target video playback data. The target video playback data conforms to JavaScript and JSON syntax, making it readable. Furthermore, by assigning values to the array names in the video playback data using assignment statements in the JavaScript file, the video playback data can be restored to playback data, and the video can be played based on the restored data. This reduces the storage space occupied during storage and eliminates the need for other tools during data restoration and video playback, improving the convenience of parsing and playing stored video playback data.
[0064] Please see Figure 2 , Figure 2 This is a schematic block diagram illustrating the structure of a computer device provided in an embodiment of this application. The computer device may be a server or a terminal.
[0065] like Figure 2 As shown, the computer device includes a processor, a memory, and a network interface connected via a system bus, wherein the memory may include a storage medium and internal memory.
[0066] The storage medium may store the operating system and computer programs. These computer programs include program instructions that, when executed, cause the processor to perform any method of reading video playback data.
[0067] The processor provides computing and control capabilities, supporting the operation of the entire computer device.
[0068] Internal memory provides an environment for the execution of computer programs stored in the storage medium. When these computer programs are executed by the processor, the processor can perform any method of reading video playback data.
[0069] This network interface is used for network communication, such as sending assigned tasks. Those skilled in the art will understand that... Figure 2 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0070] It should be understood that the processor can be a Central Processing Unit (CPU), but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among these, a general-purpose processor can be a microprocessor or any conventional processor.
[0071] In one embodiment, the processor is configured to run a computer program stored in memory to perform the following steps:
[0072] Acquire target video playback data, wherein the target video playback data includes a preset array name;
[0073] Based on the preset assignment statements in the target file, the preset array name is assigned a value to obtain the target array name;
[0074] Traverse the processed target video playback data, determine the target array according to the target array name, and restore the objects in the target array to obtain the target object;
[0075] Play the video based on the target object in the target video playback data.
[0076] In one embodiment, when implementing the video playback data reading method, the processor is configured to:
[0077] Based on the first runtime environment, determine the object class statement;
[0078] Register the object class statement in a second runtime environment, wherein the programming languages used by the first runtime environment and the second runtime environment are different;
[0079] After traversing and processing the target video playback data, the target array is determined based on the target array name. When restoring the objects in the target array to obtain the target object, it is also used to implement:
[0080] In the second running environment, the processed target video playback data is traversed, the target array is determined according to the target array name, and the objects in the target array are restored according to the object class statement to obtain the target object.
[0081] In one embodiment, when the processor implements the statement for determining the object class based on the first runtime environment, it is used to:
[0082] Based on the first runtime environment, determine the object class statement according to the inheritance relationship with the target class.
[0083] In one embodiment, when the processor implements video playback based on a target object in the target video playback data, it is configured to:
[0084] In the first operating environment, the target object is parsed in order to play the video corresponding to the target object.
[0085] In one embodiment, the processor, when implementing the video playback data reading method, is further configured to implement:
[0086] Acquire the captured video;
[0087] The captured video is compressed to obtain video playback data;
[0088] The video playback data is stored in a video repository;
[0089] When acquiring target video playback data, it is used to achieve the following:
[0090] Based on the video repository, obtain the target video playback data.
[0091] In one embodiment, when the processor compresses the captured video to obtain video playback data, it is configured to:
[0092] Determine the video information corresponding to the video, wherein the video information includes the array names corresponding to multiple arrays and the array information corresponding to each array;
[0093] The array name is refined to obtain a preset array name;
[0094] The video playback data is determined based on the preset array name and the array information corresponding to the array.
[0095] In one embodiment, when the processor determines video playback data based on the preset array name and the array information corresponding to the array, it is configured to:
[0096] Based on the preset array names, determine several preset arrays;
[0097] Based on the correspondence between the array name and the preset array name, and the correspondence between the array name and the array information, the array information is classified into multiple preset arrays;
[0098] Based on the multiple preset arrays and their corresponding array information, video playback data is determined.
[0099] It should be noted that those skilled in the art will understand that, for the sake of convenience and brevity, the specific process of reading video playback data described above can be referred to the corresponding process in the aforementioned embodiment of the video playback data reading control method, and will not be repeated here.
[0100] This application also provides a computer-readable storage medium storing a computer program, the computer program including program instructions, and the method implemented when the program instructions are executed can refer to various embodiments of the video playback data reading method of this application.
[0101] The computer-readable storage medium may be an internal storage unit of the computer device described in the foregoing embodiments, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, SmartMedia Card (SMC), Secure Digital (SD) card, or Flash Card equipped on the computer device.
[0102] It should be understood that the terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to limit the scope of the application. As used in this specification and the appended claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise.
[0103] It should also be understood that the term "and / or" as used in this specification and the appended claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations. It should be noted that, herein, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system 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 system. Without further limitation, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0104] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments. The above descriptions are merely specific implementations of this application, but the scope of protection of this application is not limited thereto. Any person skilled in the art can easily conceive of various equivalent modifications or substitutions within the technical scope disclosed in this application, and these modifications or substitutions should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A read method of video playback data, characterized by, The method comprises the following steps: obtaining target video playback data, wherein the target video playback data comprises a preset array name, and a data format of the target video playback data conforms to a JavaScript language and a JSON syntax and is text-readable; based on a preset assignment statement in a target file, performing assignment processing on the preset array name, and obtaining a target array name according to a corresponding relationship between an array name of an array and the preset array name; determining an object class statement based on a first running environment, wherein a programming language used by the first running environment is a C++ language, and the object class statement is determined according to an inheritance relationship with a target class; registering the object class statement in a second running environment, wherein a programming language used by the second running environment is a JavaScript language; in the second running environment, performing traversal processing on the target video playback data, determining a target array according to the target array name, and performing restoration processing on an object in the target array to obtain a target object; in the first running environment, performing video playback according to the target object in the target video playback data.
2. The read method of video playback data according to claim 1, wherein, The method further comprises: the programming language used by the first running environment is different from the programming language used by the second running environment; the traversal processing on the target video playback data, the determination of the target array according to the target array name, and the restoration processing on the object in the target array to obtain the target object comprise: in the second running environment, performing traversal processing on the target video playback data, determining a target array according to the target array name, and performing restoration processing on an object in the target array according to the object class statement to obtain a target object.
3. The read method of video playback data according to claim 2, wherein, The determination of the object class statement based on the first running environment comprises: determining the object class statement according to an inheritance relationship with the target class based on the first running environment.
4. The method of reading video playback data according to any one of claims 1 to 3, wherein, The video playback according to the target object in the target video playback data comprises: in the first running environment, performing parsing on the target object to play a video corresponding to the target object.
5. The method of reading video playback data according to any one of claims 1 to 3, wherein, The method further comprises: obtaining a video captured by shooting; performing compression processing on the video captured by shooting to obtain video playback data; storing the video playback data in a video storage library; The obtaining of the target video playback data comprises: based on the video storage library, obtaining the target video playback data.
6. The read method of video playback data according to claim 5, wherein, The compression processing on the video captured by shooting to obtain the video playback data comprises: determining video information corresponding to the video, wherein the video information comprises array names corresponding to a plurality of arrays and array information corresponding to each array; performing extraction processing on the array names to obtain preset array names; determining the video playback data according to the preset array names corresponding to the arrays and the array information corresponding to the arrays.
7. The read method of video playback data according to claim 5, wherein, The determination of the video playback data according to the preset array names corresponding to the arrays and the array information corresponding to the arrays comprises: determining a plurality of preset arrays according to the preset array names. According to a corresponding relationship between an array name of the array and preset array names and a corresponding relationship between the array name of the array and array information of the array, the array information is classified into a plurality of preset arrays; According to the plurality of preset arrays and corresponding array information thereof, video playback data is determined.
8. A computer device, comprising: The computer device includes a processor, a memory, and a computer program stored on the memory and executable by the processor, wherein when the computer program is executed by the processor, the steps of the video playback data reading method according to any one of claims 1 to 7 are implemented.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium has a computer program stored thereon, wherein when the computer program is executed by the processor, the steps of the video playback data reading method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Audio and video data processing method, server and computer storage medium
CN109842804A
Content caching and reading method, client and storage medium
CN112565870A