CN117271448A - File repair method, device, terminal equipment and readable storage medium - Google Patents

File repair method, device, terminal equipment and readable storage medium Download PDF

Info

Publication number
CN117271448A
CN117271448A CN202311027598.9A CN202311027598A CN117271448A CN 117271448 A CN117271448 A CN 117271448A CN 202311027598 A CN202311027598 A CN 202311027598A CN 117271448 A CN117271448 A CN 117271448A
Authority
CN
China
Prior art keywords
file
repaired
audio data
block
identifier
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202311027598.9A
Other languages
Chinese (zh)
Inventor
孙丽
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Afirstsoft Co Ltd
Original Assignee
Afirstsoft Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Afirstsoft Co Ltd filed Critical Afirstsoft Co Ltd
Priority to CN202311027598.9A priority Critical patent/CN117271448A/en
Publication of CN117271448A publication Critical patent/CN117271448A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation

Abstract

The application is applicable to the technical field of repair and provides a file repair method, device, terminal equipment and readable storage medium. The file repairing method comprises the following steps: obtaining a file to be repaired, wherein the file to be repaired is a damaged WAV file; extracting audio data from the file to be repaired; obtaining format information corresponding to the audio data, wherein the format information comprises one or more of coding format, sound channel number, sampling frequency, transmission rate, block alignment and sampling bit number; and generating a repair file based on the audio data and the format information, wherein the repair file is a repaired WAV file. The embodiment of the application can repair the damaged WAV file to obtain the repaired WAV file.

Description

File repair method, device, terminal equipment and readable storage medium
Technical Field
The application belongs to the technical field of repair, and particularly relates to a file repair method, device, terminal equipment and readable storage medium.
Background
WAV is a standard digital audio file developed by microsoft corporation for Windows, one of the most common sound file formats that can record various mono or stereo sound information and ensure that the sound is not distorted. In the related art, when a WAV file is damaged, the WAV file cannot be repaired so that it can be normally opened.
Disclosure of Invention
The embodiment of the application provides a file repairing method, device, terminal equipment and readable storage medium, which can solve the problem that a damaged WAV file cannot be repaired by a related technology.
In a first aspect, an embodiment of the present application provides a method for repairing a file, including:
obtaining a file to be repaired, wherein the file to be repaired is a damaged WAV file;
extracting audio data from the file to be repaired;
obtaining format information corresponding to the audio data, wherein the format information comprises one or more of coding format, sound channel number, sampling frequency, transmission rate, block alignment and sampling bit number;
and generating a repair file based on the audio data and the format information, wherein the repair file is a repaired WAV file.
In a second aspect, an embodiment of the present application provides a repair device for a document, including:
the first acquisition module is used for acquiring a file to be repaired, wherein the file to be repaired is a damaged WAV file;
the extraction module is used for extracting the audio data from the file to be repaired;
the second acquisition module is used for acquiring format information corresponding to the audio data, wherein the format information comprises one or more of coding format, sound channel number, sampling frequency, transmission rate, block alignment and sampling bit number;
the generating module is used for generating a repair file based on the audio data and the format information, wherein the repair file is a repaired WAV file.
In a third aspect, an embodiment of the present application provides a terminal device, including a memory, a processor, and a computer program stored in the memory and capable of running on the processor, where the processor implements steps of a method for repairing the file when the processor executes the computer program.
In a fourth aspect, embodiments of the present application provide a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the above-described file repair method.
In a fifth aspect, embodiments of the present application provide a computer program product, which when run on a terminal device, causes the terminal device to perform a method for repairing a file as described above.
Compared with the prior art, the beneficial effects of the embodiment of the application are as follows: according to the embodiment of the application, the file to be repaired is obtained, the audio data is extracted from the file to be repaired, the format information corresponding to the audio data is obtained, and finally the repair file is generated based on the audio data and the format information. The embodiment of the application can repair the damaged WAV file to obtain the repaired WAV file.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings that are required for the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present application, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a schematic implementation flow chart of a file repair method according to an embodiment of the present application;
fig. 2 is a schematic flowchart of an implementation of obtaining format information corresponding to audio data according to an embodiment of the present application;
fig. 3 is a schematic flowchart of another implementation of obtaining format information corresponding to audio data according to an embodiment of the present application;
fig. 4 is a schematic flowchart of an implementation of extracting audio data according to an embodiment of the present application;
FIG. 5 is a schematic diagram of an implementation flow for generating a repair file according to an embodiment of the present application;
FIG. 6 is a schematic diagram of an implementation flow for obtaining a Fact block according to an embodiment of the present application;
FIG. 7 is a schematic diagram of an implementation flow of acquiring a RIFF block according to an embodiment of the present application;
FIG. 8 is a schematic structural diagram of a file repair device according to an embodiment of the present disclosure;
fig. 9 is a schematic structural diagram of a terminal device provided in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is further described in detail below with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, are intended to be protected herein.
It is noted that the terms "comprising," "including," and "having," and any variations thereof, in the description and claims of the present application and in the foregoing figures, are intended to cover non-exclusive inclusions. For example, a process, method, terminal, article, or apparatus that comprises a list of steps or elements is not limited to only those listed steps or elements but may include other steps or elements not listed or inherent to such process, method, article, or apparatus. In the claims, specification, and drawings of this application, relational terms such as "first" and "second," and the like are used solely to distinguish one entity/operation/object from another entity/operation/object without necessarily requiring or implying any such real-time relationship or order between such entities/operations/objects.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the present application. The appearances of such phrases in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. Those of skill in the art will explicitly and implicitly appreciate that the embodiments described herein may be combined with other embodiments.
WAV is a standard digital audio file developed by microsoft corporation for Windows, one of the most common sound file formats that can record various mono or stereo sound information and ensure that the sound is not distorted. In the related art, when a WAV file is damaged, the WAV file cannot be repaired so that it can be normally opened.
In view of this, in the embodiment of the present application, by extracting audio data from a file to be repaired, and then obtaining format information corresponding to the audio data, a repair file is finally generated based on the audio data and the format information, so that a damaged WAV file can be repaired, and a repaired WAV file is obtained.
In order to illustrate the technical solution of the present application, the following description is made by specific examples.
Fig. 1 shows a schematic implementation flow chart of a file repair method provided in an embodiment of the present application, where the method may be applied to a terminal device. The terminal device may be a mobile phone, tablet computer, notebook computer, ultra-mobile personal computer (UMPC), netbook, etc.
Specifically, the method for repairing a file may include the following steps S101 to S104.
Step S101, obtaining a file to be repaired.
The file to be repaired is a damaged WAV file, the WAV file follows the RIFF rule, the content of which is stored in blocks (chunk) as a minimum unit, and the WAV file is generally composed of RIFF blocks, where the RIFF blocks include at least Format blocks and Data blocks, and in some cases, the RIFF blocks may further include List blocks. The Format block records Format information such as coding Format, number of channels, sampling frequency, transmission rate, block alignment, sampling bit number, etc. The Data block has audio Data recorded therein.
In the embodiment of the present application, the terminal device may directly obtain the file to be repaired input by the user, or may directly retrieve the file to be repaired stored in the memory, and the method for obtaining the file to be repaired is not limited in the embodiment of the present application.
Step S102, extracting the audio data from the file to be repaired.
In the embodiment of the application, the terminal device may find the identifier corresponding to the Data block in the file to be repaired, and further determine the offset position (the offset position is the position of the corresponding block in the file) and the length of the Data block, so as to extract the audio Data in the Data block from the file to be repaired.
Step S103, format information corresponding to the audio data is acquired.
Wherein the format information includes one or more of coding format, number of channels, sampling frequency, transmission rate, block alignment, sampling bit number. The coding format typically has 0x01 to 0x50 and 0xFFFE, the number of channels typically has mono and bi-channels, the sampling frequencies typically have 8, 11.025, 12, 16, 22.05, 24, 32, 44.1, 48, 64, 88.2, 96, 176.4, 192kHZ, and the number of sampling bits typically have 8, 16, 24, 32, 64.
In the embodiment of the application, when the file to be repaired contains the Format block, the terminal device may extract the Format information in the Format block from the file to be repaired. When the file to be repaired does not contain the Format block, the terminal equipment can extract the Format information from the reference file as the Format information corresponding to the audio data in the file to be repaired.
Step S104, generating a repair file based on the audio data and the format information.
The repair file is a repaired WAV file.
In the embodiment of the present application, after obtaining the audio data and the corresponding format information, the terminal device may add the audio data and the corresponding format information to the newly created WAV file (the newly created WAV file does not include the audio data and the corresponding format information), to obtain a repaired WAV file, that is, a repair file.
Compared with the prior art, the beneficial effects of the embodiment of the application are as follows: compared with the prior art, the beneficial effects of the embodiment of the application are as follows: according to the embodiment of the application, the file to be repaired is obtained, the audio data is extracted from the file to be repaired, the format information corresponding to the audio data is obtained, and finally the repair file is generated based on the audio data and the format information. The embodiment of the application can repair the damaged WAV file to obtain the repaired WAV file.
As shown in fig. 2, in some embodiments of the present application, when the file to be repaired includes a Format block, the obtaining Format information corresponding to the audio data may specifically include step S201 and step S202.
Step S201, searching for a first identifier from the file to be repaired.
The first identifier is used for determining the position of the Format block in the file to be repaired.
In an embodiment of the present application, the first identifier may be set to "fmt". The terminal equipment searches for an identifier of 'fmt' in the file to be repaired, and after finding the identifier of 'fmt', the terminal equipment can acquire the position of the Format block in the file to be repaired.
Step S202, format information corresponding to audio data of preset digital bytes after extracting the first identifier.
The preset number may be set to 16, in the Format block of the WAV file, the length of the Format block of 4 bytes after the "fmt" identifier, and the Format information corresponding to the audio data after the byte corresponding to the length of the Format block is generally 16 bytes.
In the embodiment of the application, after the position of the Format block in the file to be repaired is obtained, the terminal device can jump to the position of the Format block, read 4 bytes backwards to obtain the length of the Format block, read 16 bytes of data after the length of the Format block, and sequentially obtain Format information such as 2 bytes of coding Format, 2 bytes of sound channel number, 4 bytes of sampling frequency, 4 bytes of transmission rate, 2 bytes of block alignment, 2 bytes of sampling bit number and the like.
As shown in fig. 3, in some embodiments of the present application, when the file to be repaired does not include a Format block, and the Format information includes the coding Format, the number of channels, the sampling frequency, the transmission rate, the block alignment, and the number of sampling bits, the obtaining the Format information corresponding to the audio data may specifically include steps S301 to S304.
Step S301, a reference file is acquired.
The reference file is a WAV file, the reference file and the file to be repaired are recorded by the same equipment, and the reference file and the file to be repaired are different files. Because the reference file and the file to be repaired are recorded by the same equipment, the format information in the reference file is basically consistent with the corresponding format information in the file to be repaired.
In the embodiment of the present application, the terminal device may directly obtain the reference file input by the user, or may directly retrieve the reference file stored in the memory, and the manner of obtaining the reference file is not limited in the embodiment of the present application.
In step S302, the encoding format, the number of channels, the sampling frequency, and the sampling bit number in the reference file are extracted.
In the embodiment of the application, the terminal device can search the reference file for the 'fmt' identifier, and after finding the 'fmt' identifier, the terminal device can acquire the position of the Format block in the reference file. After the position of the Format block in the reference file is obtained, the terminal device can jump to the position of the Format block, read 4 bytes backwards to obtain the length of the Format block, and read the coding Format, the number of sound channels, the sampling frequency and the sampling bit number in the data of 16 bytes after the length of the Format block. The specific extraction process may refer to step S202, which is not described herein.
Step S303, calculating the transmission rate based on the number of channels, the sampling frequency, and the number of sampling bits in the reference file.
In the embodiment of the present application, after obtaining the number of channels, the sampling frequency, and the number of sampling bits, the terminal device may calculate the transmission rate. The specific calculation formula is as follows: transmission rate = sampling frequency x number of channels x number of sampling bits/8.
Step S304, calculating block alignment based on the number of channels and the number of sampling bits in the reference file.
In the embodiment of the present application, after obtaining the number of channels and the number of sampling bits, the terminal device may calculate the block alignment. The specific calculation formula is as follows: block alignment = number of sample bits × number of channels/8.
As shown in fig. 4, in some embodiments of the present application, the extracting the audio data from the file to be repaired may further include steps S401 to S407.
Step S401, searching a second identifier from the file to be repaired.
Wherein the second identifier is used to determine the location of the Data block in the file to be repaired.
In an embodiment of the present application, the second identifier may be set to "data". The terminal equipment searches the Data identifier in the file to be repaired, and after the Data identifier is found, the terminal equipment can determine the position of the Data block in the file to be repaired.
Step S402, determining the length of the audio data according to 4 bytes after the second identifier.
In the embodiment of the present application, 4 bytes after the second identifier are the length of the audio data, so the terminal device can read the 4 bytes after the second identifier, thereby determining the length of the audio data.
Step S403, acquiring the length of the file to be repaired.
In the embodiment of the application, the terminal device may directly obtain the length of the file to be repaired.
Step S404, searching a third identifier from the file to be repaired.
In the embodiment of the present application, the third identifier may be set to "LIST", and the terminal device searches for the "LIST" identifier in the file to be repaired.
Step S405, determining the position of the List block according to 4 bytes after the third identifier.
In the embodiment of the present application, 4 bytes after the "LIST" identifier record the length of the LIST block. After finding the LIST identifier, the terminal device may determine the location of the LIST block in the file to be repaired according to the LIST identifier and the length of the LIST block.
Step S406, determining the position of the audio data based on the length of the audio data, the length of the file to be repaired, and the position of the List block.
In the embodiment of the present application, after obtaining the length of the audio data, the length of the file to be repaired, and the position of the List block, the terminal device may determine the position of the audio data.
Specifically, the terminal device compares the length of the audio data with the length of the file to be repaired. When the length of the audio data is greater than the length of the file to be repaired, it may be indicated that the audio data is partially lost, and at this time, the audio data may be determined from the fifth byte after the "data" identifier to the end of the file to be repaired. When the length of the audio data is smaller than the length of the file to be repaired and the LIST identifier precedes the data identifier, the audio data may be determined from the fifth byte after the data identifier to the end of the file to be repaired. When the length of the audio data is smaller than the length of the file to be repaired and the "LIST" identifier follows the "data" identifier, the data from the fifth byte following the "data" identifier to the immediately preceding "LIST" identifier may be determined as the audio data.
Step S407, extracting audio data based on the length of the audio data and the position of the audio data.
In the embodiment of the present application, after obtaining the length of the audio data and the position of the audio data, the terminal device may read the data of the length of the audio data from the starting position of the audio data in the file to be repaired, to obtain the audio data in the file to be repaired.
As shown in fig. 5, in some embodiments of the present application, the generating a repair file based on the audio data and the format information may specifically include step S501 and step S502.
Step S501, a RIFF block, a face block, and a List block are acquired.
As shown in fig. 6, in some embodiments of the present application, the acquiring the Fact block may specifically include step S601 and step S602.
Step S601, searching for a fourth identifier from the file to be repaired.
In the embodiment of the present application, the fourth identifier may be set to "face", and the terminal device searches the file to be repaired for the "face" identifier.
Step S602, determining the length and the position of the Fact block according to 4 bytes after the fourth identifier.
In the embodiment of the present application, 4 bytes after the "face" identifier record the length of the face block. After finding the "Fact" identifier, the terminal device may read 4 bytes after the "Fact" identifier to obtain the length of the Fact block, and determine the position of the Fact block in the file to be repaired according to the "Fact" identifier and the length of the Fact block.
As shown in fig. 7, in some embodiments of the present application, the above-mentioned acquisition RIFF block may specifically include step S701 and step S702.
Step S701, searching for a fifth identifier from the file to be repaired.
In an embodiment of the present application, the fifth identifier may be set to "RIFF", and the terminal device searches for the "RIFF" identifier in the file to be repaired.
Step S702, determining the length and position of the RIFF block according to 4 bytes after the fifth identifier.
In an embodiment of the present application, 4 bytes after the "RIFF" identifier record the length of the RIFF block. After finding the "RIFF" identifier, the terminal device may read 4 bytes after the "RIFF" identifier to obtain the length of the RIFF block, and determine the location of the RIFF block in the file to be repaired according to the "RIFF" identifier and the length of the RIFF block.
In other embodiments of the present application, when the file to be repaired does not include the RIFF block, the obtaining the RIFF block may further include:
creating a new RIFF block and writing a sixth identifier of 4 bytes; calculating the size of the RIFF block and writing 4 bytes after the sixth identifier; a 4 byte "WAVE" character is written in the RIFF block.
Wherein the sixth identifier may be set to "RIFF".
Step S502, writing the RIFF block, the face block, the List block, the audio data and the format information into the newly created WAV file to obtain a repair file.
In the embodiment of the present application, the terminal device may first create a new WAV file, where there is no data such as audio data and format information. The terminal device may write the RIFF block, the Fact block, the List block, the audio data, and the format information into the newly created WAV file, thereby obtaining the repair file. At this time, the repair file contains audio data from the file to be repaired, and data such as format information, RIFF blocks, face blocks, list blocks and the like from the file to be repaired or created according to corresponding data in the file to be repaired. The audio data in the repair file can be read and played by the playing device, so that the damaged WAV file is repaired.
Fig. 8 shows a schematic structural diagram of a file repairing apparatus provided in an embodiment of the present application, where the file repairing apparatus 8 may be configured on a terminal device, and specifically, the file repairing apparatus 8 may include:
the first obtaining module 801 is configured to obtain a file to be repaired, where the file to be repaired is a damaged WAV file.
An extracting module 802, configured to extract audio data from the file to be repaired.
The second obtaining module 803 is configured to obtain format information corresponding to the audio data, where the format information includes one or more of an encoding format, a channel number, a sampling frequency, a transmission rate, a block alignment, and a sampling bit number.
The generating module 804 is configured to generate a repair file based on the audio data and the format information, where the repair file is a repaired WAV file.
Compared with the prior art, the beneficial effects of the embodiment of the application are as follows: according to the embodiment of the application, the file to be repaired is obtained, the audio data is extracted from the file to be repaired, the format information corresponding to the audio data is obtained, and finally the repair file is generated based on the audio data and the format information. The embodiment of the application can repair the damaged WAV file to obtain the repaired WAV file.
In some embodiments of the present application, the second obtaining module 803 is further configured to: searching a first identifier from the file to be repaired; and extracting format information corresponding to the audio data of the preset digital bytes after the first identifier.
In some embodiments of the present application, when the format information includes the coding format, the number of channels, the sampling frequency, the transmission rate, the block alignment, and the number of sampling bits, the second obtaining module 803 is further configured to: acquiring a reference file, wherein the reference file is a WAV file recorded by the same equipment as the to-be-repaired file, and the reference file and the to-be-repaired file are different files; extracting coding format, sound channel number, sampling frequency and sampling bit number in the reference file; calculating a transmission rate based on the number of channels, the sampling frequency, and the number of sampling bits in the reference file; block alignment is calculated based on the number of channels in the reference file and the number of sample bits.
In some embodiments of the present application, the extraction module 802 is further configured to: searching a second identifier from the file to be repaired; determining the length of the audio data from 4 bytes after the second identifier; acquiring the length of a file to be repaired; searching a third identifier from the file to be repaired; determining the position of the List block according to 4 bytes after the third identifier; determining the position of the audio data based on the length of the audio data, the length of the file to be repaired and the position of the List block; audio data is extracted based on the length of the audio data and the location of the audio data.
In some embodiments of the present application, the generating module 804 is further configured to: acquiring an RIFF block, a face block and a List block; and writing the RIFF block, the face block, the List block, the audio data and the format information into the newly created WAV file to obtain a repair file.
In some embodiments of the present application, the generating module 804 is further configured to: searching a fourth identifier from the file to be repaired; the length and position of the Fact block are determined from the 4 bytes after the fourth identifier.
In some embodiments of the present application, the generating module 804 is further configured to: searching a fifth identifier from the file to be repaired; the length and location of the RIFF block are determined from the 4 bytes after the fifth identifier.
Fig. 9 is a schematic diagram of a terminal device according to an embodiment of the present application. The terminal device 9 may include: a processor 901, a memory 902, and a computer program 903, such as a file repair program, stored in the memory 902 and executable on the processor 901. The processor 901 implements the steps in the above-described embodiments of the repair method of each file when executing the computer program 903, for example, steps S101 to S104 shown in fig. 1. Alternatively, the processor 901 may implement the functions of the modules/units in the above-described apparatus embodiments when executing the computer program 903, for example, the first obtaining module 801, the extracting module 802, the second obtaining module 803, and the generating module 804 shown in fig. 8.
The computer program may be divided into one or more modules/units, which are stored in the memory 902 and executed by the processor 901 to complete the present application. The one or more modules/units may be a series of computer program instruction segments capable of performing the specified functions, which instruction segments are used for describing the execution of the computer program in the terminal device.
The terminal device may include, but is not limited to, a processor 901, a memory 902. It will be appreciated by those skilled in the art that fig. 9 is merely an example of a terminal device and is not limiting of the terminal device, and may include more or fewer components than shown, or may combine some components, or different components, e.g., the terminal device may also include input and output devices, network access devices, buses, etc.
The processor 901 may be a central processing unit (Central Processing Unit, CPU), other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 902 may be an internal storage unit of the terminal device, such as a hard disk or a memory of the terminal device. The memory 902 may also be an external storage device of the terminal device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like. Further, the memory 902 may also include both an internal storage unit and an external storage device of the terminal device. The memory 902 is used for storing the computer program and other programs and data required by the terminal device. The memory 902 may also be used to temporarily store data that has been output or is to be output.
It should be noted that, for convenience and brevity of description, the structure of the above terminal device may also refer to a specific description of the structure in the method embodiment, which is not repeated herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a 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 process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Embodiments of the present application also provide a computer readable storage medium storing a computer program that, when executed by a processor, may implement steps in a method for repairing a file as described above.
Embodiments of the present application provide a computer program product that, when run on a mobile terminal, causes the mobile terminal to perform the steps in the method for repairing a file as described above.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
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 solution. 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/terminal device and method may be implemented in other manners. For example, the apparatus/terminal device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical function division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown 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 may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated modules/units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present application may implement all or part of the flow of the method of the above embodiment, or may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each method embodiment described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a U disk, a removable hard disk, a magnetic disk, an optical disk, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, a software distribution medium, and so forth. It should be noted that the computer readable medium contains content that can be appropriately scaled according to the requirements of jurisdictions in which such content is subject to legislation and patent practice, such as in certain jurisdictions in which such content is subject to legislation and patent practice, the computer readable medium does not include electrical carrier signals and telecommunication signals.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; 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 scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application, and are intended to be included in the scope of the present application.

Claims (10)

1. A method for repairing a document, comprising:
obtaining a file to be repaired, wherein the file to be repaired is a damaged WAV file;
extracting audio data from the file to be repaired;
obtaining format information corresponding to the audio data, wherein the format information comprises one or more of coding format, channel number, sampling frequency, transmission rate, block alignment and sampling bit number;
and generating a repair file based on the audio data and the format information, wherein the repair file is a repaired WAV file.
2. The method for repairing a file according to claim 1, wherein said obtaining format information corresponding to said audio data comprises:
searching a first identifier from the file to be repaired;
extracting format information corresponding to the audio data of preset digital bytes after the first identifier.
3. The method for restoring files of claim 1, wherein when said format information includes said encoding format, said number of channels, said sampling frequency, said transmission rate, said block alignment, said number of sampling bits at the same time, said obtaining format information corresponding to said audio data further comprises:
acquiring a reference file, wherein the reference file is a WAV file recorded by the same equipment as the file to be repaired, and the reference file and the file to be repaired are different files;
extracting the coding format, the number of channels, the sampling frequency and the number of sampling bits in the reference file;
calculating the transmission rate based on the number of channels, the sampling frequency, and the number of sampling bits in the reference file;
the block alignment is calculated based on the number of channels in the reference file and the number of sampling bits.
4. The method for repairing a file according to claim 1, wherein said extracting audio data from the file to be repaired comprises:
searching a second identifier from the file to be repaired;
determining the length of the audio data from 4 bytes after the second identifier;
acquiring the length of the file to be repaired;
searching a third identifier from the file to be repaired;
determining the position of the List block according to 4 bytes after the third identifier;
determining the position of the audio data based on the length of the audio data, the length of the file to be repaired and the position of the List block;
the audio data is extracted based on a length of the audio data and a location of the audio data.
5. The method of repairing a file according to claim 1, wherein the generating a repair file based on the audio data and the format information includes:
acquiring an RIFF block, a face block and a List block;
and writing the RIFF block, the face block, the List block, the audio data and the format information into a newly created WAV file to obtain the repair file.
6. The method for repairing a file according to claim 5, wherein the obtaining a Fact block includes:
searching a fourth identifier from the file to be repaired;
and determining the length and the position of the Fact block according to 4 bytes after the fourth identifier.
7. The method for repairing a file according to claim 5, wherein said acquiring a RIFF block comprises:
searching a fifth identifier from the file to be repaired;
the length and location of the RIFF block are determined from 4 bytes after the fifth identifier.
8. A document repair device, comprising:
the first acquisition module is used for acquiring a file to be repaired, wherein the file to be repaired is a damaged WAV file;
the extraction module is used for extracting the audio data from the file to be repaired;
the second acquisition module is used for acquiring format information corresponding to the audio data, wherein the format information comprises one or more of coding format, channel number, sampling frequency, transmission rate, block alignment and sampling bit number;
and the generating module is used for generating a repair file based on the audio data and the format information, wherein the repair file is a repaired WAV file.
9. A terminal device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method of repairing a file according to any one of claims 1 to 7 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method for repairing a file according to any one of claims 1 to 7.
CN202311027598.9A 2023-08-14 2023-08-14 File repair method, device, terminal equipment and readable storage medium Pending CN117271448A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311027598.9A CN117271448A (en) 2023-08-14 2023-08-14 File repair method, device, terminal equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311027598.9A CN117271448A (en) 2023-08-14 2023-08-14 File repair method, device, terminal equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN117271448A true CN117271448A (en) 2023-12-22

Family

ID=89218620

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311027598.9A Pending CN117271448A (en) 2023-08-14 2023-08-14 File repair method, device, terminal equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN117271448A (en)

Similar Documents

Publication Publication Date Title
US6915012B2 (en) System and method of storing data in JPEG files
CN109657213B (en) Text similarity detection method and device and electronic equipment
US8626323B2 (en) Method and apparatus for playing audio files
US8422786B2 (en) Analyzing documents using stored templates
US20180158469A1 (en) Audio processing method and apparatus, and terminal
CN108174133A (en) A kind of trial video methods of exhibiting, device, electronic equipment and storage medium
CN113129150A (en) Transaction data processing method and device, terminal device and readable storage medium
CN110826461A (en) Video content identification method and device, electronic equipment and storage medium
CN110312161B (en) Video dubbing method and device and terminal equipment
US20050232498A1 (en) System and method of storing data in JPEG files
CN116991802A (en) File repair method, device, terminal equipment and readable storage medium
CN117271448A (en) File repair method, device, terminal equipment and readable storage medium
US20140052454A1 (en) Method for determining format of linear pulse-code modulation data
CN104778957A (en) Song audio processing method and device
CN104637496B (en) Computer system and audio comparison method
CN113569086B (en) Method, device, terminal equipment and readable storage medium for aggregating curved libraries
CN109450451A (en) A kind of seamless spliced compression processing method and device of wave shape playback
CN116778978A (en) File repair method, device, terminal equipment and readable storage medium
JP4527697B2 (en) Leaked personal information search system, leaked personal information search method, leaked personal information search device and program
CN117440116B (en) Video generation method, device, terminal equipment and readable storage medium
US11269951B2 (en) Indexing variable bit stream audio formats
Herley Accurate repeat finding and object skipping using fingerprints
CN104780438A (en) Method and device for splicing video and song audio
US10037148B2 (en) Facilitating reverse reading of sequentially stored, variable-length data
CN108648733B (en) Diqu generation method and system

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination