Media file generation method and apparatus, electronic device, and storage medium
By determining the mapping relationship between media files in different encapsulation formats and regenerating media files, the problem of wasted storage space and data redundancy is solved, and efficient utilization of storage space is achieved.
Patent Information
- Application Number
- PCT/CN2024/081251
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-03-14
- Filing Date
- 2024-03-12
- Publication Date
- 2024-09-19
AI Technical Summary
When storing media files in different encapsulation formats, storage space is wasted due to redundant data, leading to data redundancy problems.
By determining the preset file index information between the first format media file and the second format media file, recording the mapping correspondence relationship between the first target media data and the second target media data, and reprocessing the first format media file based on this information. Generate, utilizing data in a second format media file to reduce redundancy.
Save storage space, improve the effective utilization of storage space, and reduce data redundancy.
Smart Images

Figure CN2024081251_19092024_PF_FP_ABST
Abstract
Description
Media file generation method, device, electronic device and storage medium
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on March 14, 2023, with application number 202310266459.5, and invention name “Media file generation method, device, electronic device and storage medium”, all contents of which are incorporated into this application by reference. Technical Field
[0002] The present disclosure relates to data processing technology, and more particularly to a method and apparatus for generating a media file, an electronic device, and a storage medium. Background Art
[0003] Due to the diversity of the end side and the need to play media files in different encapsulation formats in different scenarios, media files in multiple encapsulation formats will be generated simultaneously during transcoding on the server side.
[0004] Media files in different encapsulation formats have the same encoding parameters; they are simply encapsulated in different formats, so the transcoded stream data contained within is identical. If media data with the same content is stored in different encapsulation formats, it will take up a lot of storage space, resulting in wasted storage space and data redundancy.
[0005] Summary of the Invention
[0006] The present disclosure provides a media file generation method, device, electronic device, and storage medium, which can solve the problem of multiple packaging formats containing redundant data and save storage space.
[0007] In a first aspect, an embodiment of the present disclosure provides a method for generating a media file, the method comprising:
[0008] Determining a first-format media file and a second-format media file, where the first-format media file is obtained by converting the second-format media file into a preset encapsulation format;
[0009] determining preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0010] The first format media file is regenerated using the second target media data in the second format media file according to the preset file index information.
[0011] In a second aspect, an embodiment of the present disclosure further provides a media file generation device, the device comprising:
[0012] a media file determination module, configured to determine a first-format media file and a second-format media file, wherein the first-format media file is obtained by converting the second-format media file into a preset encapsulation format;
[0013] a preset file index information determining module, configured to determine preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0014] The media data generating module is configured to regenerate the media file in the first format by using the second target media data in the media file in the second format according to preset file index information.
[0015] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising:
[0016] one or more processors;
[0017] a storage device for storing one or more programs,
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the media file generation method described in any embodiment of the present disclosure.
[0019] In a fourth aspect, an embodiment of the present disclosure further provides a storage medium comprising computer-executable instructions, which, when executed by a computer processor, are used to execute the media file generation method as described in any embodiment of the present disclosure.
[0020] In an embodiment of the present disclosure, a first-format media file and a second-format media file are determined, where the first-format media file is obtained by converting the second-format media file into a preset encapsulation format; preset file index information is determined from the first-format media file, where the preset file index information records a mapping relationship between first target media data and second target media data, where the first target media data includes target media data that has been deleted from the first-format media file, and the second target media data includes target media data in the second-format media file that has the same data content as the first target media data; and based on the preset file index information, the first-format media file is regenerated using the second target media data in the second-format media file. Preparing media files of different encapsulation formats for storing media data with the same content will occupy a large amount of storage space, resulting in a waste of storage space and, in turn, data redundancy. This solution solves the problems of wasted storage space and data redundancy by determining the preset file index information from the first-format media file and, based on the preset file index information, regenerating the first-format media file using the second target media data in the second-format media file, thereby saving storage space and improving the effective utilization of storage space. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] The above and other features, advantages, and aspects of the various embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and that the originals and elements are not necessarily drawn to scale.
[0022] FIG1a is a flow chart of a method for generating a media file provided by an embodiment of the present disclosure;
[0023] FIG1b is a schematic diagram of an MP4 file structure provided by an embodiment of the present disclosure;
[0024] FIG2a is a flow chart of another method for generating a media file provided by an embodiment of the present disclosure;
[0025] FIG2 b is a schematic diagram showing the distribution of media data of an MP4 file and media data of a dash file provided by an embodiment of the present disclosure;
[0026] FIG3 is a schematic structural diagram of a media file generating device provided by an embodiment of the present disclosure;
[0027] FIG4 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0028] The following describes embodiments of the present disclosure in more detail with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as limited to the embodiments described herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of protection of the present disclosure.
[0029] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0030] As used herein, the term "including" and its variations are open-ended, i.e., "including but not limited to." The term "based on" means "based, at least in part, on." The term "one embodiment" means "at least one embodiment," the term "another embodiment" means "at least one additional embodiment," and the term "some embodiments" means "at least some embodiments." Other terms are defined in the following description.
[0031] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0032] It should be noted that the modifications of "one" and "multiple" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, they should be understood as "one or more".
[0033] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0034] It is understandable that before using the technical solutions disclosed in the various embodiments of this disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved in this disclosure should be informed to the user and the user's authorization should be obtained in an appropriate manner in accordance with relevant laws and regulations.
[0035] For example, in response to a user's active request, a prompt message is sent to the user to clearly inform the user that the operation requested will require the acquisition and use of the user's personal information. This allows the user to independently choose whether to provide personal information to the electronic device, application, server, storage medium, or other software or hardware that performs the operations of the disclosed technical solution based on the prompt message.
[0036] As an optional but non-limiting implementation, in response to receiving a user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. Furthermore, the pop-up window may also contain a selection control for the user to select "agree" or "disagree" to provide personal information to the electronic device.
[0037] It is understandable that the above notification and user authorization process are merely illustrative and do not limit the implementation of the present disclosure. Other methods that comply with relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0038] It is understandable that the data involved in this technical solution (including but not limited to the data itself, the acquisition or use of the data) must comply with the requirements of relevant laws, regulations and relevant provisions.
[0039] Figure 1a is a flow chart of a method for generating a media file provided by an embodiment of the present disclosure. This embodiment of the present disclosure is applicable to situations where a media file is quickly regenerated. The method can be executed by a media file generation device, which can be implemented in the form of software and / or hardware. Optionally, it can be implemented by an electronic device, which can be a mobile terminal, a PC, or a server. As shown in Figure 1a, the method includes:
[0040] S110: Determine a first format media file and a second format media file.
[0041] The first format media file is obtained by converting the second format media file into a preset encapsulation format.
[0042] Among them, the first format media file is a file with media data deleted. The second format media file is a file with media data retained. The encoding parameters of the first format media file are the same as the encoding parameters of the second format media file, and the transcoding stream data of the first format media file is the same as the transcoding stream data of the second format media file, but the encapsulation format of the first format media file and the second format media file is different. Taking the first format media file as an MP4 file as an example, the second format media file can be a dash file or an HLS file other than an MP4 file. This solution is explained by taking the first format media file as an MP4 file and the second format media file as a dash file as an example.
[0043] S120: Determine preset file index information from the first format media file.
[0044] In which, the preset file index information records the mapping correspondence between the first target media data and the second target media data, the first target media data includes the target media data that has been deleted in the first format media file, and the second target media data includes the target media data in the second format media file that has the same data content as the first target media data.
[0045] The first target media data and the second target media data record the same data content. The first target media data belongs to a first-format media file, and the second target media data is stored in a second-format media file. The first-format media file also contains preset file index information. The preset file index information can be used to determine the mapping relationship between the first target media data that has been deleted in the first-format media file and the second target media data with the same data content in the second-format media file. When a user searches for the first target media data, it can serve as a guide to obtain the second target media data corresponding to the first target media data in the second-format media file, and regenerate the first-format media file based on the second target media data. It is understandable that the media data can be audio data or video data.
[0046] S130: Regenerate the first format media file using the second target media data in the second format media file according to the preset file index information.
[0047] Among them, this solution can determine the deleted first target media data in the first format media file according to the preset file index information and the second format media file when accessing the first target media data, which can save memory space and reduce redundant data.
[0048] As an optional but non-limiting implementation, the method for generating the first format media file includes but is not limited to steps A1-A3:
[0049] Step A1: convert the second-format media file into a reference media file, and delete the first target media data in the reference media file.
[0050] For example, if the first-format media file is an MP4 file and the second-format media file is a dash file, this solution can convert the dash file into a reference media file and then delete the first target media data from the reference media file. As shown in Figure 1b, the reference media file can be a complete MP4 file including header data and media data.
[0051] Step A2: Obtain the preset file index information by parsing metadata information in the reference media file, where the metadata information includes preset description information of all media data in the reference media file.
[0052] As shown in FIG1B , the metadata information may be information in an stco box in the reference media file, and the metadata information may include the offset value of each media data block of the deleted first target media data in the mdat data of the MP4 file before deletion. This solution can parse the metadata information in the reference media file to obtain the offset value of each media data block in the mdat data of the MP4 file before deletion, and then obtain the preset file index information based on each offset value.
[0053] Step A3: Add the preset file index information to the reference media file from which the first target media data has been deleted, to obtain the first format media file.
[0054] Among them, this solution obtains the first format media file by adding the preset file index information to the reference media file from which the first target media data has been deleted, which can provide a reliable data basis for regenerating the deleted media data in the first format media file.
[0055] Thus, a reference media file is obtained by converting the second-format media file into a new format and deleting the first target media data from the reference media file. Preset file index information is obtained by parsing metadata in the reference media file, the metadata including predefined description information for all media data in the reference media file. The predefined file index information is then added to the reference media file from which the first target media data has been deleted, thereby obtaining the first-format media file. This allows for mutual conversion between media files of different formats, providing a reliable data foundation for subsequent determination of media data.
[0056] In an embodiment of the present disclosure, a first-format media file and a second-format media file are determined, where the first-format media file is obtained by converting the second-format media file into a preset encapsulation format; preset file index information is determined from the first-format media file, where the preset file index information records a mapping relationship between first target media data and second target media data, where the first target media data includes target media data that has been deleted from the first-format media file, and the second target media data includes target media data in the second-format media file that has the same data content as the first target media data; and based on the preset file index information, the first-format media file is regenerated using the second target media data in the second-format media file. Preparing media files of different encapsulation formats for storing media data with the same content consumes a large amount of storage space, resulting in a waste of storage space and, in turn, data redundancy. This solution solves the problems of wasted storage space and data redundancy by determining the preset file index information from the first-format media file and, based on the preset file index information, regenerating the first-format media file using the second target media data in the second-format media file, thereby saving storage space and improving the effective utilization of storage space.
[0057] Figure 2a is a flow chart of another method for generating a media file provided in an embodiment of the present disclosure. This embodiment further optimizes the aforementioned embodiment based on the aforementioned embodiment. This embodiment can be combined with various optional solutions in one or more of the aforementioned embodiments. As shown in Figure 2a, the method for generating a media file provided in an embodiment of the present disclosure may include the following steps:
[0058] S210: Receive a media data packet, where the media data packet includes media files in different encapsulation formats.
[0059] The media data packet may include media files having different encapsulation formats but the same encoding parameters and transcoding stream data. For example, the media data packet may include a media file in a first format and a media file in a second format.
[0060] S220 : In response to the access request for the media file in the first format, parse the received media data packet to obtain the associated stored media file in the first format and the media file in the second format.
[0061] The second target media data having the same data content as the first target media data is not deleted from the second format media file, and the audio and video encoding parameters used in the first format media file and the second format media file are the same.
[0062] Specifically, this solution can determine a first-format media file and a second-format media file from a received media data packet based on an access request for the first-format media file. The first-format media file has the first target media data deleted, while the second-format media file includes the second target media data having the same data content as the first target media data. The first-format media file and the second-format media file use the same audio and video encoding parameters and transcoded stream data, allowing the first target media data to be regenerated from the second-format media file.
[0063] S230: Determine preset file index information from the first format media file.
[0064] As an optional but non-limiting implementation, the preset file index information includes a mapping relationship between first offset information and second offset information, where the first offset information describes a first offset position of the first target media data relative to the first format media file before deletion, and the second offset information describes a second offset position of the second target media data relative to the second format media file.
[0065] For example, assuming that the first offset position of deleted first target media data in a first-format media file relative to the first-format media file before deletion is denoted by offset n, and the second offset position of second target media data in a second-format media file having the same data content as the first target media data relative to the second-format media file is denoted by reference n, the mapping relationship between the first offset information and the second offset information in the preset file index information can be expressed as follows: ("offset n", "reference n"). By determining the mapping relationship between the first offset information and the second offset information in the preset file index information, media data in a media file of one encapsulation format can be regenerated based on a media file of another encapsulation format.
[0066] As an optional but non-limiting implementation method, the preset file index information also includes media type information, which describes the media type of the same target media data corresponding to the mapping of the first offset information to the second offset information, and the media type information is represented by a numerical value.
[0067] For example, assuming that the first offset information is represented by offset n, the second offset information is represented by reference n, and the media type information is represented by type x, the preset file index information can also be represented as follows: ("offset n", "type x", "reference n"). Type x describes the media type of the same target media data corresponding to the mapping from the first offset information to the second offset information, and the media type information is represented by a numerical value. For example, when x is 1, type 1 indicates that the media data type is video data. When x is 2, type 2 indicates that the media data type is audio data. By determining the preset file index information containing the media type information, it is possible to regenerate media data in a media file of another encapsulation format based on a media file of one encapsulation format.
[0068] As an optional but non-limiting implementation, the method for generating the preset file index information includes but is not limited to steps B1-B2:
[0069] Step B1: Determine a first offset position of the first target media data relative to the first format media file before deletion.
[0070] The first target media data may be any segment of media data that has been deleted from the first-format media file. This solution can determine, based on header data in the first-format media file, a first offset position of the deleted first target media data relative to the first-format media file before deletion, thereby providing a reliable data basis for constructing preset file index information.
[0071] Step B2: Determine a second offset position of the second target media data relative to the second format media file from the second format media file.
[0072] In this case, the present solution can determine, from a second-format media file based on the first target media data, second target media data having the same data content as the first target media data, and further determine a second offset position of the second target media data relative to the second-format media file based on the offset position of each media data block stored in the second-format media file relative to the second-format media file.
[0073] Step B3: Constructing the preset file index information by mapping the first offset position and the second offset position pointing to the same target media data.
[0074] Specifically, this solution can map the first offset position and the second offset position pointing to the same data determined in the above step to obtain preset file index information. This can achieve the regeneration of media data in a media file of another encapsulation format based on a media file of one encapsulation format.
[0075] As an optional but non-limiting implementation, determining the first offset position of the first target media data relative to the first format media file before deletion includes but is not limited to steps C1-C2:
[0076] Step C1: Based on the size of each deleted first target media data in the first format media file, interleave and sort the deleted first target media data according to the media type of the first target media data.
[0077] Taking an MP4 file as an example, this solution can interleave and sort the deleted first target media data according to their media types based on their sizes. As shown in Figure 2b, the audio data segments and video data segments in the MP4 file are interleaved in sequence.
[0078] Step C2: Record the first offset position of each interleaved first target media data relative to the first format media file and the media type of the first target media data before deletion, wherein at least two adjacent interleaved first target media data have different media types.
[0079] Specifically, this solution can record the first offset position of each interleaved first target media data relative to the first format media file before deletion, as well as the media type of the first target media data. For example, this solution can record the offset position of each interleaved audio data segment relative to the MP4 file before deletion. This solution can also record the offset position of each interleaved video data segment relative to the MP4 file before deletion. The media types of two adjacent first target media data are different.
[0080] Thus, by interleaving and sorting the deleted first target media data according to their media types based on their sizes in the first-format media file, and recording the first offset positions of the interleaved and sorted first target media data relative to the first-format media file before deletion, and the media types of the first target media data, at least some adjacent first target media data in the interleaved and sorted order have different media types. This can provide a reliable data basis for generating preset file index information.
[0081] As an optional but non-limiting implementation, determining the second offset position of the second target media data relative to the second format media file from the second format media file may also include but is not limited to the following process:
[0082] When the deleted current first target media data in the first format media file is the first target media data, searching for the first target media data from the second target media data in the second format media file based on the media type of the current first target media data and determining that the first target media data is the same as the current first target media data, wherein the searched first target media data and the current first target media data have the same media type; and determining a second offset position of the second target media data relative to the second format media file.
[0083] For example, taking the case where the first-format media file is an MP4 file, the second-format media file is a dash file, and the media type is video data, when the current first target media data that has been deleted from the MP4 file is of the video type and is the first target media data in the MP4 file, this solution can search the dash file for the first target media data of the video type, determine that it is the same second target media data as the current first target media data, and determine the second offset position of the second target media data relative to the dash file. This can determine the second offset position of the second target media data relative to the second-format media file, providing a reliable data basis for generating preset file index information.
[0084] As an optional but non-limiting implementation, determining the second offset position of the second target media data relative to the second format media file from the second format media file includes but is not limited to steps D1-D2:
[0085] Step D1: When the deleted current first target media data in the first format media file is not the first target media data, a previous offset position and a current offset position are determined, and the size of the previous first target media data is determined based on the previous offset position and the current offset position; the current offset position is the first offset position of the deleted current first target media data in the first format media file relative to the first format media file before deletion, and the previous offset position is the first offset position of the previous target media data preceding the deleted current first target media data in the first format media file relative to the first format media file before deletion.
[0086] Exemplarily, when the deleted current first target media data in the first-format media file is not the first target media data, this solution can determine the first offset position of the deleted current first target media data in the first-format media file relative to the first-format media file before deletion, and can also determine the first offset position of the previous target media data before the deleted current first target media data in the first-format media file relative to the first-format media file before deletion, and determine the size of the previous first target media data based on the previous offset position and the current offset position.
[0087] For example, taking the first format media file as an MP4 file, when the current first target media data that has been deleted in the MP4 file is not the first target media data, this solution can determine the previous offset position offset m-1 and the current offset position offset m associated with the current first target media data from the MP4 file, and then determine the size of the previous first target media data based on the difference between offset m and offset m-1. The previous offset position offset m-1 is the first offset position of the previous first target media data of the current first target media data that has been deleted in the MP4 file relative to the MP4 file before deletion. This can provide a reliable data basis for determining the offset position of the second target media data having the same data content as the first target media data pointed to by the first offset position relative to the second format media file.
[0088] Step D2: Searching for second target media data identical to the current first target media data from the second-format media file based on the size of the previous first target media data, the media type of the current first target media data, and a reference offset position; and determining a second offset position of the second target media data identical to the current first target media data relative to the second-format media file.
[0089] The reference offset position is a second offset position of the second format media file, which is the same as the previous first target media data, relative to the second format media file.
[0090] Here, taking the case where the media type of the current first target media data is a video type, offset n represents the first offset position, and reference n represents the second offset position, as an example, since the first offset position of each deleted video data segment in the MP4 file relative to the MP4 file before the video data was deleted can be determined, and the second offset position of the first video data segment in the second-format media file can also be determined, this solution can search for and determine the second offset position reference m of the second-format media file for the second target media data identical to the current first target media data based on the difference between the size of offset m and offset m-1 of the previous first target media data, the video type, and the reference offset position reference m-1. The reference offset position can be the second offset position of the second target media data in the second-format media file that has the same data content as the previous first target media data relative to the second-format media file. This allows for the determination of the second offset position of the second target media data relative to the second-format media file, providing a reliable data basis for the generation of preset file index information.
[0091] S240: Regenerate the first format media file using the second target media data in the second format media file according to the preset file index information.
[0092] As an optional but non-limiting implementation, based on the preset file index information, the first format media file is regenerated using the second target media data in the second format media file, including but not limited to steps E1-E3:
[0093] Step E1: when accessing a first-format media file, read pre-reserved file header data from the first-format media file, where the pre-reserved file header data records the first offset information.
[0094] Taking the first format media file as an MP4 file as an example, this solution can access the stco box file of the pre-reserved file header data in the MP4 file, and the stco box file records the first offset information of the deleted first target media data relative to the MP4 file.
[0095] Step E2: Read the first offset information required for the deleted first target media data from the pre-reserved file header data.
[0096] In this solution, the first offset information required for the deleted first target media data can be read from the stco box file of the pre-reserved file header data.
[0097] Step E3: regenerate the first format media file using the second target media data in the second format media file according to the first offset information required by the deleted first target media data and the preset file index information.
[0098] This solution can determine the deleted first target media data in a first-format media file based on the first offset information required by the deleted first target media data and the preset file index information, thereby regenerating the media data. This solution can also regenerate media data in a media file of one encapsulation format based on the preset file index information and a media file of another encapsulation format, thereby saving storage space.
[0099] As an optional but non-limiting implementation, based on the first offset information required by the deleted first target media data and the preset file index information, the first format media file is regenerated using the second target media data in the second format media file, including but not limited to steps F1-F2:
[0100] Step F1: Match the first offset information required by the deleted first target media data with the preset file index information to obtain an offset information matching result, wherein the offset information matching result includes second offset information associated with the first offset information required by the deleted first target media data.
[0101] In which, assuming that the media type of the first target media data is a video type, the first offset information required for the deleted first target media data is represented as offset 3, and the second offset information of the second target media data having the same data content as the first target media data is represented as reference 3. This scheme can match offset 3 with the mapping information ("offset 3", "type 1", "reference 3") in the preset file index information to obtain the second offset information reference 3 associated with the mapping of the first offset information required for the deleted first target media data.
[0102] Step F2: reading the media data at the corresponding offset position from the second target media data in the second format media file according to the offset information matching result, and adding the read media data to the first format media file to reassemble and generate the first format media file.
[0103] Specifically, this solution can determine second offset information reference 3 associated with the first offset information mapping based on the first offset information required by the deleted first target media data. Then, based on the second offset information reference 3, video data at the corresponding offset position can be read from the second target media data in the second-format media file storing the media data. The read video data can then be added to the first-format media file to reassemble the media file into the first-format media file. This allows media data in one encapsulation format to be regenerated based on preset file index information and a media file in another encapsulation format, thereby saving storage space.
[0104] In an embodiment of the present disclosure, a media data packet is received, the media data packet including media files in different encapsulation formats; in response to an access request for a media file in a first format, the first format media file and a second format media file that are associated and stored are parsed from the received media data packet; second target media data having the same data content as the first target media data is not deleted from the second format media file, and the first and second format media files use the same audio and video encoding parameters; preset file index information is determined from the first format media file, the preset file index information recording a mapping relationship between the first target media data deleted from the first format media file and the second target media data having the same data content in the second format media file; and based on the preset file index information, the first format media file is regenerated using the second target media data in the second format media file. Preparing media files of different packaging formats for storing media data with the same content will occupy a large amount of storage space, resulting in a waste of storage space and further leading to data redundancy. This solution determines preset file index information from the first format media file and, based on the preset file index information, uses the second target media data in the second format media file to regenerate the first format media file, thereby solving the problems of storage space waste and data redundancy, thereby saving storage space and reducing data redundancy.
[0105] FIG3 is a schematic diagram of the structure of a media file generation device provided by an embodiment of the present disclosure. As shown in FIG3 , the device includes:
[0106] The media file determination module 310 is configured to determine a first format media file and a second format media file, where the first format media file is obtained by converting the second format media file into a preset encapsulation format;
[0107] a preset file index information determining module 320 configured to determine preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0108] The media data generating module 330 is configured to regenerate the media file in the first format by using the second target media data in the media file in the second format according to the preset file index information.
[0109] In an optional solution of the embodiment of the present disclosure, the media file determination module 310 optionally includes a reference media file determination unit, configured to perform encapsulation format conversion on the second-format media file to obtain a reference media file, and delete the first target media data from the reference media file; a file index information determination unit, configured to obtain the file index information by parsing metadata information in the reference media file, where the metadata information includes preset description information of all media data in the reference media file; and a first-format media file determination unit, configured to add the preset file index information to the reference media file from which the first target media data has been deleted, to obtain the first-format media file.
[0110] In an optional solution of the embodiment of the present disclosure, the media file determination module 310 optionally includes a media data packet receiving unit, configured to receive a media data packet, wherein the media data packet includes media files in different encapsulation formats; and a media file determination unit, configured to parse, in response to an access request for a media file in the first format, the received media data packet to obtain associated stored media files in the first format and media files in the second format; wherein second target media data having the same data content as the first target media data is not deleted from the media file in the second format, and the audio and video encoding parameters used in the media file in the first format and the media file in the second format are the same.
[0111] In an optional scheme of an embodiment of the present disclosure, optionally, the preset file index information includes a mapping correspondence between first offset information and second offset information, wherein the first offset information describes a first offset position of the first target media data relative to the first format media file before deletion, and the second offset information describes a second offset position of the second target media data relative to the second format media file.
[0112] In an optional scheme of an embodiment of the present disclosure, optionally, the preset file index information also includes media type information, which describes the media type of the same target media data corresponding to the mapping of the first offset information to the second offset information, and the media type information is represented by a numerical value.
[0113] In an optional solution of the embodiment of the present disclosure, the preset file index information determination module 320 optionally includes a first offset position determination unit, configured to determine a first offset position of the first target media data relative to the first format media file before deletion; a second offset position determination unit, configured to determine a second offset position of the second target media data relative to the second format media file from the second format media file; and a preset file index information determination unit, configured to construct the preset file index information by mapping the first offset position and the second offset position pointing to the same target media data.
[0114] In an optional scheme of the embodiment of the present disclosure, the first offset position determining unit is optionally configured to interleave and sort the deleted first target media data according to the media type of the first target media data based on the size of the deleted first target media data in the first format media file; and record the first offset position of each interleaved and sorted first target media data relative to the first format media file before deletion and the media type of the first target media data, wherein at least two adjacent first target media data that have been interleaved and sorted have different media types.
[0115] In an optional solution of the embodiment of the present disclosure, the second offset position determining unit is optionally configured to, when the current first target media data that has been deleted in the first format media file is the first target media data, search for the first target media data from the second target media data of the second format media file based on the media type of the current first target media data, and determine the first target media data to be the same as the current first target media data, the searched first target media data having the same media type as the current first target media data; and determine a second offset position of the second target media data relative to the second format media file.
[0116] In an optional solution of the embodiment of the present disclosure, the second offset position determining unit is optionally configured to, when the current first target media data deleted in the first format media file is not the first target media data, determine a previous offset position and a current offset position, and determine the size of the previous first target media data based on the previous offset position and the current offset position; the current offset position being the first offset position of the current first target media data deleted in the first format media file relative to the first format media file before deletion, and the previous offset position being the first offset position of the previous target media data preceding the current first target media data deleted in the first format media file relative to the first format media file before deletion; searching the second format media file for second target media data identical to the current first target media data based on the size of the previous first target media data, a media type of the current first target media data, and a reference offset position; and determining a second offset position of the second target media data identical to the current first target media data relative to the second format media file; wherein the reference offset position is the second offset position of the second target media data identical to the previous first target media data in the second format media file relative to the second format media file.
[0117] In an optional solution of the embodiment of the present disclosure, the media data generation module 330 optionally includes a pre-reserved file header data reading unit, which is used to read the pre-reserved file header data from the first format media file when accessing the first format media file, and the pre-reserved file header data records the first offset information; a first offset information determination unit, which is used to read the first offset information required for the deleted first target media data from the pre-reserved file header data; and a media data regeneration unit, which is used to regenerate the first format media file using the second target media data in the second format media file based on the first offset information required for the deleted first target media data and the preset file index information.
[0118] In an optional solution of the embodiment of the present disclosure, the media data regeneration unit is optionally configured to match the first offset information required by the deleted first target media data with the preset file index information to obtain an offset information matching result, wherein the offset information matching result includes second offset information associated with a mapping of the first offset information required by the deleted first target media data; and read media data at a corresponding offset position from the second target media data of the second format media file based on the offset information matching result, and add the read media data to the first format media file to reassemble and generate the first format media file.
[0119] The media file generation device provided in the embodiments of the present disclosure can execute the media file generation method provided in any embodiment of the present disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0120] It is worth noting that the various units and modules included in the above-mentioned device are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the protection scope of the embodiments of the present disclosure.
[0121] FIG4 is a schematic diagram of the structure of an electronic device provided by an embodiment of the present disclosure. Referring to FIG4 , a schematic diagram of the structure of an electronic device (such as a terminal device or server in FIG4 ) 500 suitable for implementing an embodiment of the present disclosure is shown below. The terminal device in the embodiment of the present disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptop computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. The electronic device shown in FIG4 is merely an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
[0122] As shown in FIG4 , the electronic device 500 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 501, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 502 or a program loaded from a storage device 508 into a random access memory (RAM) 503. Various programs and data required for the operation of the electronic device 500 are also stored in the RAM 503. The processing device 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. An edit / output (I / O) interface 505 is also connected to the bus 504.
[0123] Typically, the following devices may be connected to the I / O interface 505: an input device 506 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 507 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 508 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 509. The communication device 509 may allow the electronic device 500 to communicate with other devices wirelessly or by wire to exchange data. Although FIG4 shows the electronic device 500 with various devices, it should be understood that not all of the devices shown are required to be implemented or present. More or fewer devices may alternatively be implemented or present.
[0124] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication device 509, or installed from the storage device 508, or installed from the ROM 502. When the computer program is executed by the processing device 501, the above-mentioned functions defined in the method of the embodiment of the present disclosure are performed.
[0125] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0126] The electronic device provided by the embodiment of the present disclosure and the media file generation method provided by the above embodiment belong to the same inventive concept. For technical details not fully described in this embodiment, please refer to the above embodiment, and this embodiment has the same beneficial effects as the above embodiment.
[0127] An embodiment of the present disclosure provides a computer storage medium having a computer program stored thereon. When the program is executed by a processor, the media file generation method provided in the above embodiment is implemented.
[0128] It should be noted that the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the two. A computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or component, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, device, or component. In the present disclosure, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, which carries computer-readable program code. Such a propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium that can transmit, propagate, or transport a program for use by or in conjunction with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to wires, optical cables, RF (radio frequency), etc., or any suitable combination thereof.
[0129] In some embodiments, the client and server can communicate using any currently known or later developed network protocol, such as HTTP (HyperText Transfer Protocol), and can be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or later developed network.
[0130] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0131] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device is caused to: determine a media file in a first format and a media file in a second format, where the media file in the first format is obtained by converting the media file in the second format into a preset encapsulation format;
[0132] determining preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0133] The first format media file is regenerated using the second target media data in the second format media file according to the preset file index information.
[0134] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, or a combination thereof, including, but not limited to, object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In cases involving a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram can represent a module, program segment, or a part of code, and the module, program segment, or a part of code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order than that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0136] The units involved in the embodiments described in this disclosure may be implemented in software or hardware. In some cases, the name of a unit does not limit the unit itself. For example, the first acquisition unit may also be described as a "unit for acquiring at least two Internet Protocol addresses."
[0137] The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, and without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chip (SOCs), complex programmable logic devices (CPLDs), and the like.
[0138] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0139] According to one or more embodiments of the present disclosure, Example 1 provides a method for generating a media file, the method comprising: determining a first format media file and a second format media file, the first format media file being obtained by converting the second format media file into a preset encapsulation format;
[0140] determining preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0141] The first format media file is regenerated using the second target media data in the second format media file according to the preset file index information.
[0142] Example 2: According to the method of Example 1, the first format media file is generated by:
[0143] performing encapsulation format conversion on the second-format media file to obtain a reference media file, and deleting the first target media data in the reference media file;
[0144] Obtaining the preset file index information by parsing metadata information in the reference media file, wherein the metadata information includes preset description information of all media data in the reference media file;
[0145] The preset file index information is added to the reference media file from which the first target media data has been deleted, to obtain the first format media file.
[0146] Example 3: According to the method of Example 1, determining a media file in a first format and a media file in a second format includes:
[0147] receiving a media data packet, wherein the media data packet includes media files in different encapsulation formats;
[0148] In response to an access request for a media file in a first format, parsing the received media data packet to obtain the associated stored media file in the first format and the media file in the second format;
[0149] The second target media data having the same data content as the first target media data is not deleted from the second format media file, and the audio and video encoding parameters used in the first format media file and the second format media file are the same.
[0150] Example 4 According to the method described in Example 1, the preset file index information includes a mapping correspondence between first offset information and second offset information, the first offset information describes a first offset position of the first target media data relative to the first format media file before deletion, and the second offset information describes a second offset position of the second target media data relative to the second format media file.
[0151] Example 5 According to the method described in Example 4, the preset file index information also includes media type information, which describes the media type of the same target media data corresponding to the mapping of the first offset information to the second offset information, and the media type information is represented by a numerical value.
[0152] Example 6: According to the method of Example 4, the preset file index information is generated in the following manner:
[0153] Determining a first offset position of the first target media data relative to the first format media file before deletion;
[0154] Determining a second offset position of the second target media data relative to the second format media file from the second format media file;
[0155] The preset file index information is constructed by mapping the first offset position and the second offset position pointing to the same target media data.
[0156] Example 7: According to the method of Example 6, determining a first offset position of the first target media data relative to the first format media file before deletion includes:
[0157] interleaving and sorting the deleted first target media data according to the media type of the first target media data based on the size of the deleted first target media data in the first format media file;
[0158] The first offset position of each interleaved first target media data relative to the first format media file and the media type of the first target media data before deletion are recorded, and the media types of at least two adjacent first target media data that have been interleaved are different.
[0159] Example 8: According to the method of Example 6, determining a second offset position of the second target media data relative to the second format media file from the second format media file includes:
[0160] When the deleted current first target media data in the first format media file is the first target media data, searching for the first target media data from the second target media data in the second format media file based on the media type of the current first target media data, and determining that the first target media data is the same as the current first target media data, wherein the searched first target media data has the same media type as the current first target media data;
[0161] A second offset position of the second target media data relative to the second format media file is determined.
[0162] Example 9: According to the method of Example 6, determining a second offset position of the second target media data relative to the second format media file from the second format media file includes:
[0163] When the deleted current first target media data in the first format media file is not the first target media data, determining a previous offset position and a current offset position, and determining the size of the previous first target media data based on the previous offset position and the current offset position; the current offset position is the first offset position of the deleted current first target media data in the first format media file relative to the first format media file before deletion, and the previous offset position is the first offset position of the previous target media data preceding the deleted current first target media data in the first format media file relative to the first format media file before deletion;
[0164] searching, from the media file in the second format, for second target media data identical to the current first target media data based on the size of the previous first target media data, the media type of the current first target media data, and a reference offset position; and determining a second offset position of the second target media data identical to the current first target media data relative to the media file in the second format;
[0165] The reference offset position is a second offset position of the second target media data in the second format media file that is identical to the previous first target media data relative to the second format media file.
[0166] Example 10: According to the method of Example 4, regenerating the media file in the first format using the second target media data in the media file in the second format according to preset file index information includes:
[0167] When accessing the first format media file, read pre-reserved file header data from the first format media file, wherein the pre-reserved file header data records the first offset information;
[0168] Reading first offset information required for the deleted first target media data from the pre-reserved file header data;
[0169] The first format media file is regenerated using the second target media data in the second format media file according to the first offset information required by the deleted first target media data and the preset file index information.
[0170] Example 11: According to the method of Example 10, regenerating the first-format media file using the second target media data in the second-format media file based on the first offset information required by the deleted first target media data and the preset file index information, including:
[0171] Matching the first offset information required by the deleted first target media data with the preset file index information to obtain an offset information matching result, the offset information matching result including second offset information associated with a mapping of the first offset information required by the deleted first target media data;
[0172] The media data at the corresponding offset position is read from the second target media data in the second format media file according to the offset information matching result, and the read media data is added to the first format media file to reassemble and generate the first format media file.
[0173] According to one or more embodiments of the present disclosure, Example 12 further provides a media file generation device, the media file generation device including:
[0174] a media file determination module, configured to determine a first-format media file and a second-format media file, wherein the first-format media file is obtained by converting the second-format media file into a preset encapsulation format;
[0175] a preset file index information determining module, configured to determine preset file index information from a first-format media file, the preset file index information recording a mapping relationship between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data;
[0176] The media data generating module is configured to regenerate the media file in the first format by using the second target media data in the media file in the second format according to preset file index information.
[0177] According to one or more embodiments of the present disclosure, Example 13 further provides an electronic device, the electronic device including:
[0178] one or more processors;
[0179] a storage device for storing one or more programs,
[0180] When the one or more programs are executed by the one or more processors, the one or more processors implement the media file generation method as described in any one of Examples 1-11.
[0181] According to one or more embodiments of the present disclosure, Example 14 further provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform the media file generation method as described in any one of Examples 1-11.
[0182] The above description is merely a preferred embodiment of the present disclosure and an illustration of the technical principles employed. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by the specific combination of the above-mentioned technical features, but also includes other technical solutions formed by any combination of the above-mentioned technical features or their equivalents without departing from the above-mentioned disclosed concepts. For example, a technical solution formed by replacing the above-mentioned features with (but not limited to) technical features with similar functions disclosed in this disclosure.
[0183] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details have been included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0184] Although the subject matter has been described in language specific to structural features and / or methodological logical acts, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are merely example forms of implementing the claims.
Claims
1. A method for generating a media file, characterized in that: include: Determining a first format media file and a second format media file, where the first format media file is obtained by converting the second format media file into a preset encapsulation format; Determine preset file index information from a first-format media file, the preset file index information recording a mapping correspondence between first target media data and second target media data, the first target media data including target media data deleted from the first-format media file, and the second target media data including target media data in the second-format media file having the same data content as the first target media data; The first format media file is regenerated using the second target media data in the second format media file according to the preset file index information.
2. The method according to claim 1, characterized in that The first format media file is generated by: Performing encapsulation format conversion on the second-format media file to obtain a reference media file, and deleting the first target media data in the reference media file; The preset file index information is obtained by parsing metadata information in the reference media file, wherein the metadata information includes preset description information of all media data in the reference media file; The preset file index information is added to the reference media file from which the first target media data has been deleted, to obtain the first format media file.
3. The method according to claim 1, characterized in that Determining a first format media file and a second format media file includes: Receiving a media data packet, wherein the media data packet includes media files in different encapsulation formats; In response to an access request to a media file in a first format, the received media data packet is parsed to obtain the relevant Concatenating the stored first format media file and the second format media file; The second target media data having the same data content as the first target media data is not deleted from the second format media file, and the audio and video encoding parameters used in the first format media file and the second format media file are the same.
4. The method according to claim 1, characterized in that: The preset file index information includes a mapping correspondence between first offset information and second offset information, wherein the first offset information describes a first offset position of the first target media data relative to the first format media file before deletion, and the second offset information describes a second offset position of the second target media data relative to the second format media file.
5. The method according to claim 4, characterized in that The preset file index information also includes media type information, which describes the media type of the same target media data corresponding to the mapping from the first offset information to the second offset information, and the media type information is represented by a numerical value.
6. The method according to claim 4, characterized in that The preset file index information is generated in the following manner: Determining a first offset position of the first target media data relative to the first format media file before deletion; Determine, from the media file in the second format, a second offset position of the second target media data relative to the media file in the second format; The preset file index information is constructed by mapping the first offset position and the second offset position pointing to the same target media data.
7. The method according to claim 6, characterized in that Determining a first offset position of the first target media data relative to the first format media file before deletion includes: According to the size of each first target media data deleted in the first format media file, interleaving and sorting each deleted first target media data according to the media type of the first target media data; The first offset position of each interleaved first target media data relative to the first format media file and the media type of the first target media data before deletion are recorded, and the media types of at least two adjacent first target media data that are interleaved are different.
8. The method according to claim 6, characterized in that Determining a second offset position of the second target media data relative to the second format media file from the second format media file includes: When the deleted current first target media data in the first format media file is the first target media data, searching for the first target media data from the second target media data in the second format media file according to the media type of the current first target media data, and determining the first target media data to be the same as the current first target media data, wherein the searched first target media data has the same media type as the current first target media data; A second offset position of the second target media data relative to the second format media file is determined.
9. The method according to claim 6, characterized in that Determining a second offset position of the second target media data relative to the second format media file from the second format media file includes: When the current first target media data deleted in the first format media file is not the first target media data, determining a previous offset position and a current offset position, and determining the size of the previous first target media data according to the previous offset position and the current offset position; the current offset position is the first offset position of the current first target media data deleted in the first format media file relative to the first format media file before being deleted, and the previous offset position is the first offset position of the previous target media data before the current first target media data deleted in the first format media file relative to the first format media file before being deleted; Searching the second format media file for second target media data identical to the current first target media data according to the size of the previous first target media data, the media type of the current first target media data, and a reference offset position; and determining a second offset position of the second format media file relative to the second format media file for the second target media data identical to the current first target media data; The reference offset position is a second offset position of the second target media data in the second format media file that is the same as the previous first target media data relative to the second format media file.
10. The method according to claim 4, characterized in that Regenerating the first format media file using the second target media data in the second format media file according to the preset file index information, including: When accessing the first format media file, read the pre-reserved file header data from the first format media file, wherein the pre-reserved file header data records the first offset information; Reading first offset information required for the deleted first target media data from the pre-reserved file header data; The first format media file is regenerated using the second target media data in the second format media file according to the first offset information required by the deleted first target media data and the preset file index information.
11. The method according to claim 10, characterized in that Regenerating the first format media file using the second target media data in the second format media file according to the first offset information required by the deleted first target media data and the preset file index information, including: Matching the first offset information required by the deleted first target media data with the preset file index information to obtain an offset information matching result, wherein the offset information matching result includes second offset information associated with the mapping of the first offset information required by the deleted first target media data; The media data at the corresponding offset position is read from the second target media data of the second format media file according to the offset information matching result, and the read media data is added to the first format media file to reassemble and generate the first format media file.
12. A media file generating device, characterized in that: include: A media file determination module is used to determine a first format media file and a second format media file. The first format media file is obtained by converting the second format media file into a preset encapsulation format; a preset file index information determination module, configured to determine preset file index information from a first format media file, the preset file index information recording a mapping correspondence between first target media data and second target media data, the first target media data comprising target media data deleted from the first format media file, and the second target media data comprising target media data in the second format media file having the same data content as the first target media data; The media data generation module is used to regenerate the first format media file by using the second target media data in the second format media file according to preset file index information.
13. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the media file generation method as described in any one of claims 1-11.
14. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the media file generation method according to any one of claims 1 to 11 when executed by a computer processor.
Citation Information
Patent Citations
Media file storage format and adaptive delivery system
CN102740159A
Multimedia file storage and reading method
CN112287127A
Media file generation method and device, electronic equipment and storage medium
CN116304122A
Format-independent media file indexing
US20180295184A1
Methods and devices for improving storage and transmission of uncompressed data while using a standard format
US20220337922A1
