CN112040248B - Video compression method, system, terminal device and storage medium - Google Patents
- ️Fri Apr 29 2022
Disclosure of Invention
The embodiment of the application provides a video compression method, a video compression system, terminal equipment and a storage medium, and aims to solve the problems that a player needs to be manually installed, a video file needs to be manually selected and a video authentication function does not exist in the existing compressed video using process.
In a first aspect, an embodiment of the present application provides a video compression method, where the method includes:
the method comprises the steps of obtaining a pre-created executable file, wherein the pre-created executable file comprises a self-extracting executable file, a data packet list and a file header, and the self-extracting executable file is used for extracting the pre-created executable file when receiving an operation instruction aiming at the pre-created executable file;
acquiring video data and player data corresponding to the video data;
additionally writing the player data at the end of the self-decompression executable file to obtain player compressed data, and additionally writing the video data at the end of the self-decompression executable file to obtain video compressed data;
storing data packet information of the video compressed data and the player compressed data into the data packet list, wherein the data packet information comprises a data packet starting position, a data packet data amount and a data packet type;
and acquiring a decompression key of the video data, and storing the decompression key to the file header, wherein the decompression key is used for detecting whether the decompression operation aiming at the pre-created executable file has the decompression authority or not.
Compared with the prior art, the embodiment of the application has the advantages that: the video data and the player data are respectively additionally written at the tail end of the self-decompression executable file to obtain video compressed data and player compressed data, so that when the pre-created executable file is operated, the video compressed data and the player compressed data can be decompressed based on the self-decompression executable file to obtain corresponding video data and player data, the player data is obtained based on decompression, the video data can be effectively played, the player does not need to be manually downloaded and operated by a user, the problem that the player in the playing equipment cannot play due to the fact that the video types of the player and the video data are not matched in the prior art is solved, the playing efficiency of the video is improved, the data packet information of the video compressed data and the player compressed data is stored into a data packet list, and the pre-created executable file is decompressed, the video compressed data and the player compressed data obtained by decompression can be classified into the data packet based on the initial position of the data packet, the data packet data quantity and the data packet type in the data packet information, the decompression key of the video data is obtained, and the decompression key is stored to the file header, so that the decompression authentication effect can be achieved in the decompression process of the pre-created executable file, the decompression safety of the pre-created executable file is improved, and the playing safety of the video data obtained after the pre-created executable file is decompressed is improved.
Further, the additionally writing the player data at the end of the self-extracting executable file to obtain player compressed data includes:
additionally writing a first packet header structure body after the self-extracting executable file, wherein the first packet header structure body is used for identifying the related information of a subsequent data packet;
inquiring the file name of a player executable file in the player data, and additionally writing the file name of the player executable file to the tail of the first packet header structure;
acquiring the file length of the player executable file, and filling the file length of the player executable file into a member variable field of the first packet header structure;
acquiring a file directory of the player data, and additionally writing a folder and data information in the player data to the tail of the first packet header structure according to the file directory of the player data;
and additionally writing a node information structure body at the front end of the folder and/or the data information in the player data to obtain the player compressed data, wherein the node information structure body is used for identifying the file information of the file additionally arranged behind the node information structure body, and the file information comprises the file type, the file size, the file or the folder name.
Further, the additionally writing the video data at the end of the self-extracting executable file to obtain video compression data further includes:
additionally writing a second block header structure body after the self-extracting executable file, wherein the second block header structure body is used for identifying the related information of the subsequent data packet;
acquiring a file directory of the video data, and additionally writing a folder and data information in the video data to the tail of the second block header structure according to the file directory of the video data;
and adding the node information structure body at the front end of the folder and/or the data information in the video data to obtain the video compressed data.
Further, the method further comprises:
additionally writing a file check character string on the pre-created executable file, wherein the file check character string is used for checking whether the pre-created executable file is tampered before being decompressed;
acquiring a character starting position of the file check character string in the pre-created executable file, and acquiring a data check value set for the video data and a key length of the decompression key;
and storing the data check value, the character starting position and the key length to the file header.
Further, the method further comprises:
if an operation instruction aiming at the pre-created executable file is received, carrying out operation on byte stream data between the file check character string and the decompression key in the decompressed data according to a preset check algorithm to obtain an operation value;
if the operation value is the same as the data check value, performing data classification on the decompressed data according to the packet block list in the decompressed data to obtain the player data and the video data;
sending a key input prompt and receiving a key input by a user aiming at the key input prompt;
if the input key is the same as the decompression key in the file header, judging that the decompression operation aiming at the pre-created executable file has the decompression authority, and operating the self-decompression executable file to decompress the pre-created executable file to obtain decompressed data;
and playing the video according to the player data and the video data.
Further, the playing the video according to the player data and the video data includes:
taking the tail data of the first packet header structure in the decompressed data as a file name to read the player data to obtain an executable file of the player;
assembling a file path of the player executable file in the player data to obtain a player running path, performing file query on the video data to obtain a video file to be played, and obtaining a file path of the video file to be played in the video data to obtain a video playing path;
and running the player executable file according to the player running path, and sending a command line to the player executable file according to the video playing path so as to play the video aiming at the video file to be played.
Further, before the operation is performed on the byte stream data between the file check character string and the decompression key in the decompressed data according to a preset check algorithm to obtain an operation value, the method further includes:
and deleting the video file corresponding to the video playing path in the user directory of the equipment to be played.
In a second aspect, an embodiment of the present application provides a video compression system, including:
the executable file creating module is used for acquiring a pre-created executable file, wherein the pre-created executable file comprises a self-extracting executable file, a data packet list and a file header, and the self-extracting executable file is used for extracting the pre-created executable file when receiving an operation instruction aiming at the pre-created executable file.
The data acquisition module is used for acquiring video data and player data corresponding to the video data;
the data additional writing module is used for additionally writing the player data at the tail of the self-decompression executable file to obtain player compressed data, and additionally writing the video data at the tail of the self-decompression executable file to obtain video compressed data;
the data packet information storage module is used for storing data packet information of the video compressed data and the player compressed data into the data packet list, wherein the data packet information comprises a data packet starting position, data packet data quantity and a data packet type;
and the decompression key storage module is used for acquiring a decompression key of the video data and storing the decompression key to the file header, and the decompression key is used for detecting whether the decompression operation of the pre-created executable file has the decompression authority or not.
In a third aspect, an embodiment of the present application provides a terminal device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor executes the computer program to implement the method described above.
In a fourth aspect, the present application provides a storage medium storing a computer program, and when the computer program is executed by a processor, the computer program implements the method as described above.
In a fifth aspect, the present application provides a computer program product, which when run on a terminal device, causes the terminal device to execute the video compression method according to any one of the above first aspects.
It is understood that the beneficial effects of the second aspect to the fifth aspect can be referred to the related description of the first aspect, and are not described herein again.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Example one
Please refer to fig. 1, which is a flowchart illustrating a video compression method according to a first embodiment of the present application, including the steps of:
step S10, acquiring a pre-created executable file, and acquiring video data and player data corresponding to the video data.
The pre-created executable file comprises a self-extracting executable file, a data packet list and a file header, wherein the self-extracting executable file is used for extracting the pre-created executable file when receiving an operation instruction aiming at the pre-created executable file, the data packet list is used for storing the number of data packets in the pre-created executable file and data packet information corresponding to each data packet, and the self-extracting executable file can be a container.
Step S20, additionally writing the player data at the end of the self-extracting executable file to obtain player compressed data, and additionally writing the video data at the end of the self-extracting executable file to obtain video compressed data;
because the temporary file in the format of the & lttmp & gt cannot perform decompression operation, the error decompression operation on the pre-created executable file is prevented in the process that the video data and the player data are additionally written into the tail end of the self-decompression executable file, namely the decompression operation cannot be performed on the pre-created executable file in the process that the video data and the player data are additionally written into the tail end of the self-decompression executable file, and the integrity of the video compression data and the data additionally written by the player into the pre-created executable file is guaranteed.
Step S30, storing the packet information of the video compressed data and the player compressed data into the packet list.
The data packet information includes a data packet start position, a data packet data amount and a data packet type of a corresponding data packet, the data packet type includes a video type and a player type, that is, the data packet information in the video compressed data is the video type, the data packet information in the player compressed data is the player type, and the data packet information can be identified by using a character or a number character.
For example, a corresponding data packet type is identified by reading a number corresponding to a "cPackType" field in the data packet information, and when the number corresponding to the "cPackType" field is 1, the data packet type corresponding to the data packet information is determined to be a video type, and when the number corresponding to the "cPackType" field is 2, the data packet type corresponding to the data packet information is determined to be a player type.
Step S40, obtaining a decompression key of the video data, and storing the decompression key in the header.
After the decompression key is stored in the file header, the name of the temporary file in the format of the ". tmp" is modified and renamed to ". exe", so that the format of the pre-created executable file after the decompression key is stored in the file header is in the exe format, and further the subsequent operation aiming at the pre-created executable file is facilitated.
In this embodiment, since the video data is additionally written at the end of the self-extracting executable file, when the pre-created executable file receives an operation instruction, the self-extracting executable file is triggered to extract the file to obtain extracted data including the video data and player data, and the video data can be directly played based on the extracted player data, that is, the video data can be directly played by operating the pre-created executable file.
The step of decompressing the key is used to detect whether the operation of decompressing the pre-created executable file has the decompression authority, specifically, when the run instruction for the pre-created executable file is received, a key input prompt can be sent to prompt the user to input the key, and whether the operation of decompressing the pre-created executable file is executed is judged based on the key input by the user and the decompression key stored in the file header, that is, when the key input by the user is detected to be the same as the decompression key, the operation of decompressing the pre-created executable file is judged to have the decompression authority, the operation of decompressing the pre-created executable file is conducted by triggering the self-decompressing executable file, when the key input by the user is detected to be different from the decompression key, the operation of decompressing the pre-created executable file is judged not to have the decompression authority, the running of the pre-created executable file is stopped, and the safety of the decompression of the pre-created executable file is further improved, namely the safety of the playing of the video data obtained after the decompression of the pre-created executable file is improved.
In the embodiment, the video data and the player data are respectively additionally written at the tail end of the self-decompression executable file to obtain the video compressed data and the player compressed data, so that when the pre-created executable file is operated, the video compressed data and the player compressed data can be decompressed based on the self-decompression executable file to obtain the corresponding video data and player data, the player data can be obtained based on decompression, the video data can be effectively played, the player does not need to be manually downloaded and operated by a user, the problem that the player in the playing equipment cannot be played due to the fact that the video type of the player is not matched with that of the video data in the prior art is solved, the playing efficiency of the video is improved, the data packet information of the video compressed data and the player compressed data is stored into the data packet list, and the pre-created executable file is decompressed, the video data and the player data are integrated and compressed to the same pre-created executable file, so that the video data and the player data are synchronously transmitted, and after the pre-created executable file is decompressed, the video data and the player data can be effectively obtained and a corresponding player can be operated based on the decompressed player data, the playing of the video data is effectively guaranteed.
Example two
Please refer to fig. 2, which is a flowchart of a video compression method according to a second embodiment of the present application, where the second embodiment is used to refine step S20 in the first embodiment to refine how to additionally write the player data at the end of the self-extracting executable file to obtain player compressed data, and additionally write the video data at the end of the self-extracting executable file to obtain video compressed data, and includes the steps of:
step S11, additionally writing a first packet header structure after the self-extracting executable file;
the first packet HEADER structure is a "RMSP _ PACK _ HEADER" structure, and a character corresponding to a cPackType field in the first packet HEADER structure is 2, so as to identify information related to a subsequent packet of the first packet HEADER structure.
Step S12, querying a file name of a player executable file in the player data, and additionally writing the file name of the player executable file to the end of the first packet header structure;
the player executable file is used for running the player, and the file name of the player executable file is additionally written into the tail end of the first packet header structure body, so that the follow-up inquiry of the player executable file is effectively facilitated.
For example, if the file name of the player executable file is "minilayer. exe", the "minilayer. exe" is additionally written to the end of the first packet header structure.
Step S13, obtaining the file length of the player executable file, and filling the file length of the player executable file into the member variable field of the first chunk header structure;
the method comprises the following steps of filling the file length of the player executable file into a member variable field of a first block header structure, so that the follow-up inquiry of the player executable file is further facilitated.
For example, if the file length of the player executable file is 14 characters, the
full value14 is filled in the cExeFNLength field of the first packet header structure.
Step S14, acquiring a file directory of the player data, and additionally writing a folder and data information in the player data to the end of the first packet header structure according to the file directory of the player data;
wherein the file directory of the player data stores the directory relationship among different folders in the player data, for example, please refer to fig. 3, which is a schematic structural diagram of a file directory of player data according to a second embodiment of the present application, the player data includes a minilayer folder in which 10 folders and 3 data information are stored, the 10 folders are respectively a "Data" folder, a "dvepplus" folder, an "lnspectTool" folder, a "locales" folder, a "map" folder, a "netvideo" folder, a "newmap" folder, a "sound" folder, a "sysalm" folder and a "the" folder, the "Data" folder comprises an "OCX" folder and 5 pieces of Data information, the "OCX" folder comprises a "Setup folder and 1 executable file, the" Setup folder comprises a "Setup" folder, and the "Setup" folder comprises 2 pieces of Data information;
please refer to fig. 4, which is a schematic diagram of a structure of compressed Data of a player according to a second embodiment of the present application, in this step, Data information in a "minilayer" folder, a "Data" folder, a "dvepplus" folder, an "lnspectTool" folder, a "locales" folder, a "map" folder, a "netvideo" folder, a "newmap" folder, a "sound" folder, a "sysalm" folder, a "the" folder, an "OCX" folder, a "Setup" folder, and a "language" folder is sequentially appended to the end of a first block header structure according to a directory of the player Data.
Step S15, additionally writing a node information structure at the front end of the folder and/or data information in the player data to obtain the player compressed data.
Referring to fig. 4, a node information structure is additionally written in front ends of data information in different folders and/or different folders in the player data to identify positions and types of data information in different folders and/or different folders in the player data.
Specifically, in this step, the NODE information structure is configured to identify file information of a file appended to the NODE information structure, where the file information includes a file type, a file size, a file, or a folder name, and the NODE information structure may employ a "RMRPS _ PACKFILE _ NODE" structure, and a cNodeType field of the NODE information structure is configured to identify the file type of the file appended to the NODE information structure, where the file type of the file after the NODE information structure is a directory type when information in the cNodeType field of the NODE information structure is 1, and the file type of the file after the NODE information structure is a data type when information in the cNodeType field of the NODE information structure is 0.
Step S16, additionally writing a second header structure after the self-extracting executable file;
the second block HEADER structure is used for identifying information related to subsequent data packets, the second block HEADER structure and the first block HEADER structure are of the same type and adopt a 'RMSP _ PACK _ HEADER' structure, but characters corresponding to a cPacktype field in the second block HEADER structure are 1, data after the second block HEADER structure is identified are used as a video, and the filling quantity of the cExeFNLength field in the second block HEADER structure is 0 so as to represent that no executable file is arranged in the video.
Step S17, acquiring a file directory of the video data, and additionally writing a folder and data information in the video data to the end of the second block header structure according to the file directory of the video data;
for example, please refer to fig. 5, which is a schematic structural diagram of a file directory of video data provided in a second embodiment of the present application, where the video data includes a "c | B16T 67" folder, the "c | B16T 67" folder includes a "2016-06-29" folder, the "2016-06-29" folder includes a "log" folder, a "record" folder and 1 piece of data information, the "log" folder includes a "blackbex" folder and 6 pieces of data information, the "blackbex" folder includes 1 piece of file information, and the "record" folder includes 4 pieces of video files.
Specifically, please refer to fig. 6, which is a schematic structural diagram of video compressed data according to a second embodiment of the present application, in this step, data information in a "yu B16T 67" folder, a "2016-06-29" folder, a "log" folder, a "record" folder, and a "blackbex" folder is sequentially additionally written to the end of the second packet header structure according to a directory of the video data.
And step S18, adding the node information structure to the front end of the folder and/or data information in the video data to obtain the video compressed data.
Referring to fig. 6, a node information structure is additionally written in the front ends of the data information in different folders and/or different folders in the video data to identify the positions and types of the data information in different folders and/or different folders in the video data.
Optionally, in this embodiment, the video compression method further includes:
additionally writing a file check character string on the pre-created executable file, and acquiring a character starting position of the file check character string in the pre-created executable file;
acquiring a data check value set for the video data and a key length of the decompression key, and storing the data check value, the character starting position and the key length to the file header;
the file check character string is used to check whether the pre-created executable file is tampered before being decompressed, and the file check character string may be set as required, for example, the file check character string may be set as an "STRT" character or an "ASD" character, and the like.
Optionally, in this step, the HEADER uses a "RMSP _ FILE _ HEADER" structure, the start position of the character is stored in an ulOffsetStartSig field in the HEADER, the data check value may be set according to a requirement, the data check value is stored in an ulCrcCode field in the HEADER, the decompression key is stored in an szPassword field in the HEADER, and the key length is stored in a cpassword count0 field in the HEADER.
Optionally, a key identification field is further set in the header, where the key identification field may be used to represent whether a decompression key is set in the header, and the key identification field may be a cpassword vad field, and when a character corresponding to the cpassword vad field is 1, it is determined that a decompression key is set in the header, and when a character corresponding to the cpassword vad field is 0, it is determined that no decompression key is set in the header, further, a cPackItemCount field in the header is used to identify the number of data packets in the pre-created executable file, and when a character corresponding to the cpassitemcount field is 2, the number of data packets in the pre-created executable file is 2.
Referring to fig. 7, a schematic structural diagram of a pre-created executable file provided in the second embodiment of the present application, the pre-created executable file includes a self-extracting executable file, player compressed data, video compressed data, a file check string, a packet block list, and a header, the self-extracting executable file uses a container.
In the embodiment, by additionally writing the first header structure and the second header structure after the executable file is self-decompressed, the data positions of corresponding player data and video data in the pre-created executable file can be effectively identified, the file name of the executable file of the player is additionally written to the tail of the first header structure, the query of the executable file of the subsequent player is effectively facilitated, the operation of the subsequent player is ensured, the file directory of the player data is obtained, the folder and the data information in the player data are additionally written to the tail of the first header structure according to the file directory of the player data, the accuracy of the player data compression is effectively ensured, the data transformation in the player data compression process is prevented, the file directory of the video data is obtained, and the folder and the data information in the video data are additionally written to the second header structure according to the file directory of the video data The tail end of the structure body effectively guarantees the accuracy of video data compression, prevents data transformation in the video data compression process, and can effectively identify the positions and types of folders and data information in player data and video data by adding the node information structure body at the front end of the folders and/or data information in the video data and at the front end of the folders and/or data information in the player data, thereby effectively guaranteeing the operation of a subsequent player and the playing of the video data.
EXAMPLE III
Please refer to fig. 8, which is a flowchart illustrating a video compression method according to a third embodiment of the present application, where the third embodiment further includes the following steps, relative to the second embodiment:
step S70, if an operation instruction for the pre-created executable file is received, calculating byte stream data between the file check character string and the decompression key in the decompressed data according to a preset check algorithm to obtain a calculation value;
the operation instruction can be transmitted in a mode of a voice instruction, a touch instruction or a wireless signal instruction.
Step S80, if the operation value is the same as the data check value, performing data classification on the decompressed data according to the packet block list in the decompressed data to obtain the player data and the video data;
if the operation value is the same as the data check value, it is judged that the pre-created executable file is not tampered before being decompressed, and the decompressed data is classified according to the initial position of the data packet, the data packet data amount and the data packet type stored in the packet block list, so as to obtain corresponding player data and video data.
Specifically, in this step, it is determined whether the data in the header is tampered by detecting that the operation value is the same as the data verification value.
Step S90, sending a key input prompt, and receiving a key input by the user for the key input prompt.
Step S100, if the inputted key is the same as the decompression key in the file header, determining that the decompression operation for the pre-created executable file has a decompression authority, and operating the self-decompression executable file to decompress the pre-created executable file to obtain decompressed data;
if the input key is the same as the decompression key in the file header, the user is judged to have the decompression authority for the decompression operation of the pre-created executable file, the pre-created executable file can be decompressed, the pre-created executable file is decompressed by running the self-decompression executable file, and decompressed data is obtained, wherein the decompressed data comprises video compressed data and data decompressed by player compressed data.
And step S110, performing video playing according to the player data and the video data.
Specifically, in this step, the playing the video according to the player data and the video data includes:
taking the tail data of the first packet header structure in the decompressed data as a file name to read the player data to obtain an executable file of the player;
assembling a file path of the player executable file in the player data to obtain a player running path, performing file query on the video data to obtain a video file to be played, and obtaining a file path of the video file to be played in the video data to obtain a video playing path;
running the player executable file according to the player running path, and sending a command line to the player executable file according to the video playing path so as to play a video for the video file to be played;
wherein, the player data is subjected to file query by taking the tail data of the first packet header structure in the decompressed data as a file name, so that the player executable file in the player data can be effectively acquired, the player running path is obtained by obtaining the file path of the player executable file in the player data, the player executable file can be effectively run based on the player running path to start the player, by inquiring the video file to be played in the video data, the video playing of the video file to be played is further ensured, specifically, in this step, the self-extracting executable file can run the player executable file according to the queried player running path, the player is started, and the inquired video playing path is sent to the started player, so that the effect of automatically playing the video file to be played is achieved.
Optionally, after obtaining the file path of the video file to be played in the video data and obtaining the video playing path, the method further includes:
deleting the video file corresponding to the video playing path in the user directory of the equipment to be played;
the video playing path corresponding to the video file in the local user directory is deleted, so that playing errors of the player in the process of playing the video file to be played are effectively prevented, disorder of video playing is prevented, and accuracy of video playing is improved.
Specifically, the specific implementation steps of this embodiment include:
1. checking whether an RMPKFPYS character string in the file header is tampered, wherein the RMPKFPYS character string is stored in an szPackFileSig field of the file header and is used for detecting whether the file header is tampered;
2. checking whether the data check value is consistent with the check value filled in the file header;
3. checking whether the STRT is tampered;
4. checking whether a PACK character string is tampered, wherein the PACK is a character string corresponding to a member variable field (RMSP _ PACK _ HEADER) in the first and second block HEADER structures, and checking whether the PACK character string is tampered to ensure that the compressed pre-created executable file is not damaged;
5. checking whether the key exists and the correctness of the key input by the user;
6. decompressing player data (deleting minilayer folder under user directory before decompressing);
7. decompressing the video data;
8. and opening the player, and transmitting a video file path for playing.
In the embodiment, only the pre-created executable file needs to be operated, the effects of automatically starting the player and automatically playing the video to be played can be achieved, the player does not need to be manually downloaded and operated by a user, the video playing efficiency is improved, whether the user has the decompression permission for the pre-created executable file can be effectively detected by sending the key input prompt and receiving the input key aiming at the key input prompt, the safety of video playing is improved, whether the pre-created executable file is tampered before decompression can be effectively verified by operating characters between the file check character string and the decompression key in the decompressed data according to the preset check algorithm, and the decompression accuracy of the pre-created executable file is improved.
Example four
Fig. 9 shows a schematic structural diagram of a
video compression system100 provided in the fourth embodiment of the present application, corresponding to the video compression method described in the above embodiments, and only shows the relevant parts in the embodiments of the present application for convenience of description.
Referring to fig. 9, the system includes: an execution
file creating module10, a
data obtaining module11, a data appending and
writing module12, a data packet
information storing module13 and a decompression
key storing module14, wherein:
the executable
file creating module10 is configured to obtain a pre-created executable file, where the pre-created executable file includes a self-extracting executable file, a data packet list, and a file header, and the self-extracting executable file is configured to perform an extracting operation on the pre-created executable file when receiving an operation instruction for the pre-created executable file.
The
data obtaining module11 is configured to obtain video data and player data corresponding to the video data.
And a data
additional writing module12, configured to additionally write the player data at the end of the self-extracting executable file to obtain player compressed data, and additionally write the video data at the end of the self-extracting executable file to obtain video compressed data.
Wherein the data appending
writing module12 is further configured to:
additionally writing a first packet header structure body after the self-extracting executable file, wherein the first packet header structure body is used for identifying the related information of a subsequent data packet;
inquiring the file name of a player executable file in the player data, and additionally writing the file name of the player executable file to the tail of the first packet header structure;
acquiring the file length of the player executable file, and filling the file length of the player executable file into a member variable field of the first packet header structure;
acquiring a file directory of the player data, and additionally writing a folder and data information in the player data to the tail of the first packet header structure according to the file directory of the player data;
and additionally writing a node information structure body at the front end of the folder and/or the data information in the player data to obtain the player compressed data, wherein the node information structure body is used for identifying the file information of the file additionally arranged behind the node information structure body, and the file information comprises the file type, the file size, the file or the folder name.
Optionally, the data appending and
writing module12 is further configured to: additionally writing a second block header structure body after the self-extracting executable file, wherein the second block header structure body is used for identifying the related information of the subsequent data packet;
acquiring a file directory of the video data, and additionally writing a folder and data information in the video data to the tail of the second block header structure according to the file directory of the video data;
and adding the node information structure body at the front end of the folder and/or the data information in the video data to obtain the video compressed data.
A data packet
information storage module13, configured to store data packet information of the video compressed data and the player compressed data in the data packet list, where the data packet information includes a data packet start position, a data packet data amount, and a data packet type.
And the decompression
key storage module14 is configured to obtain a decompression key of the video data, and store the decompression key to the file header, where the decompression key is used to detect whether a decompression operation for the pre-created executable file has a decompression right.
Optionally, the
video compression system100 further includes:
a check
character adding module15, configured to add a file check character string to the pre-created executable file, where the file check character string is used to check whether the pre-created executable file is tampered before being decompressed;
acquiring a character starting position of the file check character string in the pre-created executable file, and acquiring a data check value set for the video data and a key length of the decompression key;
and storing the data check value, the character starting position and the key length to the file header.
The
video playing module16 is configured to, if an operation instruction for the pre-created executable file is received, perform an operation on byte stream data between the file check character string in the decompressed data and the decompressed key according to a preset check algorithm to obtain an operation value;
if the operation value is the same as the data check value, performing data classification on the decompressed data according to the packet block list in the decompressed data to obtain the player data and the video data;
sending a key input prompt and receiving a key input by a user aiming at the key input prompt;
if the input key is the same as the decompression key in the file header, judging that the decompression operation aiming at the pre-created executable file has the decompression authority, and operating the self-decompression executable file to decompress the pre-created executable file to obtain decompressed data;
and playing the video according to the player data and the video data.
Optionally, the
video playing module16 is further configured to:
taking the tail data of the first packet header structure in the decompressed data as a file name to read the player data to obtain an executable file of the player;
assembling a file path of the player executable file in the player data to obtain a player running path, performing file query on the video data to obtain a video file to be played, and obtaining a file path of the video file to be played in the video data to obtain a video playing path;
and running the player executable file according to the player running path, and sending a command line to the player executable file according to the video playing path so as to play the video aiming at the video file to be played.
Optionally, the
video playing module16 is further configured to: and deleting the video file corresponding to the video playing path in the user directory of the equipment to be played.
In the embodiment, the video data and the player data are respectively additionally written at the tail end of the self-decompression executable file to obtain the video compressed data and the player compressed data, so that when the pre-created executable file is operated, the video compressed data and the player compressed data can be decompressed based on the self-decompression executable file to obtain the corresponding video data and player data, the player data can be obtained based on decompression, the video data can be effectively played, the player does not need to be manually downloaded and operated by a user, the problem that the player in the playing equipment cannot be played due to the fact that the video type of the player is not matched with that of the video data in the prior art is solved, the playing efficiency of the video is improved, the data packet information of the video compressed data and the player compressed data is stored into the data packet list, and the pre-created executable file is decompressed, the video compressed data and the player compressed data obtained by decompression can be classified into the data packet based on the initial position of the data packet, the data packet data quantity and the data packet type in the data packet information, the decompression key of the video data is obtained, and the decompression key is stored to the file header, so that the decompression authentication effect can be achieved in the decompression process of the pre-created executable file, the decompression safety of the pre-created executable file is improved, and the playing safety of the video data obtained after the pre-created executable file is decompressed is improved.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/modules, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and reference may be made to the part of the embodiment of the method specifically, and details are not described here.
Fig. 10 is a schematic structural diagram of a
terminal device2 according to a fifth embodiment of the present application. As shown in fig. 10, the
terminal device2 of this embodiment includes: at least one processor 20 (only one processor is shown in fig. 10), a
memory21, and a
computer program22 stored in the
memory21 and executable on the at least one
processor20, the steps of any of the various method embodiments described above being implemented when the
computer program22 is executed by the
processor20.
The
terminal device2 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a
processor20, a
memory21. Those skilled in the art will appreciate that fig. 10 is merely an example of the
terminal device2, and does not constitute a limitation of the
terminal device2, and may include more or less components than those shown, or combine some components, or different components, such as an input-output device, a network access device, and the like.
The
Processor20 may be a Central Processing Unit (CPU), and the
Processor20 may be other 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, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The
memory21 may in some embodiments be an internal storage unit of the
terminal device2, such as a hard disk or a memory of the
terminal device2. The
memory21 may also be an external storage device of the
terminal device2 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the
terminal device2. Further, the
memory21 may also include both an internal storage unit and an external storage device of the
terminal device2. The
memory21 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer program. The
memory21 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
An embodiment of the present application further provides a network device, where the network device includes: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, the processor implementing the steps of any of the various method embodiments described above when executing the computer program.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.