RSV file playback repair method, device and storage medium

By parsing and encapsulating the audio and video data in RSV files to generate playable MP4 files, it solves the problem that SLR professional cameras cannot play files stored under abnormal circumstances, and achieves effective recovery and playback of files.

CN117544738BActive Publication Date: 2024-09-24SHENZHEN MAIFENG TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311502380.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-10
Publication Date
2024-09-24
Estimated Expiration
2043-11-10

AI Technical Summary

Technical Problem

When SLR professional cameras encounter abnormal situations, the stored files cannot be correctly parsed and played, resulting in file damage or failure to open, causing trouble and losses to users.

Method used

By reading the RSV file, it determines whether there is a preset storage string, parses the offset address of the media file, extracts the audio and video files, and uses the preset encoding library to encapsulate and process it to generate a playable MP4 file. Specific steps include obtaining file-level header characters, filling processing, retrieving storage strings, parsing media file offset addresses, extracting H.264 video and AAC audio data, and using the FFmpeg encoding library to generate playable MP4 files.

Benefits of technology

It effectively solves the problem that files stored in SLR professional cameras cannot be played under abnormal circumstances. It can convert damaged RSV files into playable MP4 files, avoiding file damage and inability to open, and improving the feasibility of data recovery.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117544738B
    Figure CN117544738B
Patent Text Reader

Abstract

The present invention relates to the field of data repair, and discloses a playback repair method, device and storage medium for RSV files. The method comprises: reading the RSV file to be repaired; judging whether there is a preset storage string in the RSV file; if there is a preset storage string, parsing the storage string to obtain the media file offset address; based on the media file offset address, performing file extraction processing on the RSV file to obtain the audio and video files in the RSV file; extracting and parsing the audio and video files according to the preset storage MP4 sample data to obtain H.264 video data and AAC audio data; using the preset encoding library, encapsulating the H.264 video data and AAC audio data to generate a playable MP4 file. In the embodiment of the present invention, the technical problem that the storage files of the current SLR professional camera cannot be correctly parsed and played when encountering abnormal situations is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data repair, and in particular to a playback repair method, device and storage medium for RSV files. Background Art

[0002] As SLR professional cameras become more popular, they are increasingly used in conferences, interviews and other fields. These cameras have excellent image quality and flexibility, making them the preferred tool for shooting professional photos and videos. SLR professional cameras are also widely used in film and television production. They can shoot high-resolution videos and have good low-light performance and dynamic range, so that excellent image quality and detail can be obtained in various shooting environments. SLR professional cameras also play an important role in academic research and education. Scholars, scientists and educators can use these cameras for experimental recording, academic exhibitions, teaching demonstrations and scientific photography. Whether pursuing high-quality images or meeting creative needs, these cameras provide professional users with rich functions and expressiveness.

[0003] However, due to various unpredictable situations, such as accidentally breaking the camera, the files saved in the camera may not be played properly. When the camera suddenly loses power while saving a file, the file being written may be damaged. This may make the file unable to be correctly parsed and played, or even completely unable to be opened. Currently, users can only obtain RSV files by reading the SD card, but they cannot be played normally. These situations may cause certain troubles and losses to users. Therefore, when the current SLR professional cameras encounter abnormal situations, the stored files cannot be correctly parsed and played. A new technology is needed to solve this problem. Summary of the invention

[0004] The main purpose of the present invention is to solve the technical problem that the stored files of the current SLR professional camera cannot be correctly parsed and played when encountering abnormal situations.

[0005] A first aspect of the present invention provides a method for repairing the playback of an RSV file, the method comprising:

[0006] Read the RSV file to be repaired;

[0007] Determine whether the RSV file has a preset storage string;

[0008] If there is a preset storage string, the storage string is parsed to obtain the media file offset address;

[0009] Based on the media file offset address, the RSV file is subjected to file extraction processing to obtain the audio and video files in the RSV file;

[0010] Extract and parse the audio and video files according to the preset stored MP4 sample data to obtain H.264 video data and AAC audio data;

[0011] The H.264 video data and the AAC audio data are packaged using a preset encoding library to generate a playable MP4 file.

[0012] Optionally, in a first implementation of the first aspect of the present invention, the determining whether the RSV file has a preset storage string includes:

[0013] Obtain the header characters of all file layers in the RSV file and generate a header character set;

[0014] Performing padding processing on each head character of the head character set to generate a padding character set;

[0015] According to the preset query algorithm and the fill character set, the RSV file is subjected to field search processing to generate search results;

[0016] Based on the search result, determine whether the RSV file has a preset storage character string.

[0017] Optionally, in a second implementation of the first aspect of the present invention, obtaining header characters of all file layers in the RSV file and generating a header character set includes:

[0018] Get the 2-byte header characters of all file layers in the RSV file and generate a header character set.

[0019] Optionally, in a third implementation of the first aspect of the present invention, performing field search processing on the RSV file according to the preset query algorithm and the fill character set to generate search results includes:

[0020] Sorting and extracting target filling characters from the filling character set;

[0021] According to the target filling character, searching the 0xf020 field in the RSV file to generate a preliminary search result;

[0022] When the preliminary search result is that it exists, the 0x6B6B6164 field is searched in the RSV file according to the target filling character to generate a search result.

[0023] Optionally, in a fourth implementation manner of the first aspect of the present invention, parsing the stored character string to obtain the media file offset address includes:

[0024] The 0x6B6B6164 field is parsed to obtain the media file offset address.

[0025] Optionally, in a fifth implementation of the first aspect of the present invention, the extracting and parsing the audio and video file according to the preset stored MP4 sample data to obtain the H.264 video data and AAC audio data includes:

[0026] Parsing the bitstream data of the audio and video file based on the preset stored MP4 sample data;

[0027] Extracting NAL unit data of the bitstream data according to the preset identifier to obtain a sequence parameter set and a picture parameter set;

[0028] Writing the sequence parameter set and the image parameter set into a preset H.264 framework to generate H.264 video data;

[0029] The audio data of the audio and video file is extracted to generate AAC audio data.

[0030] Optionally, in a sixth implementation of the first aspect of the present invention, the using of a preset encoding library to encapsulate the H.264 video data and the AAC audio data to generate a playable MP4 file includes:

[0031] Use the preset FFmpeg encoding library to generate the MP4 file framework;

[0032] The H.264 video data and the AAC audio data are written into a preset MP4 file framework to generate a playable MP4 file.

[0033] Optionally, in a seventh implementation of the first aspect of the present invention, reading the RSV file to be repaired includes:

[0034] Read the RSV file in the preset storage device SD card.

[0035] A second aspect of the present invention provides a playback and repair device for RSV files, comprising: a memory and at least one processor, wherein instructions are stored in the memory, and the memory and the at least one processor are interconnected via a line; the at least one processor calls the instructions in the memory so that the playback and repair device for RSV files executes the above-mentioned playback and repair method for RSV files.

[0036] A third aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned RSV file playback and repair method.

[0037] In an embodiment of the present invention, by converting the data structure of the RSV file, the RSV file of the device is used to extract the entity audio and video data using the media file offset address, and based on the same device or the same device stored in other cloud or storage disk storage MP4 sample data, the entity audio and video data is parsed to separate the H.264 video data and AAC audio data. Finally, the encoding library is used to encapsulate the H.264 video data and AAC audio data to obtain a playable MP4 file, which solves the technical problem that the storage file cannot be correctly parsed and played when the current SLR professional camera encounters an abnormal situation. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] Figure 1 A schematic diagram of a first embodiment of a method for repairing playback of RSV files in an embodiment of the present invention;

[0039] Figure 2 A schematic diagram of a specific embodiment of step 102 of the method for repairing playback of RSV files in an embodiment of the present invention;

[0040] Figure 3 A schematic diagram of a specific embodiment of step 1023 of the method for repairing the playback of RSV files in an embodiment of the present invention;

[0041] Figure 4 A schematic diagram of a specific embodiment of step 105 of the method for repairing the playback of RSV files in an embodiment of the present invention;

[0042] Figure 5 A schematic diagram of an embodiment of a device for playing and repairing RSV files in an embodiment of the present invention. DETAILED DESCRIPTION

[0043] The embodiment of the present invention provides a playback and repair method, device and storage medium for RSV files.

[0044] The embodiments disclosed in the present invention will be described in more detail below with reference to the accompanying drawings. Although certain embodiments disclosed in the present invention are shown in the accompanying drawings, it should be understood that the present invention can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present invention. It should be understood that the drawings and embodiments disclosed in the present invention are only for exemplary purposes and are not intended to limit the scope of protection disclosed in the present invention.

[0045] In the description of the embodiments disclosed in the present invention, the term "including" and similar terms should be understood as open inclusion, that is, "including but not limited to". The term "based on" should be understood as "based at least in part on". The term "one embodiment" or "the embodiment" should be understood as "at least one embodiment". The terms "first", "second", etc. may refer to different or the same objects. Other explicit and implicit definitions may also be included below.

[0046] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 , an embodiment of the method for repairing the playback of RSV files in an embodiment of the present invention includes:

[0047] 101. Read the RSV file to be repaired;

[0048] In the present embodiment, the RSV file to be repaired is read, and the RSV file is used as the extension of the specific file format to indicate the content and structure of the file. When reading the file, the RSV file to be repaired can be transmitted using a cloud database or the Internet.

[0049] Specifically, step 101 also includes the following specific implementation methods:

[0050] 1011. Read the RSV file in the preset storage device SD card.

[0051] In this embodiment, the SD card of the SLR professional camera is directly used as the reading object, and the RSV suffix file is found therein.

[0052] 102. Determine whether the RSV file has a preset storage string;

[0053] In this embodiment, the length portion of the MXF (Material Exchange Format) KLV (Key-Length-Value) data is used to read the hexadecimal string of the RSV file, wherein MXF is a file exchange format for processing video, audio, and metadata, and KLV is a data encoding method based on key-value pairs. The read string is analyzed to see if it is a set storage string.

[0054] For further information, see Figure 2 , Figure 2 This is a schematic diagram of a specific embodiment of step 102 of the method for repairing the playback of RSV files in an embodiment of the present invention. Step 102 also includes the following specific implementation methods:

[0055] 1021. Obtain the header characters of all file layers in the RSV file and generate a header character set;

[0056] 1022. Perform padding processing on each head character of the head character set to generate a padding character set;

[0057] 1023. Perform field search processing on the RSV file according to a preset query algorithm and the fill character set to generate a search result;

[0058] 1024. Based on the search result, determine whether the RSV file has a preset storage string.

[0059] In steps 1021-1024, the header characters of all file layers in the RSV file are obtained, the header characters are filled with 8 bytes of data, and the 0xf020 field is searched. If the storage string such as the string 0x6B563833 of the specific structure is successfully queried, it is determined that the retrieval result is that the storage string exists. If the relevant storage string is not hit, the retrieval result is considered that the storage string does not exist.

[0060] Specifically, step 1021 also includes the following specific implementation methods:

[0061] 10211. Obtain the 2-byte header characters of all file layers in the RSV file and generate a header character set.

[0062] In step 10211, only the 2-byte header characters of all file layers in the RSV file are extracted to form a header character set.

[0063] For further information, see Figure 3 , Figure 3 This is a schematic diagram of a specific embodiment of step 1023 of the method for repairing the playback of RSV files in an embodiment of the present invention. Step 1023 also includes the following specific implementation methods:

[0064] 10231. Sort and extract target filling characters from the filling character set;

[0065] 10232. According to the target filling character, search for the 0xf020 field in the RSV file to generate a preliminary search result;

[0066] 10233. When the preliminary search result is existence, the 0x6B6B6164 field is searched in the RSV file according to the target filling character to generate a search result.

[0067] In steps 10231-10233, a fill character from the fill character set is first extracted as the target fill character, and the 0xf020 field is retrieved in the RVS file. After the search is successful, 0x6B6B6164 is searched. If it is not found in the RVS file, a fill character from the fill character set is re-extracted as the target fill character and the above query structure is repeated. If the 0x6B6B6164 field is found, it is considered that the storage string exists in the RSV file.

[0068] Further, in the specific embodiment of steps 10231-10233, step 103 includes the following specific implementation methods:

[0069] 1031. Parse the 0x6B6B6164 field to obtain the media file offset address.

[0070] In this embodiment, the string is stored in the 0x6B6B6164 field, and the 0x6B6B6164 field is parsed. The 0x6B6B6164 field stores the offset positions of the audio and video data.

[0071] 103. If there is a preset storage string, parse the storage string to obtain a media file offset address;

[0072] In this embodiment, the offset positions of the audio and video data are stored in the storage character string, and the storage character string is parsed to obtain the media file offset addresses of the offset positions of the audio and video data.

[0073] 104. Based on the media file offset address, perform file extraction processing on the RSV file to obtain the audio and video files in the RSV file;

[0074] In this embodiment, based on the media file offset address, the audio and video file data in the RSV file is extracted so as to separate the audio data and video data of the audio and video file in the next step.

[0075] 105. Extract and parse the audio and video files according to the preset stored MP4 sample data to obtain H.264 video data and AAC audio data;

[0076] In this embodiment, the stored MP4 sample data is MP4 data generated by the same encoding as the RSV file, and can be MP4 data generated by the same type of device or MP4 data generated by the same device.

[0077] Different processing processes are adopted for the audio data and video data of the audio and video file, and they are converted and packaged respectively to obtain H.264 video data and AAC audio data.

[0078] For further information, see Figure 4 , Figure 4 This is a schematic diagram of a specific embodiment of step 105 of the method for repairing the playback of RSV files in an embodiment of the present invention. Step 105 also includes the following specific implementation methods:

[0079] 1051. Parse the code stream data of the audio and video file based on the preset stored MP4 sample data;

[0080] 1052. Extract NAL unit data of the bitstream data according to the preset identifier to obtain a sequence parameter set and a picture parameter set;

[0081] 1053. Write the sequence parameter set and the image parameter set into a preset H.264 framework to generate H.264 video data;

[0082] 1054. Extract the audio data of the audio and video file to generate AAC audio data.

[0083] In steps 1051-1054, the MP4 sample data is loaded and stored, and the SPS (sequence parameter set) and PPS (picture parameter set) of the audio and video file are parsed based on the bitstream data of the MP4 sample data. In the bitstream data, the SPS and PPS are usually located in the NAL unit of the frame. The NAL (Network Abstraction Layer) unit is a coding unit in the H.264 / AVC format. In the NAL unit, the identifiers of the SPS and PPS are different. The identifier of the SPS is 0x67 (decimal 103), and the identifier of the PPS is 0x68 (decimal 104). According to the preset identifier, the NAL unit data of the bitstream data is extracted to obtain the sequence parameter set and the picture parameter set. Then, a new H.264 video frame is created, and the extracted SPS and PPS data are written to the beginning of the H.264 video frame. These data usually exist in the form of a byte sequence and can be directly written into a file to generate H.264 video data.

[0084] 106. Using a preset encoding library, encapsulate the H.264 video data and the AAC audio data to generate a playable MP4 file.

[0085] In this embodiment, encoding libraries such as FFmpeg, Libav, MediaCodec API (Android), and AVFoundation (iOS / macOS) can be used. Different encoding libraries are used for different platform systems and programming programs to encapsulate the H.264 video data and the AAC audio data to generate a playable MP4 file.

[0086] Furthermore, step 106 also includes the following implementation steps:

[0087] 1061. Generate MP4 file framework using the preset FFmpeg encoding library;

[0088] 1062. Write the H.264 video data and the AAC audio data into a preset MP4 file framework to generate a playable MP4 file.

[0089] In this example, install the FFmpeg encoding library tool and add it to the system path. Then, enter the directory containing the H.264 video and AAC audio files and use the following command:

[0090] ffmpeg-i video.h264-i audio.aac-c:v copy-c:a copy output.mp4

[0091] / / -i video.h264: specifies the input H.264 video file

[0092] / / -i audio.aac: specifies the input AAC audio file

[0093] / / -c:v copy: specifies the encoding mode of the video stream as copy, which means that the original data is copied directly without re-encoding.

[0094] / / output.mp4: specifies the output MP4 file name

[0095] After the command is executed, the FFmpeg encoding library encapsulates the H.264 video data and AAC audio data into an MP4 file to obtain a playable MP4 file.

[0096] In an embodiment of the present invention, by converting the data structure of the RSV file, the RSV file of the device is used to extract the entity audio and video data using the media file offset address, and based on the same device or the same device stored in other cloud or storage disk storage MP4 sample data, the entity audio and video data is parsed to separate the H.264 video data and AAC audio data. Finally, the encoding library is used to encapsulate the H.264 video data and AAC audio data to obtain a playable MP4 file, which solves the technical problem that the storage file cannot be correctly parsed and played when the current SLR professional camera encounters an abnormal situation.

[0097] Figure 51 is a schematic diagram of the structure of a playback and repair device for RSV files provided in an embodiment of the present invention. The playback and repair device 500 for RSV files may have relatively large differences due to different configurations or performances, and may include one or more processors (central processing units, CPU) 510 (for example, one or more processors) and a memory 520, and one or more storage media 530 (for example, one or more mass storage devices) storing application programs 533 or data 532. Among them, the memory 520 and the storage medium 530 may be short-term storage or permanent storage. The program stored in the storage medium 530 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the playback and repair device 500 for RSV files. Furthermore, the processor 510 may be configured to communicate with the storage medium 530 to execute a series of instruction operations in the storage medium 530 on the playback and repair device 500 for RSV files.

[0098] The RSV file-based playback and repair device 500 may further include one or more power supplies 540, one or more wired or wireless network interfaces 550, one or more input and output interfaces 560, and / or one or more operating systems 531, such as Windows Server, Mac OS X, Unix, Linux, Free BSD, etc. It will be appreciated by those skilled in the art that Figure 5 The structure of the RSV file playback and repair device shown does not constitute a limitation on the RSV file-based playback and repair device, and may include more or fewer components than shown in the figure, or a combination of certain components, or a different arrangement of components.

[0099] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the RSV file playback repair method.

[0100] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of machine-readable storage media would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), optical fibers, a portable compact disk read-only memory, or a computer programmable read-only memory. Optical storage devices, magnetic storage devices, or any suitable combination of the above.

[0101] In addition, although each operation is described in a specific order, this should be understood as requiring such operation to be performed in the specific order shown or in a sequential order, or requiring that all illustrated operations should be performed to obtain desired results. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single implementation in combination. On the contrary, the various features described in the context of a single implementation can also be implemented in multiple implementations individually or in any suitable sub-combination mode.

[0102] Although the subject matter has been described in language specific to structural features and / or methodological logical actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims.

Claims

1. A playback repair method for RSV files, characterized in that: Includes steps: Read the RSV file to be repaired; Determine whether the RSV file has a preset storage string; If there is a preset storage string, the storage string is parsed to obtain the media file offset address; Based on the media file offset address, the RSV file is subjected to file extraction processing to obtain the audio and video files in the RSV file; According to the preset stored MP4 sample data, the audio and video files are extracted and analyzed to obtain H.264 video data and AAC audio data; Using a preset encoding library, encapsulating the H.264 video data and the AAC audio data to generate a playable MP4 file; Wherein, the determining whether the RSV file has a preset storage string comprises: Obtain the header characters of all file layers in the RSV file and generate a header character set; Performing padding processing on each head character of the head character set to generate a padding character set; According to the preset query algorithm and the fill character set, the RSV file is subjected to field search processing to generate search results; Based on the search result, determining whether the RSV file has a preset storage character string; Wherein, the RSV file is subjected to field search processing according to the preset query algorithm and the fill character set to generate search results, including: Sorting and extracting target filling characters from the filling character set; According to the target filling character, the 0xf020 field is searched in the RSV file to generate a preliminary search result; When the preliminary search result is that it exists, the 0x6B6B6164 field is searched in the RSV file according to the target filling character to generate a search result.

2. The playback repair method of RSV file according to claim 1, characterized in that, The obtaining of the header characters of all file layers in the RSV file and generating the header character set comprises: Get the 2-byte header characters of all file layers in the RSV file and generate a header character set.

3. The playback repair method of RSV file according to claim 1, characterized in that, The parsing of the stored character string to obtain the media file offset address includes: The 0x6B6B6164 field is parsed to obtain the media file offset address.

4. The playback repair method of RSV file according to claim 1, characterized in that: The extracting and parsing of the audio and video files according to the preset stored MP4 sample data to obtain H.264 video data and AAC audio data includes: Parsing the bitstream data of the audio and video file based on the preset stored MP4 sample data; Extracting NAL unit data of the bitstream data according to the preset identifier to obtain a sequence parameter set and a picture parameter set; Writing the sequence parameter set and the image parameter set into a preset H.264 framework to generate H.264 video data; The audio data of the audio and video file is extracted to generate AAC audio data.

5. The playback repair method of RSV file according to claim 1, characterized in that: The method of utilizing the preset encoding library to encapsulate the H.264 video data and the AAC audio data to generate a playable MP4 file includes: Use the preset FFmpeg encoding library to generate the MP4 file framework; The H.264 video data and the AAC audio data are written into a preset MP4 file framework to generate a playable MP4 file.

6. The playback repair method of RSV file according to claim 1, characterized in that: The reading of the RSV file to be repaired comprises: Read the RSV file in the preset storage device SD card.

7. A playback and repair device for RSV files, characterized in that: The RSV file playback and repair device comprises: a memory and at least one processor, the memory stores instructions, and the memory and the at least one processor are interconnected via a line; The at least one processor calls the instructions in the memory so that the playback and repair device of the RSV file executes the playback and repair method of the RSV file as described in any one of claims 1-6.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the playback and repair method of the RSV file as described in any one of claims 1-6 is implemented.