Multimedia file processing method, device, computer equipment and storage medium
By obtaining and analyzing the recording identifiers in multimedia files and handling the interruption of video recording, the problems of video file corruption and waste of storage space are solved, and the integrity and efficient storage of video files are achieved.
Patent Information
- Application Number
- CN202210449071.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-27
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-04-27
AI Technical Summary
During the video recording process, recording interruption, equipment failure or power outage leads to damage to the video file, unable to play normally, and re-recording is wasted storage space and is inconvenient for management.
By obtaining the recording identifier in the last recorded multimedia file, it is determined whether the recording is abnormally interrupted. If the abnormal interruption is abnormal, the analysis information area and multimedia data area are determined, the multimedia data is collected and written to the file until the recording is completed.
Avoid file corruption caused by recording interruption or power outage, ensure the integrity and normal playback of video files, avoid waste of storage space caused by repeated recording, and improve the utilization of storage space.
Smart Images

Figure CN114979052B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a multimedia file processing method, device, computer equipment, storage medium and computer program product. Background Art
[0002] With the development of computer technology, mobile terminals such as mobile phones and tablets have gradually become popular, and taking photos and recording videos are becoming more and more common in various fields. For example, sharing life through taking photos and recording videos, and realizing online teaching through video recording. Video recording and video playback are relatively common and important applications. Therefore, the processing of video recording is the key to ensuring video quality and normal video playback.
[0003] During the video recording process, if there is a recording interruption, equipment failure or power outage, the recorded video file will be damaged, the recorded video file will be incomplete and cannot be played normally, that is, the recording process is abnormally terminated, resulting in the recorded video file cannot be played and used normally. In order to ensure the integrity of the video, it is necessary to re-record, and the re-recording will result in the recorded audio and video files, wasting storage space and inconvenient management. Summary of the invention
[0004] Based on this, it is necessary to provide a multimedia file processing method, apparatus, computer equipment, computer-readable storage medium and computer program product to address the above technical issues.
[0005] In a first aspect, the present application provides a method for processing multimedia files. The method comprises:
[0006] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0007] Parsing the first multimedia file to obtain a recording identifier recorded in a first recording identifier area;
[0008] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0009] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0010] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0011] In one embodiment, writing the acquisition interruption condition into the first recording identification area includes:
[0012] When it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area.
[0013] In one embodiment, writing the acquisition interruption condition into the first recording identification area includes:
[0014] When abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area.
[0015] In one embodiment, the method further comprises:
[0016] If it is determined according to the recording identifier that the last recording is ended normally, collecting multimedia data;
[0017] Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data;
[0018] A second multimedia file recorded this time is obtained according to the multimedia data packet.
[0019] In one embodiment, the multimedia data packet includes a second parsing information area, a second recording identification area, and a second multimedia data area; and creating the multimedia data packet according to the information of the multimedia data includes:
[0020] Collect multimedia data;
[0021] Writing the collected information of the multimedia data into the second parsing information area;
[0022] Writing the collected multimedia data into the second multimedia data area;
[0023] Writing the acquisition interruption situation into the second recording mark area;
[0024] A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0025] In one embodiment, the method further comprises:
[0026] In response to the play instruction, read the target parsing information from the first parsing information area of the first multimedia file in a specified order;
[0027] Based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information.
[0028] In a second aspect, the present application also provides a multimedia file processing device. The device comprises:
[0029] A file acquisition module, used to respond to the multimedia recording instruction and acquire the first multimedia file recorded last time;
[0030] A recording mark parsing module, used for parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area;
[0031] a determination module, configured to determine a first parsing information area and a first multimedia data area of the first multimedia file if it is determined according to the recording identifier that the last recording was abnormally interrupted;
[0032] A data acquisition module, used for collecting multimedia data;
[0033] A file recording module, used for writing the collected information of the multimedia data into the first parsing information area;
[0034] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0035] In a third aspect, the present application further provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:
[0036] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0037] Parsing the first multimedia file to obtain a recording identifier recorded in a first recording identifier area;
[0038] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0039] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0040] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0041] In a fourth aspect, the present application further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0042] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0043] Parsing the first multimedia file to obtain a recording identifier recorded in a first recording identifier area;
[0044] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0045] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0046] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0047] In a fifth aspect, the present application further provides a computer program product. The computer program product includes a computer program, and when the computer program is executed by a processor, the following steps are implemented:
[0048] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0049] Parsing the first multimedia file to obtain a recording identifier recorded in a first recording identifier area;
[0050] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0051] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0052] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0053] The above-mentioned multimedia file processing method, device, computer equipment, storage medium and computer program product, during the recording process, obtains the first recording mark of the first recording mark area in the first multimedia file recorded last time; if it is determined that the last recording is abnormally interrupted according to the recording mark, the first parsing information area and the first multimedia data area of the first multimedia file are determined; the multimedia data is collected, and the collection information of the multimedia data is written into the first parsing information area; the collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording mark area until the recording is completed. During the recording process, the parsing information of each frame of multimedia information is written first, and then the multimedia data is written, which also avoids the situation that the file is damaged and cannot be played normally due to recording interruption or power failure. The last recording situation is obtained by obtaining the first recording mark of the last recording, which avoids repeated recording of multimedia files, resulting in waste of storage space, and improves the utilization rate of storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0054] Figure 1 A schematic diagram of a process flow of a multimedia file processing method in one embodiment;
[0055] Figure 2 A schematic diagram of the composition of a multimedia file in one embodiment;
[0056] Figure 3 is a flowchart of a multimedia file processing method in another embodiment;
[0057] Figure 4 is a flowchart of a multimedia file processing method in another embodiment;
[0058] Figure 5 is a structural block diagram of a multimedia file processing device in one embodiment;
[0059] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0060] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0061] It is understood that in the description of the embodiments of the present application, the technical terms "first", "second", etc. are only used to distinguish different objects, and cannot be understood as indicating or implying relative importance or implicitly indicating the number, specific order or primary and secondary relationship of the indicated technical features. For example, the first multimedia file can be the second multimedia file, and the second multimedia file can be the first multimedia file.
[0062] In one embodiment, Figure 1 As shown, a multimedia processing method is provided. This embodiment takes the method applied to a terminal as an example for illustration. It can be understood that the method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0063] Step 102, responding to the multimedia recording instruction, obtaining the first multimedia file recorded last time.
[0064] Among them, the multimedia recording instruction can be triggered by pressing the recording button on the terminal, or it can be generated by the terminal responding to the recording voice instruction. The triggering method of the multimedia recording instruction is not limited here. Multimedia can be but is not limited to audio and video. The first multimedia file may include one multimedia data packet, or it may include multiple multimedia data packets. The multimedia data packet includes a header information area, a recording identification area, a parsing information area, and a multimedia data area; the header information area is used to record the file type, the recording identification area is used to record the recording interruption (for example, normal end interruption, power outage interruption, or terminal device failure interruption), and the parsing information area is used to record the collection information of the collected multimedia. The collection information includes the resolution, duration, channels, sampling rate, size of each frame of the multimedia data, and the location of data storage, etc. The multimedia data area is used to record specific multimedia data. Such as Figure 2 FIG. 1 is a schematic diagram of the composition of a multimedia data file in an embodiment, including a header information area, a recording identification area, a parsing information area and a multimedia data area.
[0065] Specifically, the terminal responds to the multimedia recording instruction and detects whether there is a first multimedia file recorded last time; if so, the first multimedia file recorded last time is obtained. It can be understood that the detection of whether there is a first multimedia file recorded last time is to determine whether this recording is the first recording. When there is a first multimedia file recorded last time, it means that this recording is not the first recording.
[0066] Step 104: parse the first multimedia file to obtain the recording mark recorded in the first recording mark area.
[0067] The multimedia file may be, but is not limited to, an MP4 file. In this embodiment, the multimedia file is described as an MP4 file. The recording mark is used to record the interruption of the recording. The recording mark may be a first preset mark indicating that the recording is normally ended, or a second preset mark indicating that the recording is abnormally interrupted. The recording mark may be a custom string. For example, 0x0001 indicates the first preset mark indicating that the recording is normally ended, and 0x0000 indicates the second preset mark indicating that the recording is abnormally interrupted.
[0068] Specifically, the multimedia file is parsed according to an existing file parsing method, and the recording mark recorded in the first recording mark area in the first multimedia file is read.
[0069] Step 106: If it is determined according to the recording identifier that the last recording was abnormally interrupted, a first parsing information area and a first multimedia data area of the first multimedia file are determined.
[0070] Specifically, if it is determined according to the recording identifier that the last recording was abnormally interrupted, the first parsing information area and the first multimedia data area of the first multimedia file are determined, and the writing position of the first parsing information area and the first multimedia data area for the last time the last recording was written is determined, and the last writing position of the last recording is used as the starting position of this writing.
[0071] Step 108: Collect multimedia data, and write the collected information of the multimedia data into the first parsing information area.
[0072] Step 110, writing the collected multimedia data into the first multimedia data area, and writing the collection interruption situation into the first recording mark area until the recording is finished.
[0073] In this embodiment, the terminal is recording and collecting at the same time, and the collection interruption can be understood as the recording interruption. When the recording is interrupted, the collection will also be interrupted. Recording interruption includes normal interruption and abnormal interruption. Among them, normal interruption is the end of normal recording; abnormal interruption includes interruption caused by power failure and equipment failure.
[0074] Specifically, multimedia data is collected, and the multimedia data is analyzed to obtain the collection information of the multimedia data, and the last writing position of the previous recording is used as the starting position of this writing, and after the collection information of the multimedia information is written into the first parsing information area of the first multimedia file, the multimedia data is written into the first multimedia data area of the first multimedia file until the recording is finished, and the obtained first multimedia file sequence is used as the recording file of this time. In which, each frame of multimedia data is analyzed in real time, and the parsing information area is updated according to the obtained collection information to avoid missing or incomplete parsing information, thereby ensuring the integrity of the information in the parsing information area.
[0075] It can be understood that multimedia data is collected in units of frames. When the first frame of multimedia data is collected, the first frame of multimedia data is analyzed to obtain collection information of the first frame of multimedia data, and the last write position of the previous recording is used as the starting position of this write. After the collection information of the first frame of multimedia data is written into the first parsing information area of the first multimedia file, the first multimedia data is written into the first multimedia data area of the first multimedia file, and the first parsing information area and the first multimedia data area are collected and updated in sequence until the recording is completed.
[0076] Optionally, in one embodiment, when it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area. By updating the recording mark recorded in the first recording mark area in the first multimedia file, the current recording status is obtained, and when performing the next recording, the last recording status can be used to reduce the repeated generation of recording files, thereby improving the utilization rate of the storage space and extending the service life of the storage space.
[0077] Optionally, in one embodiment, when an abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area. By updating the recording mark recorded in the first recording mark area in the first multimedia file, the current recording status is obtained, and the next recording can be based on the last recording status. When the last recording is abnormally interrupted, when the power is turned on again, the last multimedia file is recorded, thereby reducing the repeated generation of recording files, improving the utilization rate of storage space, and extending the service life of storage space.
[0078] The above multimedia file processing method, during the recording process, obtains the first recording mark of the first recording mark area in the first multimedia file recorded last time; if it is determined that the last recording was abnormally interrupted according to the recording mark, the first parsing information area and the first multimedia data area of the first multimedia file are determined; the multimedia data is collected, and the collection information of the multimedia data is written into the first parsing information area; the collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording mark area until the recording is finished. During the recording process, the parsing information of each frame of multimedia information is written first, and then the multimedia data is written, which also avoids the situation that the file is damaged and cannot be played normally due to recording interruption or power failure. By obtaining the first recording mark of the last recording to obtain the last recording situation, the original video can be continued to be recorded after powering on again, avoiding repeated recording of multimedia files, resulting in a waste of storage space, and improving the utilization rate of storage space.
[0079] In another embodiment, Figure 3 As shown, a multimedia processing method is provided. This embodiment takes the method applied to a terminal as an example. In this embodiment, the method includes the following steps:
[0080] Step 302: respond to the multimedia recording instruction and obtain the first multimedia file recorded last time.
[0081] Step 304: parse the first multimedia file to obtain the recording mark recorded in the first recording mark area.
[0082] Step 306: If it is determined according to the recording identifier that the last recording is ended normally, the multimedia data is collected.
[0083] Step 308: Create a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data.
[0084] Specifically, multimedia data is collected; the collected information of the multimedia data is written into the second parsing information area; the collected multimedia data is written into the second multimedia data area; the collection interruption situation is written into the second recording identification area; and a multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0085] It can be understood that multimedia data is collected in units of frames. When the first frame of multimedia data is collected, the first frame of multimedia data is analyzed to obtain collection information of the first frame of multimedia data. After the collection information of the first frame of multimedia data is written into the second parsing information area of the second multimedia file, the second multimedia data is written into the second multimedia data area of the second multimedia file. The second parsing information area and the second multimedia data area are collected and updated in sequence until the recording is completed to obtain a multimedia data packet.
[0086] Step 310: Obtain the second multimedia file recorded this time according to the multimedia data packet.
[0087] Step 312, in response to the play instruction, read the target parsing information from the second parsing information area of the second multimedia file in a specified order.
[0088] Step 314 , reading the target multimedia data from the multimedia data area of the second multimedia file based on the reading order of the target parsing information, and playing the target multimedia data according to the target parsing information.
[0089] Specifically, when parsing the second multimedia file, acquisition information of each frame of multimedia data is obtained in sequence from the second parsing information area in the second multimedia file, and corresponding multimedia data is obtained from the second multimedia data area in the second multimedia file according to the storage location in the acquisition information, and the acquired multimedia data is further played according to other information in the acquisition information (such as resolution, duration, channel, sampling rate, size of each frame image, etc.).
[0090] Optionally, in one embodiment, when it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the second recording mark area. By updating the recording mark recorded in the first recording mark area in the first multimedia file, the current recording status is obtained, and when performing the next recording, the last recording status can be used to reduce the repeated generation of recording files, thereby improving the utilization rate of the storage space and extending the service life of the storage space.
[0091] Optionally, in one embodiment, when an abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the second recording mark area. By updating the recording mark recorded in the first recording mark area in the first multimedia file, the current recording status is obtained, and the next recording can be based on the last recording status. When the last recording is abnormally interrupted, when the power is turned on again, the last multimedia file is recorded, thereby reducing the repeated generation of recording files, improving the utilization rate of storage space, and extending the service life of storage space.
[0092] In the above multimedia file processing method, when recording multimedia data, the first multimedia file recorded last time is obtained, the first multimedia file is parsed, and the recording mark recorded in the first recording mark area is obtained. If it is determined according to the recording mark that the last recording is ended normally, the multimedia data is collected, a multimedia data packet is created according to the information of the multimedia data, and the second multimedia file recorded this time is obtained according to the multimedia data packet. In response to the play instruction, the target parsing information is read from the second parsing information area of the second multimedia file in a specified order, and the target multimedia data is read from the multimedia data area of the second multimedia file based on the reading order of the target parsing information, and the target multimedia data is played according to the target parsing information. When storing the multimedia data, the collection information of the multimedia data is written first to avoid that the recorded multimedia file cannot be played normally when the recording is interrupted, so as to ensure the normal playback of the recorded multimedia file and avoid the waste of storage space caused by repeated recording.
[0093] In another embodiment, Figure 4 As shown, a multimedia processing method is provided. This embodiment takes the method applied to a terminal as an example. In this embodiment, the method includes the following steps:
[0094] Step 402, responding to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0095] Step 404, parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area;
[0096] Step 406 , judging whether the recording is abnormally interrupted according to the recording mark, if so, executing step 408 , otherwise, executing step 414 .
[0097] Step 408: Determine a first parsing information area and a first multimedia data area of the first multimedia file.
[0098] Step 410: Collect multimedia data and write the collected information of the multimedia data into the first parsing information area.
[0099] Step 412, writing the collected multimedia data into the first multimedia data area, and writing the collection interruption situation into the first recording mark area, until the recording is finished.
[0100] Optionally, in one embodiment, in response to the play instruction, the target parsing information is read from the first parsing information area of the first multimedia file in a specified order; based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information. This can avoid a sudden interruption during recording, which results in the inability to parse and play the video.
[0101] Step 414, collect multimedia data, and create a multimedia data packet according to the information of the multimedia data.
[0102] The multimedia data packet includes multimedia data information and multimedia data.
[0103] Specifically, multimedia data is collected; the collection information of the multimedia data is written into the second parsing information area; the collected multimedia data is written into the second multimedia data area; the collection interruption situation is written into the second recording identification area; and a multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0104] Step 416: Obtain the second multimedia file recorded this time according to the multimedia data packet.
[0105] In one example, a video recording is used as an example to explain that in response to a video recording instruction, the first multimedia file (MP4 file) recorded last time is obtained, the first multimedia file is parsed, and the recording mark recorded in the first recording mark area is obtained. If the last recording is determined to be abnormally interrupted according to the recording mark, the recorded video is spliced into the first multimedia file recorded last time, and the first parsing information area and the first multimedia data area of the first multimedia file are determined; the video is collected, and the video collection information is written into the first parsing information area; the collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording mark area until the recording is completed. This can avoid sudden interruptions during the recording process, resulting in the inability to parse and play the video; after abnormally interrupting the recording, the device can continue to make up the recording on the original video after it is powered on again.
[0106] If it is determined according to the recording mark that the last recording ended normally, create a second multimedia file, create a header information area, a second recording mark area, a second parsing information area, and a second multimedia data area, write the header information area, the second recording mark area, the second parsing information area, and the second multimedia data area into the second multimedia file, and initialize the recording mark in the second recording mark area to mark that no recording is performed. Collect multimedia data; write the collection information of the multimedia data into the second parsing information area; write the collected multimedia data into the second multimedia data area; write the collection interruption situation into the second recording mark area; obtain a multimedia data packet according to the second parsing information area, the second multimedia data area, and the second recording mark area, and obtain the second multimedia file recorded this time according to the multimedia data packet. When recording multimedia, update the parsing information area in real time, and advance the parsing information area to the multimedia data area to ensure that the parsing information of the multimedia that has been recorded has been saved in the parsing area, so that the multimedia file that has been recorded can be played normally even if the recording is suddenly interrupted.
[0107] Optionally, in one example, the terminal sends a multimedia file publishing request to the platform, wherein the multimedia file publishing request carries a recorded multimedia file (a first multimedia file or a second multimedia file). After receiving the multimedia file publishing request sent by the terminal, the platform reviews the multimedia file carried in the multimedia file publishing request according to the platform content publishing rules. When the review is passed, the multimedia file is published, and feedback on the successful publication is sent to the terminal. When the review is not passed, a prompt message indicating that the review has not passed is sent to the terminal.
[0108] In the above multimedia file processing method, when recording multimedia data, by obtaining the first multimedia file recorded last time, parsing the first multimedia file, obtaining the recording mark recorded in the first recording mark area, if it is determined that the last recording is ended normally according to the recording mark, collecting multimedia data, creating a multimedia data packet according to the information of the multimedia data, and obtaining the second multimedia file recorded this time according to the multimedia data packet. If it is determined that the last recording is abnormally interrupted according to the recording mark, determining the first parsing information area and the first multimedia data area of the first multimedia file; collecting multimedia data, writing the collection information of the multimedia data into the first parsing information area; writing the collected multimedia data into the first multimedia data area, and writing the collection interruption situation into the first recording mark area until the recording is finished. By obtaining the last recording situation by obtaining the first recording mark of the last recording, the recording can be continued on the original video after powering on again, avoiding repeated recording of multimedia files; and writing the collection information of the multimedia data first, avoiding the failure of the recorded multimedia files to play normally when the recording is interrupted, ensuring the normal playback of the recorded multimedia files, avoiding the waste of storage space, and improving the utilization rate of storage space.
[0109] It should be understood that, although the various steps in the flowcharts involved in the above-mentioned embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps does not have a strict order restriction, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-mentioned embodiments can include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.
[0110] Based on the same inventive concept, the embodiment of the present application also provides a multimedia file processing device for implementing the multimedia file processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the above method, so the specific limitations in one or more multimedia file processing device embodiments provided below can refer to the limitations of the multimedia file processing method above, and will not be repeated here.
[0111] In one embodiment, Figure 5 As shown, a multimedia file processing device is provided, including: a file acquisition module 502, a recording identification parsing module 504, a determination module 506, a data collection module 508 and a file recording module 510, wherein:
[0112] The file acquisition module 502 is used to respond to the multimedia recording instruction and acquire the first multimedia file recorded last time.
[0113] The recording mark parsing module 504 is used to parse the first multimedia file and obtain the recording mark recorded in the first recording mark area.
[0114] The determination module 506 is configured to determine a first parsing information area and a first multimedia data area of the first multimedia file if it is determined according to the recording identifier that the last recording was abnormally interrupted.
[0115] The data collection module 508 is used to collect multimedia data.
[0116] The file recording module 510 is used to write the collected information of the multimedia data into the first parsing information area;
[0117] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0118] The above-mentioned multimedia file processing method, device, computer equipment, storage medium and computer program product, during the recording process, obtains the first recording mark of the first recording mark area in the first multimedia file recorded last time; if it is determined that the last recording is abnormally interrupted according to the recording mark, the first parsing information area and the first multimedia data area of the first multimedia file are determined; the multimedia data is collected, and the collection information of the multimedia data is written into the first parsing information area; the collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording mark area until the recording is completed. During the recording process, the parsing information of each frame of multimedia information is written first, and then the multimedia data is written, which also avoids the situation that the file is damaged and cannot be played normally due to recording interruption or power failure. The last recording situation is obtained by obtaining the first recording mark of the last recording, which avoids repeated recording of multimedia files, resulting in waste of storage space, and improves the utilization rate of storage space.
[0119] In another embodiment, a multimedia file processing device is provided, which includes, in addition to the file acquisition module 502, the recording identification parsing module 504, the determination module 506, the data collection module 508 and the file recording module 510, a recording detection module and a playback module, wherein:
[0120] The recording detection module is used to write a first preset mark indicating that the recording has ended normally into the first recording mark area when detecting that the recording has ended normally.
[0121] Optionally, in one embodiment, the recording detection module is further configured to write a second preset mark indicating abnormal interruption of recording into the first recording mark area when abnormal interruption of recording is detected.
[0122] The file recording module 510 is also used to collect multimedia data if it is determined according to the recording identifier that the last recording is normally ended;
[0123] Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data;
[0124] The second multimedia file recorded this time is obtained according to the multimedia data packet.
[0125] The file recording module 510 is also used to write the collected information of the multimedia data into the second parsing information area;
[0126] Writing the collected multimedia data into the second multimedia data area;
[0127] Writing the acquisition interruption situation into the second recording mark area;
[0128] A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0129] A playing module, configured to respond to a playing instruction and read target parsing information from a first parsing information area of a first multimedia file in a specified order;
[0130] Based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information.
[0131] In one embodiment, in response to a multimedia recording instruction, the first multimedia file recorded last time is obtained, the first multimedia file is parsed, and the recording mark recorded in the first recording mark area is obtained. If it is determined that the last recording was abnormally interrupted according to the recording mark, the first parsing information area and the first multimedia data area of the first multimedia file are determined; multimedia data is collected, and the collection information of the multimedia data is written into the first parsing information area; the collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording mark area until the recording is completed. This can avoid sudden interruptions during the recording process, resulting in the inability to parse and play the video; after abnormally interrupted recording, the device can continue to make up the recording on the original video after it is powered on again.
[0132] If it is determined according to the recording mark that the last recording ended normally, collect multimedia data; write the collection information of multimedia data into the second analysis information area; write the collected multimedia data into the second multimedia data area; write the collection interruption situation into the second recording mark area; obtain the multimedia data packet according to the second analysis information area, the second multimedia data area and the second recording mark area, and obtain the second multimedia file recorded this time according to the multimedia data packet. When recording multimedia, the analysis information area is updated in real time, and the analysis information area is advanced to the multimedia data area to ensure that the analysis information of the multimedia that has been recorded has been saved in the analysis area, and the multimedia file that has been recorded can be played normally even if the recording is suddenly interrupted.
[0133] Each module in the above multimedia processing device can be implemented in whole or in part by software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module.
[0134] In one embodiment, a computer device is provided. The computer device may be a terminal, and its internal structure diagram may be as follows: Figure 6As shown. The computer device includes a processor, a memory, a communication interface, a display screen and an input device connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. When the computer program is executed by the processor, a multimedia processing method is implemented. The display screen of the computer device can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device can be a touch layer covered on the display screen, or a button, a trackball or a touch pad set on the computer device housing, or an external keyboard, touch pad or mouse, etc.
[0135] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0136] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and when the processor executes the computer program, the following steps are implemented:
[0137] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0138] Parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area;
[0139] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0140] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0141] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0142] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0143] When it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area.
[0144] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0145] When abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area.
[0146] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0147] If it is determined according to the recording identifier that the last recording is ended normally, the multimedia data is collected;
[0148] Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data;
[0149] The second multimedia file recorded this time is obtained according to the multimedia data packet.
[0150] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0151] Collect multimedia data;
[0152] Writing the collected information of the multimedia data into the second parsing information area;
[0153] Writing the collected multimedia data into the second multimedia data area;
[0154] Writing the acquisition interruption situation into the second recording mark area;
[0155] A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0156] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0157] In response to the play instruction, read the target parsing information from the first parsing information area of the first multimedia file in a specified order;
[0158] Based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information.
[0159] In one embodiment, a computer readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0160] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0161] Parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area;
[0162] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0163] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0164] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0165] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0166] When it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] When abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area.
[0169] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0170] If it is determined according to the recording identifier that the last recording is ended normally, the multimedia data is collected;
[0171] Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data;
[0172] The second multimedia file recorded this time is obtained according to the multimedia data packet.
[0173] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0174] Collect multimedia data;
[0175] Writing the collected information of the multimedia data into the second parsing information area;
[0176] Writing the collected multimedia data into the second multimedia data area;
[0177] Writing the acquisition interruption situation into the second recording mark area;
[0178] A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0179] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0180] In response to the play instruction, read the target parsing information from the first parsing information area of the first multimedia file in a specified order;
[0181] Based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information.
[0182] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0183] In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time;
[0184] Parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area;
[0185] If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file;
[0186] Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area;
[0187] The collected multimedia data is written into the first multimedia data area, and the collection interruption situation is written into the first recording identification area until the recording is finished.
[0188] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0189] When it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area.
[0190] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0191] When abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area.
[0192] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0193] If it is determined according to the recording identifier that the last recording is ended normally, the multimedia data is collected;
[0194] Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data;
[0195] The second multimedia file recorded this time is obtained according to the multimedia data packet.
[0196] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0197] Collect multimedia data;
[0198] Writing the collected information of the multimedia data into the second parsing information area;
[0199] Writing the collected multimedia data into the second multimedia data area;
[0200] Writing the acquisition interruption situation into the second recording mark area;
[0201] A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
[0202] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0203] In response to the play instruction, read the target parsing information from the first parsing information area of the first multimedia file in a specified order;
[0204] Based on the reading order of the target parsing information, the target multimedia data is read from the multimedia data area of the first multimedia file, and the target multimedia data is played according to the target parsing information.
[0205] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.
[0206] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.
[0207] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0208] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.
Claims
1. A multimedia file processing method, characterized in that: The method comprises: In response to the multimedia recording instruction, obtaining the first multimedia file recorded last time; Parsing the first multimedia file to obtain a recording identifier recorded in a first recording identifier area; If it is determined according to the recording identifier that the last recording was abnormally interrupted, determining a first parsing information area and a first multimedia data area of the first multimedia file; Collecting multimedia data, and writing the collected information of the multimedia data into the first parsing information area, the collected information including the resolution, duration, channel, sampling rate, and storage location of the multimedia data; Writing the collected multimedia data into the first multimedia data area, and writing the collection interruption situation into the first recording identification area until the recording is finished; In response to a play instruction, target parsing information is read from the first parsing information area of the first multimedia file in a specified order, target multimedia data is read from the multimedia data area of the first multimedia file based on the reading order of the target parsing information, and the target multimedia data is played according to the target parsing information.
2. The method according to claim 1, characterized in that Writing the acquisition interruption condition into the first recording identification area includes: When it is detected that the recording ends normally, a first preset mark indicating that the recording ends normally is written into the first recording mark area.
3. The method according to claim 1, characterized in that Writing the acquisition interruption condition into the first recording identification area includes: When abnormal interruption of recording is detected, a second preset mark indicating abnormal interruption of recording is written into the first recording mark area.
4. The method according to claim 1, characterized in that: The method further comprises: If it is determined according to the recording identifier that the last recording is ended normally, collecting multimedia data; Creating a multimedia data packet according to the information of the multimedia data; the multimedia data packet includes the information of the multimedia data and the multimedia data; A second multimedia file recorded this time is obtained according to the multimedia data packet.
5. The method according to claim 4, characterized in that The multimedia data packet includes a second parsing information area, a second recording identification area, and a second multimedia data area; and the step of creating a multimedia data packet according to the information of the multimedia data includes: Collect multimedia data; Writing the collected information of the multimedia data into the second parsing information area; Writing the collected multimedia data into the second multimedia data area; Writing the acquisition interruption situation into the second recording mark area; A multimedia data packet is obtained according to the second parsing information area, the second multimedia data area and the second recording identification area.
6. A multimedia file processing device, characterized in that: The device comprises: A file acquisition module, used to respond to the multimedia recording instruction and acquire the first multimedia file recorded last time; A recording mark parsing module, used for parsing the first multimedia file to obtain the recording mark recorded in the first recording mark area; a determination module, configured to determine a first parsing information area and a first multimedia data area of the first multimedia file if it is determined according to the recording identifier that the last recording was abnormally interrupted; A data acquisition module, used for collecting multimedia data; A file recording module, used for writing the acquisition information of the multimedia data into the first parsing information area, the acquisition information including the resolution, duration, channel, sampling rate, and storage location of the multimedia data; Writing the collected multimedia data into the first multimedia data area, and writing the collection interruption situation into the first recording identification area until the recording is finished; The device is also used to: respond to a play instruction, read target parsing information from the first parsing information area of the first multimedia file in a specified order, read target multimedia data from the multimedia data area of the first multimedia file based on the reading order of the target parsing information, and play the target multimedia data according to the target parsing information.
7. The device according to claim 6, characterized in that The device further comprises a recording detection module, wherein when detecting that the recording is normally ended, the recording detection module is used to write a first preset mark indicating that the recording is normally ended into the first recording mark area.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 5 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 5 are implemented.
Citation Information
Patent Citations
Monitoring video file restoring method
CN104063447A
Content recording apparatus
US20040190171A1