Unmanned aerial vehicle video file repairing method and device, electronic equipment and medium
By analyzing the structural characteristics and encoding format of the drone video file, positioning and repairing damaged video files, the problem of corruption of drone video files is solved, and a general and automated repair method is realized, suitable for multiple encoding formats and recording parameters. .
Patent Information
- Application Number
- CN202410990469.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-12
AI Technical Summary
There is a lack of a general and effective repair method during the recording of drone video files due to battery exhaustion, memory card failure, collision or extreme environments.
By obtaining the video file, judging its structural characteristics, positioning the starting position of the video to be repaired, and decoding the frame video data using preset codec and parameter configuration information, loop processing to repair the video file, supporting H.264 and H .265 encoding format, adapted to various recording parameters, and realize sample-free repair.
It provides a general drone video file repair method, covering most product models, supports H.264 and H.265 encoding formats, reduces user operation costs, avoids sample file dependence and repair failures, and realizes automated repair.
Smart Images

Figure CN118945419A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of video repair technology, and relates to a method for repairing drone video files, and in particular to a method, device, electronic equipment and medium for repairing drone video files. Background Art
[0002] In recent years, with the continuous development and progress of sensor technology, battery technology, flight control systems, communication technologies, coupled with the increasingly huge market demand and continuously improving policy support, drones have been widely used in many fields such as consumer, commercial and public safety.
[0003] In some application scenarios, drones are widely used in aerial photography, photography and video production. However, during the video recording process, some unexpected situations may occur, such as battery exhaustion, memory card failure, collision during flight, extreme temperature environment or software program crash, which may cause the recorded video files to be damaged. Therefore, how to repair these video files has become one of the technical problems that relevant technicians need to solve urgently. Summary of the invention
[0004] The purpose of this application is to provide a method, device, electronic device and medium for repairing drone video files, so as to solve the problem of repairing drone video files.
[0005] In a first aspect, the present application provides a method for repairing a drone video file, the method comprising: obtaining a video file; judging the structural features of the video file to obtain a judgment result; obtaining the starting position of the video to be repaired of the video file according to the judgment result; decoding the frame video data at the starting position according to a preset codec and preset parameter configuration information to obtain parameter configuration information corresponding to the video to be repaired; and looping each frame of video data starting from the starting position according to the parameter configuration information to obtain a repaired video file.
[0006] In an implementation of the first aspect, judging the structural features of the video file includes: reading a file header of the video file; judging whether the file header conforms to a file header identifier; the file header identifier includes an ftypbox and an isom box; if the file header does not conform to any one of the ftyp box and the isom box, judging that the structural features of the video file are damaged; if the file header conforms to any one of the ftyp box and the isom box, checking whether the video file includes a media data box; if the video file does not include a media data box, judging that the structural features of the video file are damaged; if the video file includes a media data box, judging that the structural features of the video file are not damaged.
[0007] In an implementation of the first aspect, checking whether the video file includes a media data box comprises: if the file header is any one of the ftyp box and the isom box, shifting the position of the video file backward according to the size of the ftyp box or the isombox to obtain a first parsing address; parsing whether the video file contains a free box or a wide box according to the first parsing address, and if so, shifting the position of the video file backward according to the size of the free box or the widebox to obtain a second parsing address; both the free box and the widebox do not contain actual media data boxes; and parsing whether the video file contains a media data box according to the second parsing address.
[0008] In an implementation of the first aspect, obtaining the starting position of the video to be repaired of the video file according to the judgment result includes: if the judgment result is that the storage structure of the video file is damaged, performing byte-by-byte analysis and matching on the video file according to a preset parameter set to obtain a matching position; the preset parameter set includes a video sequence parameter set and H.264 / H.265 encoded data; and using the matching position as the starting position of the video to be repaired.
[0009] In an implementation of the first aspect, obtaining the starting position of the video to be repaired of the video file according to the judgment result includes: if the judgment result is that the storage structure of the video file is not damaged, parsing the preview image in the media data box to obtain the starting feature and the ending feature of the preview image; filtering the preview image according to the starting feature and the ending feature, and taking the position of the next frame of video of the ending feature of the preview image as the starting position of the video to be repaired.
[0010] In an implementation of the first aspect, the frame video data at the starting position is decoded according to a preset codec and a preset parameter configuration information list, including: initializing the preset codec according to a set of parameter configuration information in the preset parameter configuration information list to obtain a valid codec; the preset parameter configuration information includes a parameter set corresponding to a video frame rate, an encoding format, and a resolution; decoding the frame video data at the starting position using the valid codec; if decoding is successful, using the parameter configuration information in the preset parameter configuration information list as the parameter configuration information corresponding to the video to be repaired; if decoding fails, replacing the next set of parameter configuration information in the preset parameter configuration information list to initialize the preset codec until decoding is successful.
[0011] In an implementation of the first aspect, looping and processing frame video data from the starting position includes: looping and parsing each damaged video frame data from the starting position to obtain corresponding video frame data; writing parameter configuration information and the video frame data into a repair file to obtain a repaired video file.
[0012] In a second aspect, the present application provides a drone video file repair device, which includes: an acquisition module for acquiring a video file; a judgment module for judging the structural characteristics of the video file to obtain a judgment result; a starting position determination module for obtaining the starting position of the video to be repaired of the video file according to the judgment result; a parameter configuration information determination module for decoding the frame video data at the starting position according to a preset codec and preset parameter configuration information to obtain parameter configuration information corresponding to the video to be repaired; a repair module for cyclically processing each frame of video data starting from the starting position according to the parameter configuration information to obtain a repaired video file.
[0013] In a third aspect, the present application provides an electronic device, comprising: a memory storing a computer program; and a processor communicatively connected to the memory, for executing the above-mentioned drone video file repair method when calling the computer program.
[0014] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, characterized in that when the program is executed by an electronic device, the above-mentioned drone video file repair method is implemented.
[0015] As described above, the drone video file repair method, device, medium and electronic device described in this application have the following features:
[0016] Beneficial effects:
[0017] 1. The drone video file repair method provided in this application is universal. It determines the degree of damage by analyzing and checking the structural features of the damaged video file. If the structural features of the damaged video file are destroyed, it is analyzed byte by byte until a valid video sequence parameter set or H.264 / H.265 encoding data is matched to locate the starting position of the video to be repaired in the damaged video file. If the structural features of the damaged video file are not destroyed, the boxes that do not contain actual media data are analyzed and filtered out in turn until the starting position of the video to be repaired in the damaged video file is located. The repair method provided in this application can cover most product models, such as DJI drone series models, and supports both H.264 and H.265 encoding formats, and is adaptable to various recording parameters.
[0018] 2. The drone video file repair method provided in this application supports sample-free repair. Unlike conventional repair methods, this application uses an open source video codec, initializes the open source video codec using a video parameter set, and uses the initialized video codec to decode the video to be repaired, so as to find the correct video parameter configuration information. It does not rely on sample files, reduces the burden on users to find homologous samples, and eliminates the possibility of repair failure due to sample video mismatch.
[0019] 3. The video file repair method provided by this application is automated. This application initializes the open source video codec by using a video parameter set. The initialized video codec can accurately determine the encoding format, video frame rate and resolution corresponding to the damaged file. Users do not need to try different parameters and screen the correct results by themselves, thereby reducing user operating costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 Shown is a flow chart of the drone video file repair method described in an embodiment of the present application.
[0021] Figure 2 Shown is a schematic diagram of a flow chart for determining the structural features of the video file as described in an embodiment of the present application.
[0022] Figure 3 Shown is a schematic diagram of a process of checking whether a video file includes a media data box according to an embodiment of the present application.
[0023] Figure 4 Shown is a schematic diagram of a process for obtaining the starting position of a video to be repaired in a video file as described in an embodiment of the present application.
[0024] Figure 5 Shown is a schematic diagram of a process of obtaining the starting position of a video file to be repaired as described in another embodiment of the present application.
[0025] Figure 6 Shown is a schematic diagram of a process of decoding frame video data at a starting position according to an embodiment of the present application.
[0026] Figure 7 Shown is a schematic diagram of a process of cyclically processing frame video data starting from a starting position as described in an embodiment of the present application.
[0027] Fig. 8A Shown is a schematic diagram of the video effect of repairing the erroneous recording parameter configuration information described in an embodiment of the present application.
[0028] Figure 8B Shown is a schematic diagram of the video effect of repairing the correct recording parameter configuration information described in an embodiment of the present application.
[0029] Fig. 9 Shown is a flowchart of a method for repairing a drone video file according to another embodiment of the present application.
[0030] Fig.10 Shown is a schematic diagram of the structure of the drone video file repair device described in an embodiment of the present application.
[0031] Fig.11 Shown is a schematic diagram of the structure of an electronic device described in an embodiment of the present application.
[0032] Component number description
[0033] 10. Drone video file repair device
[0034] 110 Get Module
[0035] 120 Judgment module
[0036] 130 Starting position determination module
[0037] 140 Parameter configuration information determination module
[0038] 150 Repair Module
[0039] 20 Electronic devices
[0040] 210 Memory
[0041] 220 processors
[0042] Steps S1 to Sn DETAILED DESCRIPTION
[0043] The following describes the embodiments of the present application through specific examples, and those skilled in the art can easily understand other advantages and effects of the present application from the contents disclosed in this specification. The present application can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present application. It should be noted that the following embodiments and features in the embodiments can be combined with each other without conflict.
[0044] It should be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present application, and thus the drawings only show components related to the present application rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed at will, and the component layout may also be more complicated.
[0045] The following embodiments of the present application provide a method, device, medium and electronic device for repairing drone video files, which solve the problem of repairing drone video files without samples.
[0046] The embodiment of this application takes DJI drones as an example. DJI drones, with their excellent performance, continuous innovation and diverse functions, have gradually occupied a dominant position in the global drone market and have a significant market share. In the consumer market, DJI drones are widely used in aerial photography, photography and video production. However, during the video recording process, some unexpected situations may occur, such as battery exhaustion, memory card failure, collision during flight, extreme temperature environment or software program crash, which may cause the recorded video file to be damaged. Therefore, a general technology is needed to repair DJI drone videos.
[0047] DJI has many drone series and models. For different application scenarios, each series and model can provide different recording parameters and encoding formats. This means that drone videos of different series and models may need to be repaired in different ways. Currently, there is no universal software tool on the market that can repair drone videos of various models and configurations. This brings great inconvenience to enthusiasts and users who do not have professional knowledge and skills.
[0048] The following embodiments of this application provide a method, device, medium and electronic device for repairing drone video files. The drone video file repair method provided by this application is universal. DJI drone series and models are very numerous. The repair method provided by this application can cover most product models, support H.264 and H.265 encoding formats, and adapt to various recording parameters. It also supports sample-free repair. Unlike conventional repair methods, this application uses open source video codecs to achieve independence from sample files, reducing the burden on users to find homologous samples and eliminating the possibility of repair failure due to sample video mismatch.
[0049] The technical solutions in the embodiments of the present application will be described in detail below in conjunction with the drawings in the embodiments of the present application.
[0050] like Figure 1 As shown, this embodiment provides a method for repairing a drone video file, and the method for repairing a drone video file includes the following steps:
[0051] Step S1, obtaining a video file;
[0052] Step S2, judging the structural features of the video file to obtain a judgment result;
[0053] Step S3, obtaining the starting position of the video to be repaired of the video file according to the judgment result;
[0054] Step S4, decoding the frame video data at the starting position according to a preset codec and preset parameter configuration information to obtain parameter configuration information corresponding to the video to be repaired;
[0055] Step S5: According to the parameter configuration information, each frame of video data is cyclically processed starting from the starting position to obtain a repaired video file.
[0056] It should be noted that the above reference numerals S1 to S5 are only used to identify different steps, but not to limit the execution order of these steps.
[0057] Next, in conjunction with the attached examples of this application Figures 2 to 9 The drone video file repair method described in the embodiment of the present application is introduced in detail.
[0058] Step S1, obtaining a video file;
[0059] In some embodiments, the video file is a video recorded by a drone, and this application takes a DJI drone as an example. For example, a DJI drone fails during video recording, causing the recorded video to be unable to be played. At this time, the video file needs to be repaired so that it can be successfully played.
[0060] In some embodiments, the video file is a video file in MP4 and MOV formats.
[0061] Step S2, judging the structural features of the video file to obtain a judgment result;
[0062] Specifically, the video file (such as MP4 and MOV) itself has a specific structure, so it is necessary to determine whether the structural characteristics of the video file are normal.
[0063] Figure 2 The flowchart of judging the structural features of the video file in the embodiment of the present application is shown. Figure 2 As shown, judging the structural features of the video file includes the following steps S21 to S26.
[0064] Step S21, reading the file header of the video file.
[0065] Specifically, the file header is read and analyzed to determine whether the video file starts with an ftyp box or an isom box.
[0066] Step S22, judging whether the file header conforms to the file header identifier; the file header identifier includes the ftyp box and the isom box.
[0067] The ftyp box is used to identify the type and version of the file and is usually located at the beginning of the file. This container contains the brand and version information of the file, as well as a compatibility list that identifies other formats that the file is compatible with.
[0068] Step S23: If the file header does not conform to any one of the ftyp box and the isom box, it is determined that the structural feature of the video file is damaged.
[0069] Step S24: If the file header conforms to any one of the ftyp box and the isom box, check whether the video file includes a media data box.
[0070] Specifically, the media data box is an mdat box.
[0071] The mdat box is a container box in the MP4 file format, which is used to store actual media data, such as video and audio data.
[0072] Step S25: If the video file does not include a media data box, it is determined that the structural feature of the video file is damaged.
[0073] Step S26: If the video file includes a media data box, the judgment result is that the structural feature of the video file is not damaged.
[0074] Figure 3 The flowchart of checking whether the video file includes a media data box in the embodiment of the present application is shown. Figure 3 As shown, checking whether the video file includes a media data box includes the following steps:
[0075] Step S241: If the file header is any one of the ftyp box and the isom box, the position of the video file is shifted backward according to the size of the ftyp box or the isom box to obtain a first parsed address.
[0076] In one embodiment, the file header is read and analyzed, and if the file header is any one of the ftyp box and the isom box, the size of the ftyp box or the isom box is obtained.
[0077] Step S242: parse the video file to determine whether there is a free box or a wide box according to the first parsed address; if so, shift the position of the video file backward according to the size of the free box or the wide box to obtain a second parsed address; both the free box and the wide box are boxes that do not contain actual media data.
[0078] In one embodiment, the free box and the wide box are placeholders that do not contain actual media data. The free box is used to facilitate subsequent editing and adding content, and the wide box can be used to align content to improve reading efficiency. Because neither the free box nor the wide box contains actual media data, they are directly filtered during the file repair process.
[0079] Step S243: parse the video file according to the second parsing address to determine whether there is a media data box.
[0080] Figure 4 The flowchart of the embodiment of the present application is shown as follows: obtaining the starting position of the video to be repaired of the video file according to the judgment result. Figure 4 As shown, obtaining the starting position of the video to be repaired of the video file according to the judgment result includes the following steps:
[0081] Step S31A: if the judgment result is that the storage structure of the video file is damaged, the video file is analyzed and matched byte by byte according to a preset parameter set to obtain a matching position;
[0082] The preset parameter set includes a video sequence parameter set and H.264 / H.265 encoding data; the video sequence parameter set is a piece of binary data that encodes information such as video resolution, video frame rate, and encoding format.
[0083] In one embodiment, the structural features of the video file are destroyed, and the file is shifted backward byte by byte and analyzed until a valid video sequence parameter set or H.264 / H.265 encoded data is matched.
[0084] Step S32A: taking the matching position as the starting position of the video to be repaired.
[0085] Figure 5 The flowchart of the embodiment of the present application is shown as follows: obtaining the starting position of the video to be repaired of the video file according to the judgment result. Figure 5 As shown, obtaining the starting position of the video to be repaired of the video file according to the judgment result includes the following steps:
[0086] Step S31B: if the judgment result is that the storage structure of the video file is not damaged, parse the preview image in the media data box to obtain the start feature and the end feature of the preview image;
[0087] In one embodiment, the structural features of the video file are not destroyed. First, the box files that do not contain actual media data in the video file are filtered out, and the mdat box storing the actual media data is found. A picture is added to the beginning of the video stored in the mdat box as a preview picture. When repairing the video, the preview picture is generally not repaired, so it is necessary to find the preview picture and skip it.
[0088] Step S32B, filtering the preview image according to the start feature and the end feature, and taking the position of the next frame of video of the end feature of the preview image as the start position of the video to be repaired.
[0089] Figure 6 The flowchart of decoding the frame video data at the starting position according to the preset codec and the preset parameter configuration information list in the embodiment of the present application is shown. Figure 6 As shown, decoding the frame video data at the starting position according to the preset codec and the preset parameter configuration information list includes the following steps:
[0090] Step S41, initializing the preset codec according to a set of parameter configuration information in the preset parameter configuration information list to obtain a valid codec; the preset parameter configuration information includes a parameter set corresponding to a video frame rate, encoding format and resolution; the preset codec is an open source video codec.
[0091] Step S42: Decode the frame video data at the starting position using the effective codec.
[0092] Step S43: If the decoding is successful, the parameter configuration information in the preset parameter configuration information list is used as the parameter configuration information corresponding to the video to be repaired.
[0093] Step S44: If the decoding fails, replace the next set of parameter configuration information in the preset parameter configuration information list to initialize the preset codec until the decoding succeeds.
[0094] In one embodiment, after locating the starting position of the video data, before extracting the video frame data and writing it into the repair file, we must first determine the parameter set required for correct decoding and playback of the video. Since there is no sample file as a reference, we use an open source video codec and initialize the codec with a parameter set corresponding to a common video frame rate, encoding format, and resolution. Then, we use the codec to try to decode the first few frames of video data. If the decoding is successful, the video parameter configuration corresponding to the damaged file is found.
[0095] Figure 7 The flowchart of the embodiment of the present application is shown as a process of cyclically processing frame video data starting from the starting position. Figure 7 As shown, starting from the starting position, cyclically processing the frame video data includes the following steps:
[0096] Step S51, cyclically parsing each damaged video frame data from the starting position to obtain corresponding video frame data;
[0097] Step S52: Write the parameter configuration information and the video frame data into a repair file to obtain a repaired video file.
[0098] In one embodiment, according to the determined parameter configuration information and the starting position of the video data, each frame of video data is processed cyclically and written into a new file, and the specific implementation steps are steps S61 to S63.
[0099] Step S61: Write a 4-byte start code.
[0100] Step S62: Write the video sequence / image parameter set information obtained by the analysis in step 6.
[0101] Step S63, write a 4-byte start code, read 4 bytes of data from the located damaged video frame data position, parse the video frame data size, copy the frame data to the repair file, offset the damaged video file position backward by the frame data size, and repeat step S63 until the damaged video file analysis is completed.
[0102] In one embodiment, taking a damaged video exported by a DJI mini 2 drone as an example, repairing the damaged video exported by a DJI mini 2 drone includes the following steps:
[0103] Step S71, finding the starting position of the damaged video data according to the structural characteristics of the damaged video.
[0104] Step S72, read 4 bytes of data from the starting position of the video data, parse the frame data size, and continuously extract the first 5 frames of data.
[0105] Step S73: According to the binary coded data corresponding to the recording parameters (coding format, resolution, frame rate, etc.) and the 5 frames of data read in the above steps, use the libx264 decoder to perform decoding analysis, and keep trying different recording parameters until the correct parameter information is analyzed.
[0106] Step S74: loop through the frame data in the damaged file according to the parameter information analyzed in step S73 to encapsulate a new repaired file.
[0107] Fig. 8A The display is a schematic diagram of the video effect of repairing the wrong recording parameters according to the embodiment of the present application. Fig. 8A As shown, the recording parameters (encoding format, resolution, frame rate, etc.) are encoding: H264, resolution: 2160*4096, frame rate: 30fps, and the repaired video screenshot effect is as follows Fig. 8A As shown in the figure, the video image is not displayed normally, and the wrong recording parameter information will cause the repaired file to have a distorted screen.
[0108] Figure 8B The display is a schematic diagram of the video effect of correct recording parameters repairing according to the embodiment of the present application. Figure 8B As shown, the recording parameters (encoding format, resolution, frame rate, etc.) are encoding: H264, resolution: 2160*3840, frame rate: 24fps, and the repaired video screenshot effect is as follows Figure 8B As shown, the video image is displayed normally, and the video file repaired with the correct recording parameter information can play the video normally.
[0109] Fig. 9 Shown is a flow chart of a method for repairing drone video files in another embodiment of the present application. Fig. 9 As shown, the drone video file repair method includes the following steps:
[0110] Step S81, load the file, read and analyze the file header, determine whether it starts with ftyp or isom box, if so, execute step S82, otherwise execute step S85;
[0111] Step S82, shift the file position backward according to the size of the fytp or isom parsed in step S81, check whether there is a free or wide box and continue to shift backward according to its size;
[0112] Step S83, check and determine whether the next is an mdat box, if so, execute step S84, otherwise execute step S85;
[0113] Step S84, determine whether mdat contains a preview image in jpeg format, if so, locate and filter it according to the start and end features of the jpeg format, and execute step S86;
[0114] Step S85: The structural features of the video file are destroyed, and the backward shift and analysis start byte by byte until a valid video sequence parameter set or H.264 / H.265 encoding data is matched;
[0115] Step S86: So far, the starting position of the video data has been located. Before extracting the video frame data and writing it into the repair file, the parameter set required for correct decoding and playback of the video must be determined first. Since there is no sample file as a reference, the present application uses a preset codec (such as an open source video codec) to initialize the codec with a parameter set corresponding to a common video frame rate, encoding format, and resolution. The codec is then used to try to decode the first few frames of video data. If the decoding is successful, the video parameter configuration corresponding to the damaged file is found.
[0116] Step S87, according to the parameter configuration information determined in the above steps and the starting position of the video data, loop through each frame of video data and write it into a new file to complete the repair.
[0117] In one embodiment, repairing video damage caused by flight collision of a DJI Inspire 2 series drone includes the following steps 91 to 97.
[0118] Step 91: Read the damaged file header and find that the file starts with an ftyp box.
[0119] Step 92: offset the file position according to the size of the ftyp box.
[0120] Step 93, find the wide box and continue to offset it according to its size.
[0121] Step 94: Find the mdat box containing the jpeg preview image, locate and filter the jpeg image data.
[0122] Step 95: Find the starting position of the video data.
[0123] Step 96: With the help of libx264 codec, it is found that the damaged file is in H.264 encoding format, with a frame rate of 60fps and a resolution of 1920*1080.
[0124] Step 97: cyclically process the frame data in the damaged file according to the above information to encapsulate a new repaired file.
[0125] This application determines the degree of damage by analyzing and checking the structural features of the damaged video file. If the structural features of the damaged video file are destroyed, it analyzes byte by byte until it matches a valid video sequence parameter set or H.264 / H.265 encoding data to locate the starting position of the video to be repaired in the damaged video file. If the structural features of the damaged video file are not destroyed, it analyzes and filters out the boxes that do not contain media data in turn until the starting position of the video to be repaired in the damaged video file is located. The repair method provided in this application can cover most product models, such as DJI drone series models, and supports both H.264 and H.265 encoding formats, and is adaptable to various recording parameters.
[0126] The protection scope of the drone video file repair method described in the embodiment of the present application is not limited to the execution order of the steps listed in this embodiment. All solutions implemented by adding, reducing or replacing steps in the prior art based on the principles of the present application are included in the protection scope of the present application.
[0127] An embodiment of the present application also provides a drone video file repair device, which can implement the drone video file repair method described in the present application. However, the implementation device of the drone video file repair method described in the present application includes but is not limited to the structure of the drone video file repair device listed in this embodiment. All structural deformations and replacements of the prior art made according to the principles of the present application are included in the protection scope of the present application.
[0128] like Fig.10 As shown, this embodiment provides a drone video file repair device, and the drone video file repair device 10 includes an acquisition module 110, a judgment module 120, a starting position determination module 130, a parameter configuration information determination module 140 and a repair module 150.
[0129] The acquisition module 110 is used to acquire video files;
[0130] The judging module 120 is used to judge the structural features of the video file to obtain a judgment result;
[0131] The starting position determination module 130 is used to obtain the starting position of the video to be repaired of the video file according to the judgment result;
[0132] The parameter configuration information determination module 140 is used to decode the frame video data at the starting position according to the preset codec and the preset parameter configuration information to obtain the parameter configuration information corresponding to the video to be repaired;
[0133] The repair module 150 is used to cyclically process each frame of video data starting from the starting position according to the parameter configuration information to obtain a repaired video file.
[0134] It should be noted that the functions or operations of the acquisition module 110, the judgment module 120, the starting position determination module 130, the parameter configuration information determination module 140 and the repair module 150 described in the embodiment of the present application correspond one by one to the steps in the above-mentioned drone video file repair method, so they will not be repeated here.
[0135] In the several embodiments provided in the present application, it should be understood that the disclosed system, device or method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of modules / units is only a logical function division. There may be other division methods in actual implementation, such as multiple modules or units can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or modules or units, which can be electrical, mechanical or other forms.
[0136] The modules / units described as separate components may or may not be physically separated, and the components displayed as modules / units may or may not be physical modules, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules / units may be selected according to actual needs to achieve the purpose of the embodiments of the present application. For example, the functional modules / units in the various embodiments of the present application may be integrated into one processing module, or each module / unit may exist physically separately, or two or more modules / units may be integrated into one module / unit.
[0137] Those of ordinary skill in the art should further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in the above description according to function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0138] like Fig.11 As shown, this embodiment provides an electronic device, and the electronic device 20 includes: a memory 210 and a processor 220.
[0139] The memory 210 stores a computer program;
[0140] The processor 220 is in communication with the memory 210 and executes the above-mentioned drone video file repair method when calling the computer program.
[0141] The present application embodiment also provides a computer-readable storage medium. A person of ordinary skill in the art can understand that all or part of the steps in the method for implementing the above embodiment can be completed by a program to instruct the processor, and the program can be stored in a computer-readable storage medium, and the storage medium is a non-transitory medium, such as a random access memory, a read-only memory, a flash memory, a hard disk, a solid-state hard disk, a magnetic tape, a floppy disk, an optical disc, and any combination thereof. The above storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a digital video disc (DVD)), or a semiconductor medium (e.g., a solid-state hard disk (SSD)), etc.
[0142] The present application embodiment may also provide a computer program product, the computer program product including one or more computer instructions. When the computer instructions are loaded and executed on a computing device, the process or function described in the embodiment of the present application is generated in whole or in part. The computer instructions may be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from a website site, computer or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer or data center.
[0143] When the computer program product is executed by a computer, the computer executes the method described in the above method embodiment. The computer program product may be a software installation package, and when the above method is required, the computer program product may be downloaded and executed on a computer.
[0144] In summary, the drone video file repair method, device, electronic device and medium described in the embodiments of the present application have the following beneficial effects:
[0145] 1. The drone video file repair method provided in this application is universal. It determines the degree of damage by analyzing and checking the structural features of the damaged video file. If the structural features of the damaged video file are destroyed, it is analyzed byte by byte until a valid video sequence parameter set or H.264 / H.265 encoding data is matched to locate the starting position of the video to be repaired in the damaged video file. If the structural features of the damaged video file are not destroyed, the boxes that do not contain media data are analyzed and filtered out in turn until the starting position of the video to be repaired in the damaged video file is located. The repair method provided in this application can cover most product models, such as DJI drone series models, and supports both H.264 and H.265 encoding formats, and is adaptable to various recording parameters.
[0146] 2. The drone video file repair method provided in this application supports sample-free repair. Unlike conventional repair methods, this application uses an open source video codec, initializes the open source video codec using a video parameter set, and uses the initialized video codec to decode the video to be repaired, so as to find the correct video parameter configuration information. It does not rely on sample files, reduces the burden on users to find homologous samples, and eliminates the possibility of repair failure due to sample video mismatch.
[0147] 3. The drone video file repair method provided in this application is automated. This application initializes the open source video codec by using a video parameter set. The initialized video codec can accurately determine the encoding format, video frame rate and resolution corresponding to the damaged file. Users do not need to try different parameters and screen the correct results by themselves, thereby reducing user operating costs.
[0148] The descriptions of the processes or structures corresponding to the above-mentioned figures have different emphases. For parts that are not described in detail in a certain process or structure, please refer to the relevant descriptions of other processes or structures.
[0149] The above embodiments are merely illustrative of the principles and effects of the present application and are not intended to limit the present application. Anyone familiar with the technology may modify or change the above embodiments without violating the spirit and scope of the present application. Therefore, all equivalent modifications or changes made by a person of ordinary skill in the art without departing from the spirit and technical ideas disclosed in the present application shall still be covered by the claims of the present application.
Claims
1. A method for repairing drone video files, characterized in that: The repair method comprises: Get the video file; Determine the structural features of the video file to obtain a determination result; Obtaining the starting position of the video to be repaired of the video file according to the judgment result; Decoding the frame video data at the starting position according to a preset codec and preset parameter configuration information to obtain parameter configuration information corresponding to the video to be repaired; According to the parameter configuration information, each frame of video data is cyclically processed starting from the starting position to obtain a repaired video file.
2. The method for repairing drone video files according to claim 1, characterized in that: Determining the structural features of the video file includes: Read the file header of the video file; Determine whether the file header conforms to the file header identifier; the file header identifier includes an ftyp box and an isom box; If the file header does not conform to any one of the ftyp box and the isom box, it is determined that the structural feature of the video file is damaged; If the file header conforms to any one of the ftyp box and the isom box, checking whether the video file includes a media data box; If the video file does not include a media data box, the judgment result is that the structural feature of the video file is damaged; If the video file includes a media data box, the determination result is that the structural feature of the video file is not damaged.
3. The method for repairing drone video files according to claim 2, characterized in that: Checking whether the video file includes a media data box includes: If the file header is any one of the ftyp box and the isom box, shift the position of the video file backward according to the size of the ftyp box or the isom box to obtain a first parsed address; Analyze whether the video file has a free box or a wide box according to the first parsing address, and if so, shift the position of the video file backward according to the size of the free box or the wide box to obtain a second parsing address; both the free box and the wide box are boxes that do not contain actual media data; The video file is parsed according to the second parsing address to determine whether a media data box exists.
4. The method for repairing drone video files according to claim 2, characterized in that: Obtaining the starting position of the video to be repaired of the video file according to the judgment result includes: If the judgment result is that the storage structure of the video file is damaged, the video file is analyzed and matched byte by byte according to a preset parameter set to obtain a matching position; the preset parameter set includes a video sequence parameter set and H.264 / H.265 encoding data; The matching position is used as the starting position of the video to be repaired.
5. The method for repairing drone video files according to claim 2, characterized in that: Obtaining the starting position of the video to be repaired of the video file according to the judgment result includes: If the judgment result is that the storage structure of the video file is not damaged, parsing the preview image in the media data box to obtain the start feature and the end feature of the preview image; The preview image is filtered according to the start feature and the end feature, and the position of the next frame of video of the end feature of the preview image is used as the start position of the video to be repaired.
6. The method for repairing drone video files according to claim 1, characterized in that: Decoding the frame video data at the starting position according to a preset codec and a preset parameter configuration information list includes: Initialize the preset codec according to a set of parameter configuration information in the preset parameter configuration information list to obtain a valid codec; the preset parameter configuration information includes a parameter set corresponding to a video frame rate, a coding format, and a resolution; Decoding the frame video data at the starting position using the effective codec; If the decoding is successful, the parameter configuration information in the preset parameter configuration information list is used as the parameter configuration information corresponding to the video to be repaired; If decoding fails, the next set of parameter configuration information in the preset parameter configuration information list is replaced to initialize the preset codec until decoding succeeds.
7. The method for repairing drone video files according to claim 1, characterized in that: Looping and processing the frame video data from the starting position includes: Looping and parsing each damaged video frame data from the starting position to obtain corresponding video frame data; The parameter configuration information and the video frame data are written into a repair file to obtain a repaired video file.
8. A drone video file repair device, characterized in that: include: An acquisition module, used to acquire video files; A judgment module, used to judge the structural features of the video file to obtain a judgment result; A starting position determination module, used for obtaining the starting position of the video to be repaired of the video file according to the judgment result; A parameter configuration information determination module, used to decode the frame video data at the starting position according to a preset codec and preset parameter configuration information to obtain parameter configuration information corresponding to the video to be repaired; The repair module is used to cyclically process each frame of video data starting from the starting position according to the parameter configuration information to obtain a repaired video file.
9. An electronic device, characterized in that: The electronic device comprises: A memory storing a computer program; A processor is communicatively connected to the memory, and executes the drone video file repair method according to any one of claims 1 to 7 when calling the computer program.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by an electronic device, the drone video file repair method described in any one of claims 1 to 7 is implemented.
