Media resource processing method and device, storage medium and electronic equipment

By performing frame processing and index storage of frame difference information on media resources, the problem of low storage efficiency of media resources is solved, and efficient storage and version management is achieved.

CN120264034APending Publication Date: 2025-07-04HUNAN HAPPLY SUNSHINE INTERACTIVE ENTERTAINMENT MEDIA CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510358492.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-24
Publication Date
2025-07-04

AI Technical Summary

Technical Problem

In the prior art, the storage efficiency of media resources is low, especially in the case of numerous media resources versions, the storage cost increases significantly.

Method used

By performing frame-based processing of media resources, the timestamp and hash value of each frame are obtained, the addition and deletion changes at the frame level are identified, and the index file for frame difference information is created, and the difference information is stored only, rather than the complete new version.

Benefits of technology

Improve the storage efficiency of media resources, save storage space, and realize efficient version management and backtracking.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120264034A_ABST
    Figure CN120264034A_ABST
Patent Text Reader

Abstract

The invention discloses a media resource processing method and device, a storage medium and electronic equipment. The method comprises the following steps: acquiring a first media resource and a second media resource to be stored; respectively carrying out framing processing on the first media resource and the second media resource to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource; determining first frame difference information between the second media frame set and the first media frame set according to the difference between the second media frame and the first media frame in timestamp and hash value; and creating a first index file corresponding to the first frame difference information, and storing the second media resource and the first index file, the first index file being used for backtracking based on the second media resource to obtain the first media resource. The technical problem that the storage efficiency of media resources is low is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computers, and in particular, to a method and apparatus for processing media resources, a storage medium, and an electronic device. Background Art

[0002] In the current technology, each time a media resource is modified (such as editing, clipping, etc.), a complete new version is generated for storage. This not only occupies a large amount of storage space, but also the storage cost is particularly significant when there are many versions of the media resource.

[0003] Therefore, there is a technical problem of low storage efficiency of media resources in the related technology. Summary of the Invention

[0004] Embodiments of the present application provide a method and apparatus for processing media resources, a storage medium, and an electronic device, so as to at least solve the technical problem of low storage efficiency of media resources in the related technology.

[0005] According to one aspect of the embodiments of the present application, a method for processing media resources is provided, including: obtaining a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by correcting the first media resource; respectively performing frame division processing on the first media resource and the second media resource to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value; determining first frame difference information between the second media frame set and the first media frame set according to the differences between the second media frame and the first media frame in terms of timestamp and hash value; creating a first index file corresponding to the first frame difference information, and storing the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0006] According to another aspect of the embodiments of the present application, there is also provided an apparatus for processing media resources, including: an acquisition unit configured to acquire a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by correcting the first media resource; a frame division unit configured to perform frame division processing on the first media resource and the second media resource respectively to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value; a determination unit configured to determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frames and the first media frames; a storage unit configured to create a first index file corresponding to the first frame difference information and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0007] According to yet another aspect of the embodiments of the present application, there is provided a computer program product, which includes computer programs / instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer programs / instructions from the computer-readable storage medium, and the processor executes the computer programs / instructions, so that the computer device executes the media resource processing method as described above.

[0008] According to yet another aspect of the embodiments of the present application, there is also provided an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the above-mentioned processor executes the above-mentioned media resource processing method through the computer program.

[0009] In this embodiment, by comparing and storing the first frame difference information of the second media resource relative to the first media resource instead of the complete new version, and after storage, the first media resource can be traced back based on the latest second media resource according to the first frame difference information. In this way, while saving storage space, it also achieves the effect of directly storing the second media resource and indirectly storing the first media resource, thereby realizing the technical effect of improving the storage efficiency of media resources and solving the technical problem of low storage efficiency of media resources in the related art. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments and descriptions thereof of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the drawings:

[0011] Figure 1It is a schematic diagram of the process of an optional method for processing media resources according to an embodiment of the present application;

[0012] Figure 2 It is a schematic diagram of an optional initialization process according to an embodiment of the present application;

[0013] Figure 3 It is a schematic diagram of an optional process for frame-by-frame difference comparison and changed segment extraction according to an embodiment of the present application;

[0014] Figure 4 It is a schematic diagram of an optional process for merging multi-version videos according to an embodiment of the present application;

[0015] Figure 5 It is a schematic diagram of an optional process for backtracking historical versions according to an embodiment of the present application;

[0016] Figure 6 It is a schematic diagram of an optional device for processing media resources according to an embodiment of the present application;

[0017] Figure 7 A schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. Detailed implementation manners

[0018] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

[0019] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above drawings are used to distinguish similar objects, and do not necessarily need to describe a specific order or sequence. It should be understood that such used data can be interchanged under appropriate circumstances so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0020] Optionally, as an optional implementation manner, as Figure 1 shown, the method for processing media resources specifically includes the following steps:

[0021] S102, Obtain a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by performing a first media resource correction on the first media resource;

[0022] S104, Perform frame splitting on the first media resource and the second media resource respectively to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value;

[0023] S106, Determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frame and the first media frame;

[0024] S108, Create a first index file corresponding to the first frame difference information, and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0025] Optionally, in this embodiment, the first media resource may but is not limited to an original media file, and the second media resource is a new version media file generated after performing certain corrections (such as editing, clipping, adding or deleting operations, etc.) on the first media resource. For example, in the field of video editing, the original video is the first media resource, and the edited video is the second media resource.

[0026] Optionally, in this embodiment, the media frame set refers to a set composed of each frame of a media resource (video), where each frame contains image information. Through the frame splitting technology, the media resource can be decomposed into a series of consecutive frame images. For example, using the FFmpeg tool, a video can be decomposed into a series of frame image files, such as frame_0001.png, frame_0002.png, etc.

[0027] Optionally, in this embodiment, the hash value is a unique identifier calculated by a hash algorithm (such as SHA-256) for the image data of each frame, and is used to quickly compare whether the frame content has changed. The timestamp is the accurate time position of a frame in the video, and is used to locate and intercept video segments. For example, for the frame "frame_0001.png", its hash value may be "abc123...", and the timestamp is 0.0417 seconds.

[0028] Optionally, in this embodiment, two versions of media resources to be stored are obtained, namely the first media resource (original video) and the second media resource (edited video). Subsequently, frame splitting is performed on these two versions respectively to generate corresponding media frame sets, where each frame is associated with a specific timestamp and hash value. The timestamp ensures the position of the frame in the video, while the hash value serves as the unique identifier of the frame content for quickly detecting whether the frame has changed.

[0029] Next, the media frame sets of the two versions are compared, and the frame difference information between the second media frame set and the first media frame set is determined through the differences in timestamps and hash values. This step ensures that the addition and deletion changes at the frame level can be accurately identified, providing an accurate data basis for storage and version backtracking. For example, if frames with timestamps between 5 seconds and 10 seconds are deleted in the edited version compared to the original version, and frames with timestamps between 15 seconds and 20 seconds are added, this information will be recorded.

[0030] Finally, based on the determined first frame difference information, a first index file is created, which details the frame difference information, including the specific timestamps and hash values of the added frames, deleted frames, and frames with content changes. Then, the second media resource (edited video) and the first index file are stored together. This storage method significantly reduces the storage space occupied because there is no need to store the complete new version, only the actually changed parts and the difference information need to be saved. By retaining the first index file, it is possible to quickly backtrack to the first media resource (original video) based on the index information to restore the historical version, achieving efficient version management.

[0031] In the embodiment provided by the present application, by comparing and storing the first frame difference information of the second media resource relative to the first media resource instead of the complete new version, and after storage, the first media resource can be backtracked based on the first frame difference information from the latest second media resource. In this way, while saving storage space, it also achieves the effect of directly storing the second media resource and indirectly storing the first media resource, thereby realizing the technical effect of improving the storage efficiency of media resources and solving the technical problem of low storage efficiency of media resources in the related art.

[0032] As an alternative solution, based on the differences in timestamps and hash values between the first media frames and the second media frames, the first frame difference information between the first media frame set and the second media frame set is determined, including:

[0033] Obtain at least one deleted media frame from the first media frame set that meets the first expected condition, where the first expected condition is used to indicate that the hash value of at least one deleted media frame is different from the hash value of any second media frame in the second media frame set or the timestamp of at least one deleted media frame is different from the timestamp of any second media frame in the second media frame set;

[0034] Obtain at least one added media frame from the second media frame set that meets the second expected condition, where the second expected condition is used to indicate that the hash value of at least one added media frame is different from the hash value of any first media frame in the first media frame set or the timestamp of at least one added media frame is different from the timestamp of any first media frame in the first media frame set;

[0035] Determine at least one deleted media frame and at least one added media frame as the first frame difference information.

[0036] Optionally, in this embodiment, the first expected condition is used to identify those frames for which no corresponding hash value or timestamp can be found in the second media frame set, indicating that these frames have been deleted or modified; the second expected condition is used to identify those frames for which no corresponding hash value or timestamp can be found in the first media frame set, indicating that these frames are newly added.

[0037] Optionally, in this embodiment, a deleted media frame refers to a frame that does not exist in the second media frame set but exists in the first media frame set, meaning a video frame that has been deleted from the first media resource to the second media resource. An added media frame is the opposite, referring to a frame that exists in the second media frame set but does not exist in the first media frame set, meaning a video frame newly added based on the first media resource.

[0038] Optionally, in this embodiment, for two versions of media resources, namely the original video (the first media resource) and the edited video (the second media resource), first generate corresponding media frame sets through frame segmentation technology, with each frame associated with a specific timestamp and hash value. Subsequently, by comparing the timestamps and hash values, the first frame difference information, that is, the specific frame-level changes between the two versions, is determined.

[0039] Specifically in implementation, obtain the deleted media frames that meet the first expected condition from the first media frame set, which means that all those frames for which no corresponding hash value or timestamp can be found in the second media frame set will be recorded. Similarly, obtain the added media frames that meet the second expected condition from the second media frame set, that is, the frames for which no corresponding hash value or timestamp can be found in the first media frame set. In this way, it is possible to accurately identify which frames have been deleted, which frames have been newly added, and which frames have had their content changed.

[0040] Through the embodiments provided by this application, by comparing timestamps and hash values, it is possible to accurately identify whether each frame has changed, whether it is deleted, added, or the content is modified. This precise identification provides crucial information for version management. Since only the frames that actually change (deleted media frames and added media frames), as well as the index file containing difference information, need to be stored, storage space is saved, and the redundant costs caused by full storage of each version in traditional version control are avoided.

[0041] As an alternative solution, creating the first index file corresponding to the first frame difference information includes:

[0042] Create at least one first index sub-file corresponding to the deleted media frames, where the first index sub-file is used to indicate the first local media resource deleted based on the first media resource during the correction process of the first media resource;

[0043] Create at least one second index sub-file corresponding to the added media frames, where the second index sub-file is used to indicate the second local media resource added based on the first media resource during the correction process of the first media resource;

[0044] After storing the second media resource and the first index file, the method further includes:

[0045] In response to a resource acquisition request for requesting to obtain the first media resource, respectively identify the first index sub-file and the second index sub-file to obtain the first local media resource and the second local media resource;

[0046] Perform an addition operation on the second media resource for the first local media resource and a deletion operation on the second local media resource to obtain the first media resource.

[0047] Optionally, in this embodiment, the first index sub-file records information about the first local media resource (usually a video segment) deleted during the editing process, while the second index sub-file records information about the second local media resource added. These files contain key information such as the timestamp range and hash value of the deletion and addition operations, which are used for subsequent version backtracking and management.

[0048] Optionally, in this embodiment, the first local media resource refers to the video segment deleted during the correction of the media resource (i.e., video editing), and the second local media resource refers to the video segment added during the editing process. These local media resources are the main part of the version difference of the media resource.

[0049] Optionally, in this embodiment, a first index file is created to generally record the frame differences between two versions, and the structure of the index is further refined by creating a first index sub-file and a second index sub-file to specifically record deletion and addition operations.

[0050] It can be understood that the above operations can more accurately and efficiently restore the content of the original version during the subsequent version rollback process, avoiding the inefficiency and storage cost problems of the traditional full-volume rollback method.

[0051] It should be noted that once the deleted and added media frames during the editing process are determined, two index sub-files will be created to respectively indicate the deleted and newly added local media resources. After storing the edited second media resource and the complete index file, when the user initiates a resource acquisition request and hopes to obtain the first media resource of the original version, the first index sub-file and the second index sub-file will be automatically recognized and parsed. According to the identified first local media resource (deleted segment) and the second local media resource (added segment), corresponding addition and deletion operations will be performed on the stored second media resource to restore the original state of the first media resource. This automatic recovery mechanism based on index sub-files realizes an efficient and accurate historical version rollback.

[0052] Through the embodiment provided by this application, by creating a first index sub-file and a second index sub-file to respectively record the information of the deleted and added local media resources, a more refined version control mechanism is realized. This enables version management not only to be limited to file-level changes, but also to be able to delve into the addition and deletion changes of local media content, greatly improving the efficiency and accuracy of version management.

[0053] As an alternative solution, after creating the index file corresponding to the frame difference information and storing the second media resource and the index file, the method further includes:

[0054] Obtain a third media resource to be stored, where the third media resource is a media resource obtained by correcting the second media resource;

[0055] Perform frame splitting on the third media resource to obtain a third media frame set corresponding to the third media resource, where each third media frame in the third media frame set corresponds to a timestamp and a hash value;

[0056] Determine the second frame difference information between the third media frame set and the second media frame set according to the differences in timestamp and hash value between the third media frame and the second media frame;

[0057] Create a second index file corresponding to the second frame difference information, cancel the storage of the second media resource, and on the basis of storing the first index file, store the third media resource and the second index file, where the second index file is used to trace back to the second media resource based on the third media resource.

[0058] Optionally, in this embodiment, the third media resource refers to a new version of the media resource obtained by further correcting or editing on the basis of the second media resource (i.e., the editing result of the previous version).

[0059] Optionally, in this embodiment, the second media resource correction refers to an editing operation performed on the second media resource (i.e., the current version of the video), such as adding or deleting frames, color correction, audio processing, etc., thereby generating the third media resource.

[0060] Optionally, in this embodiment, the second frame difference information and the second index file are frame-level difference information determined according to the timestamp and hash value of the frame, and the file recording these information, which is used when tracing back from the third media resource to the second media resource.

[0061] Optionally, in this embodiment, it is not limited to processing the differences between two versions, but can be continuously applied to the control of media resources of multiple versions. After creating and storing the second media resource and its corresponding frame difference information (i.e., the first index file), if the second media resource is further edited into the third media resource, the above process will be repeated, the third media resource will be frame-processed to generate a third media frame set, and the second frame difference information will be determined by comparing the timestamp and hash value. Subsequently, a second index file is created to save the frame-level change information from the second media resource to the third media resource.

[0062] It should be noted that in terms of storage optimization, this embodiment can but is not limited to adopting an intelligent storage strategy, that is, after generating a new version, cancel the storage of the previous version (i.e., the second media resource), and only retain the current version (i.e., the third media resource) and the necessary index files. This means that during the continuous process of version control, the stored content will be continuously updated according to the latest version information, avoiding the repeated storage of the entire video file and greatly saving storage space.

[0063] Through the embodiments provided by this application, by continuously performing frame processing and difference information recording on the new version of the media resource, a dynamic version control mechanism is provided, which can adapt to changing editing requirements, and at the same time continuously optimize the storage strategy, reduce redundant storage, and reduce the long-term storage cost. By canceling the storage of the previous version of the media resource and only retaining the current version and the necessary index files, the present invention achieves significant cost savings in storage management.

[0064] As an alternative, after storing the third media resource and the second index file, the method further includes:

[0065] In response to a resource acquisition request for requesting to obtain a first media resource, identifying the second index file to obtain a first media corrected resource;

[0066] Performing a correction operation of the first media corrected resource on the third media resource to obtain a second media resource;

[0067] Identifying the first index file to obtain a second media corrected resource;

[0068] Performing a correction operation of the second media corrected resource on the second media resource to obtain the first media resource.

[0069] Optionally, in this embodiment, the first media corrected resource and the second media corrected resource are the content that needs to be restored by performing a correction operation when tracing back to the second media resource and the first media resource. The first media corrected resource includes the first partial media resource that is deleted or modified when generating the third media resource, while the second media corrected resource includes the second partial media resource that is deleted or modified when generating the second media resource.

[0070] Optionally, in this embodiment, the resource acquisition request may but is not limited to a request initiated by a user in a media resource management system for obtaining a media resource of a specific historical version. For example, a user may need to view or restore a certain version of an original video for subsequent editing or analysis.

[0071] It can be understood that when a user initiates a resource acquisition request and hopes to obtain a first media resource of a specific historical version, a tracing mechanism is started. First, identify the second index file, which records the frame-level differences from the second media resource to the third media resource, including which frames are deleted, which frames are added, and which frame content has changed. Based on this information, correct the stored third media resource to restore the second media resource.

[0072] After that, continue to identify the first index file, which records the frame-level changes from the first media resource to the second media resource. Based on the identified second media corrected resource, perform a correction operation on the second media resource to finally accurately restore the first media resource of the original version.

[0073] Through the embodiments provided by this application, by identifying and utilizing the information in a series of index files, it is possible to accurately trace back from any version to the historical version without comparing and restoring each version one by one, greatly improving the efficiency of version tracing. Each round of correction operations will be clearly recorded in the corresponding index file, which not only helps users understand the version history but also provides intuitive evidence for the differences between versions, enhancing the transparency of version management.

[0074] As an alternative solution, after obtaining the first media resource and the second media resource to be stored, the method further includes:

[0075] Obtaining a fourth media resource to be stored, where the second media resource is the media resource obtained by a first operation object after correcting the first media resource, and the fourth media resource is the media resource obtained by a second operation object after correcting the first media resource with a third media resource;

[0076] Performing frame splitting on the fourth media resource to obtain a fourth media frame set corresponding to the fourth media resource, where each fourth media frame in the fourth media frame set corresponds to a timestamp and a hash value;

[0077] Determining third frame difference information between the fourth media frame set and the first media frame set according to the differences in timestamps and hash values between the fourth media frames and the first media frames;

[0078] Obtaining a first distribution interval of the timestamps of the media frames indicated by the first frame difference information, and obtaining a second distribution interval of the timestamps of the media frames indicated by the third frame difference information;

[0079] In the case where there is no overlapping part between the first distribution interval and the second distribution interval, based on the first media resource, performing a merging operation on the first media correction resource corresponding to the first frame difference information and the fourth media correction resource corresponding to the third frame difference information to obtain a fifth media resource;

[0080] Storing the fifth media resource, the first index file corresponding to the first frame difference information, and the third index file corresponding to the third frame difference information, where the first index file is used to trace back to the fourth media resource based on the fifth media resource and to trace back to the first media resource based on the second media resource, and the third index file is used to trace back to the second media resource based on the fifth media resource and to trace back to the first media resource based on the fourth media resource.

[0081] Optionally, in this embodiment, the fourth media resource refers to a new version generated after the second editor (the second operation object) independently edits the original version (the first media resource). The fifth media resource is a new version formed by the system merging the correction resources of the two independently edited versions (the second media resource and the fourth media resource) onto the original version (the first media resource) after determining that there is no conflict between them.

[0082] Optionally, in this embodiment, the first operation object and the second operation object respectively refer to two independent users or editors who edit the first media resource, and their editing operations may be performed in parallel or independently.

[0083] Optionally, in this embodiment, when the fourth media resource generated after the second operation object independently edits the first media resource is received, first, the fourth media resource is frame-divided and hashed to obtain a set of fourth media frames. Subsequently, by comparing the differences between the first media resource and the fourth media resource, the system determines the third frame difference information. To determine whether there is a conflict between the independently edited versions, the distribution intervals of the media frame timestamps indicated by the first frame difference information and the third frame difference information are extracted, that is, the first distribution interval and the second distribution interval.

[0084] If there is no overlapping part between the first distribution interval and the second distribution interval, it means that the modifications of the two edited versions occur in different time ranges and there is no conflict. In this case, a version merging operation will be performed to merge the correction resources of the two independently edited versions (the first media correction resource and the fourth media correction resource) onto the first media resource to generate the fifth media resource, which contains all the modifications of the independently edited versions.

[0085] It should be noted that if there is an overlapping part between the first distribution interval and the second distribution interval, it is possible but not limited to directly merging the non-overlapping parts first, and marking and displaying the overlapping parts for the user to select and manually adjust.

[0086] Through the embodiments provided in this application, after determining that there is no overlap in the frame change time intervals of the two independently edited versions, the correction resources of the two versions can be automatically merged to generate a version that contains all the independent editing results, improving the efficiency of version merging and avoiding the complex process of manually resolving conflicts.

[0087] As an optional solution, frame-dividing the first media resource and the second media resource respectively to obtain the set of first media frames corresponding to the first media resource and the set of second media frames corresponding to the second media resource includes:

[0088] Extract the first media frames of the first media resource and the second media frames of the second media resource at a preset frame rate respectively, generate corresponding first pictures for each extracted first media frame and corresponding second pictures for each extracted second media frame, calculate the hash values of the first pictures and the second pictures respectively, and determine the hash values corresponding to the first media frames and the hash values corresponding to the second media frames.

[0089] Optionally, in this embodiment, the preset frame rate is the frame rate setting used to extract media frames during the frame segmentation process, such as 25 frames per second, to ensure that the extracted frames can represent the content changes of the media resource.

[0090] Optionally, in this embodiment, the first picture and the second picture refer to the picture files generated from the first media frame and the second media frame for hash calculation to determine the unique identifiers of these frames.

[0091] Optionally, in this embodiment, in order to accurately compare the version differences between the first media resource and the second media resource, first perform frame segmentation on the two media resources according to the preset frame rate to ensure that the extracted frames can cover the key change points of the entire video content. These extracted frame images (i.e., the first media frames and the second media frames) are then converted into picture files (i.e., the first pictures and the second pictures) to facilitate subsequent hash value calculation.

[0092] Subsequently, use a hash algorithm (such as SHA-256) to calculate the hash value of each picture file to generate an identifier representing the uniqueness of the frame content. These hash values will be used for subsequent version comparison. By comparing the hash values of each frame in the two versions, it is possible to accurately identify which frames are newly added, which frames are deleted, and which frames have changed in content. This method can not only accurately track the frame-level changes of the video but also improve the efficiency of version comparison and reduce storage requirements, especially when dealing with video content with high-frequency modifications, the advantages are significant.

[0093] Through the embodiments provided in this application, by calculating the hash value for each frame image, it is possible to accurately identify the changes in each frame of the video content. Whether it is an addition or deletion operation or a content modification, it can be clearly recorded, providing accurate data basis for version management and backtracking.

[0094] As an alternative solution, the above method for processing media resources is applied to the scenario of video version addition, deletion management, and backtracking based on frame hashes. In this scenario, with the widespread application of digital video content, the demand for video version management in video editing, content creation, and collaborative production is increasing. Existing video version control technologies, especially in the management of addition and deletion changes at the frame level, have obvious limitations. Existing technologies cannot accurately track frame-level changes in videos, resulting in low version management efficiency, storage waste, and inability to efficiently compare and collaboratively edit.

[0095] To address the above deficiencies, based on the above method for processing media resources, this embodiment provides a method for managing video versions of added and deleted frames based on hash values. By calculating the hash value of each frame, it identifies changes in the video frame content. This method can effectively track the changes in added and deleted frames of the video, save storage space, improve version management efficiency, and make video content changes more transparent and traceable.

[0096] Optionally, in the initialization phase, it includes the extraction of video meta-information, frame splitting of the video, hash calculation of frames, and generation of an index file. This phase lays the foundation for subsequent video version control and management. The specific steps are as Figure 2 shown and include:

[0097] S202, Use FFprobe to extract video meta-information;

[0098] S204, Calculate the timestamp of each frame;

[0099] S206, Use FFmpeg to extract video frames into picture files;

[0100] S208, Use the SHA-256 algorithm to calculate the hash value of each frame picture;

[0101] S210, Generate an index file.

[0102] Optionally, in this embodiment, by using the FFprobe tool to extract the basic information of the video, including the base time (base_time), the number of frames (nb_frames), etc. FFprobe is used to extract various metadata from video files and can provide the necessary parameters for subsequent frame splitting and timestamp calculation. Among them, the base time (base_time) is the starting time in the video file (usually 0 seconds); the number of frames is (nb_frames): all the frames in the video file.

[0103] After extraction, the above information provides the necessary parameters for the initialization processing of the video, especially the number of frames and the base time, which helps to assign timestamps to each frame in subsequent processing.

[0104] After obtaining the number of frames and the reference time of the video, the next step is to perform frame segmentation on the video. A corresponding timestamp needs to be generated for each frame. To decompose the video into individual frames and assign timestamps to each frame, the timestamp for each frame can be calculated using the following formula:

[0105] 〖"timestamp"〗_n = n / "fps"

[0106] Where 〖"timestamp"〗_n is the timestamp of the nth frame, n is the frame number of this frame (ranging from 1 to the total number of frames nb_frames), and fps is the frame rate of the video (obtained through FFprobe).

[0107] Use FFmpeg to extract each frame in the video and save it as an independent image file. Through this operation, corresponding image files can be generated for each frame, and these image files will be used for subsequent hash calculations.

[0108] For example, the FFmpeg command can be as follows:

[0109] ffmpeg -i input_video.mp4 -vf "fps=23.98" frame_%04d.png.

[0110] Where iinput_video.mp4 indicates the input video file, vf "fps=23.98" indicates a frame rate of 23.98 fps, and frame_%04d.png indicates the output frame image file name, which is saved in sequence as frame_0001.png, frame_0002.png, etc.

[0111] Through this command, all frames will be extracted as picture files and are ready for hash value calculation.

[0112] For the image files generated for each frame, the hash value can be calculated using, but not limited to, the SHA-256 algorithm to ensure that each frame has a unique identifier. For example, the calculation method of the hash value is as follows:

[0113] 〖"hash"〗_n = SHA256(〖"frame"〗_n)

[0114] Where 〖"hash"〗_n is the hash value of the nth frame, and 〖"frame"〗_n is the image file of the corresponding frame.

[0115] It can be understood that using the SHA-256 algorithm can generate unique hash values for each frame, ensuring that even if there are minor changes in the video content, the hash values of the frames will change, thus helping to accurately track the frame addition and deletion operations of the video.

[0116] For further illustration, for the command "sha256sum frame_0001.png > frame_0001.hash", the hash value will be calculated and saved for each frame of the image.

[0117] The hash values and timestamps (calculated by formula) of all frames will be saved to an index file for subsequent lookup and management. This index file will record the timestamp, hash value, and frame number of each frame, forming a data table to facilitate subsequent version management, difference comparison, and backtracking operations.

[0118] For example, the sample structure of the index file can be as follows:

[0120] {"frame_number":1,"timestamp":0.0417,"hash":"abc123..."},{"frame_number":2,"timestamp":0.0834,"hash":"def456..."},...]

[0121] By generating this index file, this embodiment can accurately manage the hash value and timestamp of each frame, ensuring the accuracy of video version control.

[0122] Furthermore, after the initialization phase, frame-by-frame difference comparison and change segment interception are performed, mainly for the new version (denoted as V2) generated after video editing. By repeating the initialization process to generate a new version index file and comparing the new and old version index files (I1 and I2), the frame-level addition and deletion differences are accurately calculated, and then the changed video segments are intercepted from the corresponding versions according to the timestamp information. The specific steps are as Figure 3 shown, including:

[0123] S302, Repeat the initialization phase for the edited video V2 to generate the index file I2;

[0124] S304, Compare the index file I2 with the original version index file I1;

[0125] S306-1, Calculate the set of added frames Δ_add;

[0126] S306-2, Calculate the set of deleted frames Δ_del;

[0127] S308-1, Intercept the added operation segment from the video V2 according to the timestamp of Δ_add;

[0128] S308-2, Intercept the deleted operation segment from the video V1 according to the timestamp of Δ_del;

[0129] ​S310-1, generate a video file corresponding to the newly added operation segment, named V1_added_segments_{start_time}-{end_time}.mp4;

[0130] S310-2, generate a video file corresponding to the deleted operation segment, named V1_deleted_segments_{start_time}-{end_time}.mp4;

[0131] Optionally, in this embodiment, extract meta-information. Use FFprobe to extract video meta-information from the edited video V2, such as the base time (base_time), total number of frames (nb_frames), and frame rate (fps).

[0132] Frame processing and timestamp calculation: Perform frame processing on the V2 video, and generate a timestamp for each frame according to the formula 〖"timestamp"〗_n = n / "fps".

[0133] Frame extraction and hash calculation: Use FFmpeg to extract each frame image in V2, and calculate the hash value of each frame using the SHA-256 algorithm to generate a unique frame identifier.

[0134] Index file generation: Save the frame number, timestamp, and its hash value of each frame to the index file I2.

[0135] New frame set: By comparing I1 (original version index) with I2 (new version index), define the new frame set as Indicates the frames that exist in V2 but not in V1.

[0136] Deleted frame set: Similarly, define the deleted frame set as Indicates the frames that exist in V1 but not in V2.

[0137] By comparing only the hash values, the frame-level addition and deletion differences between video versions can be accurately identified.

[0138] Intercept the deleted operation segment: According to the timestamp information recorded in Δ_del, intercept continuous or discrete video segments containing the deleted frames from the original video V1, and generate corresponding video files, named V1_deleted_segments_{start_time}-{end_time}.mp4. The start_time and end_time in the name are the start and end times of the deleted segment respectively, and V1 represents the original version for historical version backtracking.

[0139] Example of the clipping command (assuming the time range of the deleted operation segment is from 00:01:00 to 00:02:00):

[0140] ffmpeg - i input_video_v1.mp4 - ss 00:01:00 - to 00:02:00 - c:v libx264 - c:a aac - strict experimental V1_deleted_segments_00 - 01.mp4。

[0141] Here, the - ss parameter specifies the start time, the - to parameter specifies the end time, - c:v libx264 and - c:a aac specify the encoding formats of the video and audio, and the generated new segment will be re - encoded for subsequent processing.

[0142] Clip the added operation segment: According to the timestamp information recorded in Δ_add, clip the segment video containing the added frames from the edited video V2, generate the corresponding video file, named V2_added_segments_{start_time}-{end_time}.mp4. The start_time and end_time in the name are the start and end times of the added segment respectively, and V2 represents the new version.

[0143] Example of the clipping command (assuming the time range of the added operation segment is from 00:05:00 to 00:06:00):

[0144] ffmpeg - i input_video_v2.mp4 - ss 00:05:00 - to 00:06:00 - c:v libx264 - c:a aac - strict experimental V2_added_segments_00 - 05.mp4。

[0145] Through the above commands, clip the corresponding segments from the new version and the original version, and associate them with the modified version number and time range through naming.

[0146] Optionally, during the video editing process of multi - person collaboration, when the base version V2 is edited to generate two versions V3 and V4 respectively, this embodiment also provides a method to compare the frame - level addition and deletion differences between V3 and V4 relative to V2 by referring to the addition and deletion operations (and their respective index files) generated in the previous stage, and on this basis, complete the version merging to finally generate the unique next version V5, as Figure 4 shown, the steps include:

[0147] S402, reference the add / delete operation segments and index files of video V3 and video V4 (relative to the base version V2);

[0148] S404, pairwise compare each independent operation interval in videos V3 and V4;

[0149] S406, judge whether the operation intervals overlap in pairs;

[0150] S408, automatically merge all operation segments without conflict;

[0151] S410, in case of conflict, mark the conflict area and let the user select a solution;

[0152] S412, use FFmpeg to synthesize all segments to generate video V5.

[0153] Specifically, first extract and reference the add / delete operation segments of V3 and V4. Assume the current base version is V2. To restore the modifications of version V3, the index file of V3 (denoted as I3) and the add / delete operation intercepted segments generated in the previous stage (for example, the files are named V3_added_segments_...mp4 and V3_deleted_segments_...mp4) need to be referenced.

[0154] Similarly, for version V4, reference its index file (denoted as I4) and the corresponding add / delete operation intercepted segments (such as V4_added_segments_...mp4 and V4_deleted_segments_...mp4).

[0155] By comparing the index files of each version with the index file I2 of the base version V2, the add / delete operations and their timestamp intervals of V3 and V4 relative to V2 can be obtained. These operations are usually discontinuous and constitute multiple independent time ranges.

[0156] Furthermore, judge whether the above time ranges conflict. In the case of no conflict, for each individual add / delete operation interval [T3_(k_"start"), T3_(k_"end")] in V3 and each individual add / delete operation interval [T4_(j_"start"), T4_(j_"end")] in V4, if all operation pairs satisfy (T3_(k_"end") < T4_(j_"start")) or (T4_(j_"end") < T3_(k_"start")), it is considered that the modifications of the two versions do not overlap in all intervals, have no conflict, and can be automatically merged.

[0157] In case of conflicts, if there is at least one pair of operation intervals, where an operation [T3_(k_"start"), T3_(k_"end")] in V3 and an operation [T4_(j_"start"), T4_(j_"end")] in V4 satisfy T3_(k_"start") < T4_(j_"end") and T4_(j_"start") < T3_(k_"end"), then this pair of operations is considered to have a conflict. The system will compare all operation intervals in V3 and V4 pairwise, mark all intersection regions, and display the conflict marks in the player for the user to select and manually adjust to resolve the conflicts.

[0158] Optionally, after confirming that there are no conflicts in all add / delete operation intervals of V3 and V4, the change segments of the two versions based on V2 can be directly and automatically merged. For example, assume that the new segments of V3 and V4 have been intercepted respectively.

[0159] For the operation intervals with conflicts, mark the conflict regions in the player and provide a user interface for the user to select to retain the operations of V3 or V4, or make manual adjustments to form the conflict segments after resolution. After all conflict intervals are processed, then merge the conflict segments and non-conflict segments to generate the final V5 version.

[0160] After the above automatic merge or user intervention is completed, the finally generated output video is the new version V5. V5 not only retains the basic content of V2 but also integrates the add / delete frame changes of V3 and V4 for different operation intervals, ensuring the complete integration of the collaborative editing results of multiple people.

[0161] Optionally, it is also possible but not limited to using the frame-level add / delete operation information saved in the history record to implement the operation of rolling back from the current version video to any target historical version. Since only the incremental change segments between video versions are stored, and the target historical version and the current version are not necessarily adjacent, the recovery process must roll back step by step according to the version chain until the specified version is reached. The specific process is as Figure 5 shown, including:

[0162] S502, the user selects the target historical version;

[0163] S504, extract the current version index file I_current and the index file I_target corresponding to the target version;

[0164] S506, determine whether the target version and the current version are adjacent;

[0165] S508, in the case of adjacency, directly calculate the frame-level difference and roll back to the target historical version V_target;

[0166] S510. Determine the version chain when not adjacent.

[0167] S512. For each pair of adjacent versions in the version chain, perform the operations of S512-1 to S512-4 until the judgment in S514 passes.

[0168] S512_1. Calculate the frame-level difference.

[0169] S512_2. Invoke the incremental change segment and perform the rollback operation.

[0170] S512_3. Use FFmpeg to cut and merge to generate the new version V_prev.

[0171] S512_4. Update I_curent = the index file I_prev corresponding to the new version V_prev.

[0172] S514. Determine whether the current version is the target historical version V_target. If so, pass; otherwise, return to step S512.

[0173] S516. In the case of passing, generate the final rollback version file.

[0174] Optionally, in this embodiment, the user selects the target historical version (denoted as V_target) that they hope to roll back to. Retrieve the index file I_target corresponding to the target version and the current version index file I_current (or denoted as I_(V_current)), where each frame records frame number, timestamp, and hash value information.

[0175] Since only the incremental change segments between each version are stored, if there are multiple intermediate versions between V_target and the current version V_current, it is necessary to roll back sequentially: V_current → V_n → … → V_target. Determine each intermediate version that needs to be restored sequentially starting from the current version according to the version chain information until reaching V_target.

[0176] For the current version V_current and its immediate previous version V_prev (or the current version and the next recovery target version), using their respective index files (e.g., I_current and I_prev), calculate the frame-level addition and deletion differences: The set of frames to be deleted: Δ_(rollback-del) = I_current \ I_prev. The set of frames to be recovered: Δ_(rollback-add) = I_prev \ I_current. According to the timestamp information calculated from the differences, call the corresponding incremental change segments saved in the system (e.g., video segments containing add or delete operations) to restore the video content of the current version to the state of V_prev.

[0177] Confirm with the user to display the frame-level differences between the current version and the immediate previous version on the same screen in the player for the user to check and confirm the accuracy of the rollback operation. After the user confirms, use FFmpeg to perform video segment cutting and merging operations on the current version to restore the intermediate version V_prev.

[0178] Example command (assuming the time range to be restored is [T_start, T_end]): After completing one rollback, use the generated new version as the current version and repeat the above steps until the target version V_target is restored.

[0179] When all intermediate versions have been restored in sequence, the finally generated output video is the target historical version after rollback, named for example rollback_Vtarget.mp4. This version contains the reverse merge result of all incremental change operations from the current version gradually rolled back to V_target.

[0180] It can be understood that in the specific implementation manner of this application, data related to user information, etc. is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent needs to be obtained, and the collection, use, and processing of relevant data need to comply with the relevant laws, regulations, and standards of relevant countries and regions.

[0181] It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that this application is not limited by the described action sequence, because according to this application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to this application.

[0182] According to another aspect of the embodiments of this application, there is also provided a media resource processing device for implementing the above media resource processing method. AsFigure 6 As shown in the figure, the device includes:

[0183] An acquisition unit 602, configured to acquire a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by correcting the first media resource;

[0184] A frame division unit 604, configured to perform frame division processing on the first media resource and the second media resource respectively, to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value;

[0185] A determination unit 606, configured to determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frames and the first media frames;

[0186] A storage unit 608, configured to create a first index file corresponding to the first frame difference information, and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0187] As an optional solution, the determination unit 606 includes:

[0188] A first acquisition module, configured to acquire at least one deleted media frame that meets a first expected condition from the first media frame set, where the first expected condition is used to indicate that the hash value of at least one deleted media frame is different from the hash value of any second media frame in the second media frame set or the timestamp of at least one deleted media frame is different from the timestamp of any second media frame in the second media frame set;

[0189] A second acquisition module, configured to acquire at least one added media frame that meets a second expected condition from the second media frame set, where the second expected condition is used to indicate that the hash value of at least one added media frame is different from the hash value of any first media frame in the first media frame set or the timestamp of at least one added media frame is different from the timestamp of any first media frame in the first media frame set;

[0190] A first determination module, configured to determine at least one deleted media frame and at least one added media frame as the first frame difference information.

[0191] As an optional solution, the storage unit 608 includes:

[0192] A first creation module, configured to create at least one first index sub-file corresponding to a deleted media frame, where the first index sub-file is used to indicate a first partial media resource deleted based on a first media resource during the correction process of the first media resource;

[0193] A second creation module, configured to create at least one second index sub-file corresponding to an added media frame, where the second index sub-file is used to indicate a second partial media resource added based on a first media resource during the correction process of the first media resource;

[0194] The apparatus further includes:

[0195] A first identification module, configured to, after storing a second media resource and a first index file, in response to a resource acquisition request for requesting to acquire a first media resource, respectively identify the first index sub-file and the second index sub-file to obtain a first partial media resource and a second partial media resource;

[0196] A first backtracking module, configured to, after storing a second media resource and a first index file, perform an addition operation on the second media resource for the first partial media resource and a deletion operation on the second partial media resource to obtain a first media resource.

[0197] As an optional solution, the apparatus further includes:

[0198] A third acquisition module, configured to, after creating an index file corresponding to frame difference information and storing a second media resource and the index file, acquire a third media resource to be stored, where the third media resource is a media resource obtained by correcting the second media resource for the second media resource;

[0199] A first frame division module, configured to, after creating an index file corresponding to frame difference information and storing a second media resource and the index file, perform frame division on the third media resource to obtain a third media frame set corresponding to the third media resource, where each third media frame in the third media frame set corresponds to a timestamp and a hash value;

[0200] A second determination module, configured to, after creating an index file corresponding to frame difference information and storing a second media resource and the index file, determine second frame difference information between the third media frame set and the second media frame set according to the differences in timestamp and hash value between the third media frame and the second media frame;

[0201] A first storage module, after creating an index file corresponding to the frame difference information and storing the second media resource and the index file, creates a second index file corresponding to the second frame difference information, cancels the storage of the second media resource, and on the basis of storing the first index file, stores the third media resource and the second index file, wherein the second index file is used to backtrack the second media resource based on the third media resource.

[0202] As an optional solution, the apparatus further includes:

[0203] A second recognition module, after storing the third media resource and the second index file, in response to a resource acquisition request for requesting to acquire the first media resource, recognizes the second index file to obtain a first media corrected resource;

[0204] A first correction module, after storing the third media resource and the second index file, performs a correction operation on the third media resource with the first media corrected resource to obtain the second media resource;

[0205] A third recognition module, after storing the third media resource and the second index file, recognizes the first index file to obtain a second media corrected resource;

[0206] A second correction module, after storing the third media resource and the second index file, performs a correction operation on the second media resource with the second media corrected resource to obtain the first media resource.

[0207] As an optional solution, the apparatus further includes:

[0208] A fourth acquisition module, after acquiring the first media resource and the second media resource to be stored, acquires a fourth media resource to be stored, wherein the second media resource is a media resource obtained by a first operation object performing a first media resource correction on the first media resource, and the fourth media resource is a media resource obtained by a second operation object performing a third media resource correction on the first media resource;

[0209] A second frame splitting module, after acquiring the first media resource and the second media resource to be stored, performs frame splitting on the fourth media resource to obtain a fourth media frame set corresponding to the fourth media resource, wherein each fourth media frame in the fourth media frame set corresponds to a timestamp and a hash value;

[0210] A third determination module, after acquiring the first media resource and the second media resource to be stored, determines third frame difference information between the fourth media frame set and the first media frame set according to the differences in timestamp and hash value between the fourth media frame and the first media frame;

[0211] A fifth acquisition module, configured to, after acquiring a first media resource and a second media resource to be stored, acquire a first distribution interval of timestamps of media frames indicated by first frame difference information, and acquire a second distribution interval of timestamps of media frames indicated by third frame difference information;

[0212] A merging module, configured to, after acquiring a first media resource and a second media resource to be stored, in a case where there is no overlapping part between the first distribution interval and the second distribution interval, perform a merging operation on a first media correction resource corresponding to the first frame difference information and a fourth media correction resource corresponding to the third frame difference information based on the first media resource, to obtain a fifth media resource;

[0213] A second storage module, configured to, after acquiring a first media resource and a second media resource to be stored, store the fifth media resource, a first index file corresponding to the first frame difference information, and a third index file corresponding to the third frame difference information, where the first index file is used to trace back to the fourth media resource based on the fifth media resource, and is used to trace back to the first media resource based on the second media resource, and the third index file is used to trace back to the second media resource based on the fifth media resource, and is used to trace back to the first media resource based on the fourth media resource.

[0214] As an optional solution, the frame splitting unit 604 includes:

[0215] A third frame splitting module, configured to respectively extract a first media frame of the first media resource and a second media frame of the second media resource at a preset frame rate, generate a corresponding first picture for each extracted first media frame, generate a corresponding second picture for each extracted second media frame, calculate hash values of the first picture and the second picture respectively, and determine a hash value corresponding to the first media frame and a hash value corresponding to the second media frame.

[0216] According to another aspect of the embodiments of the present application, there is further provided an electronic device for implementing the above-mentioned media resource processing method, further as Figure 7 shown, the electronic device includes a memory 702 and a processor 704, a computer program is stored in the memory 702, and the processor 704 is configured to execute the steps in any one of the above-mentioned method embodiments through the computer program.

[0217] Optionally, in this embodiment, the above-mentioned electronic device may be at least one network device among multiple network devices of a computer network.

[0218] Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through the computer program:

[0219] S1, Obtain a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by correcting the first media resource;

[0220] S2, Perform frame splitting on the first media resource and the second media resource respectively to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource. Each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value;

[0221] S3, Determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frames and the first media frames;

[0222] S4, Create a first index file corresponding to the first frame difference information, and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0223] Optionally, those of ordinary skill in the art can understand that Figure 7 the structure shown is only schematic Figure 7 and does not limit the structure of the above electronic device. For example, the electronic device may further include more or fewer components (such as a network interface, etc.) than those shown Figure 7 or have a different configuration from that shown Figure 7 .

[0224] Among them, the memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the media resource processing method and device in the embodiments of the present application. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, implements the above-mentioned media resource processing method. The memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 702 may further include a memory remotely provided with respect to the processor 704, and these remote memories may be connected to the electronic device through a network. Examples of the above network include but are not limited to the Internet, enterprise intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 702 may specifically but not limitedly be used to store information such as the second media resource and the first index file. As an example, Figure 7As shown, the above-mentioned memory 702 may but is not limited to include the acquisition unit 602, the framing unit 604, the determination unit 606, and the storage unit 608 in the processing device for the above-mentioned media resources. In addition, it may also include but is not limited to other module units in the processing device for the above-mentioned media resources, which will not be elaborated in this example.

[0225] Optionally, the above-mentioned transmission device 706 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 706 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers through a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 706 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0226] In addition, the above-mentioned electronic device further includes: a display 708, which is used to display information such as the second media resource and the first index file; and a connection bus 710, which is used to connect each module component in the above-mentioned electronic device.

[0227] In other embodiments, the above-mentioned client or server may be a node in a distributed system, where the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes in a form of network communication. Among them, the nodes can form a peer-to-peer network, and any form of computing device, such as an electronic device like a server or a client, can become a node in the blockchain system by joining the peer-to-peer network.

[0228] According to one aspect of the present application, there is provided a computer program product, which includes computer programs / instructions, and the computer programs / instructions contain program codes for executing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, it executes various functions provided by the embodiments of the present application.

[0229] The serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.

[0230] It should be noted that the computer system of the electronic device is only an example and should not bring any limitations to the functions and usage scopes of the embodiments of the present application.

[0231] The computer system includes a Central Processing Unit (CPU), which can perform various appropriate actions and processes according to the program stored in the Read-Only Memory (ROM) or the program loaded from the storage section into the Random Access Memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory, and the random access memory are connected to each other via a bus. The Input / Output interface (I / O interface) is also connected to the bus.

[0232] The following components are connected to the input / output interface: an input section including a keyboard, a mouse, etc.; an output section including, for example, a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), etc. and a speaker, etc.; a storage section including a hard disk, etc.; and a communication section including a network interface card such as a local area network card, a modem, etc. The communication section performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. A removable medium, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive as needed so that a computer program read from it can be installed into the storage section as needed.

[0233] In particular, according to an embodiment of the present application, the processes described in each of the method flowcharts can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes program codes for performing the methods shown in the flowcharts. In such an embodiment, the computer program can be downloaded and installed from the network through the communication section, and / or installed from the removable medium. When the computer program is executed by the central processing unit, various functions defined in the system of the present application are executed.

[0234] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above various optional implementation manners.

[0235] Optionally, in this embodiment, the above computer-readable storage medium can be set to store a computer program for performing the following steps:

[0236] S1. Obtain a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by correcting the first media resource.

[0237] S2. Perform frame splitting on the first media resource and the second media resource respectively to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource. Each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value.

[0238] S3. Determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frames and the first media frames.

[0239] S4. Create a first index file corresponding to the first frame difference information, and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

[0240] Optionally, in this embodiment, those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the relevant hardware of the electronic device through a program. The program can be stored in a computer-readable storage medium, and the storage medium can include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc, etc.

[0241] The serial numbers of the above embodiments of the present application are only for description and do not represent the advantages and disadvantages of the embodiments.

[0242] If the integrated unit in the above embodiments is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in the storage medium and includes several instructions for causing one or more computer devices (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods of the various embodiments of the present application.

[0243] In the above embodiments of the present application, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0244] In several embodiments provided by the present application, it should be understood that the recorded client can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling, direct coupling, or communication connection to each other can be through some interfaces. The indirect coupling or communication connection of units or modules can be in electrical or other forms.

[0245] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0246] In addition, in each embodiment of the present application, each functional unit can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above-mentioned integrated units can be implemented in the form of hardware or in the form of software functional units.

[0247] The above is only the preferred embodiment of the present application. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present application, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present application.

Claims

1. A method for processing media resources, characterized in that Including: Obtain a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by performing a first media resource correction on the first media resource; Perform frame splitting processing on the first media resource and the second media resource respectively to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value; Determine first frame difference information between the second media frame set and the first media frame set according to the differences in timestamps and hash values between the second media frames and the first media frames; Create a first index file corresponding to the first frame difference information, and store the second media resource and the first index file, where the first index file is used to trace back to the first media resource based on the second media resource.

2. The method according to claim 1, wherein The determining first frame difference information between the first media frame set and the second media frame set according to the differences in timestamps and hash values between the first media frames and the second media frames includes: Obtain at least one deleted media frame that meets a first expected condition from the first media frame set, where the first expected condition is used to indicate that the hash value of the at least one deleted media frame is different from the hash value of any second media frame in the second media frame set or the timestamp of the at least one deleted media frame is different from the timestamp of any second media frame in the second media frame set; Obtain at least one added media frame that meets a second expected condition from the second media frame set, where the second expected condition is used to indicate that the hash value of the at least one added media frame is different from the hash value of any first media frame in the first media frame set or the timestamp of the at least one added media frame is different from the timestamp of any first media frame in the first media frame set; Determine the at least one deleted media frame and the at least one added media frame as the first frame difference information.

3. The method according to claim 2, wherein: The creating a first index file corresponding to the first frame difference information includes: Create a first index sub-file corresponding to the at least one deleted media frame, where the first index sub-file is used to indicate a first partial media resource deleted based on the first media resource during the correction of the first media resource; Create a second index sub-file corresponding to the at least one added media frame, where the second index sub-file is used to indicate a second partial media resource added based on the first media resource during the correction of the first media resource; After storing the second media resource and the first index file, the method further includes: In response to a resource acquisition request for requesting to acquire the first media resource, the first index sub-file and the second index sub-file are respectively identified to obtain the first partial media resource and the second partial media resource; An addition operation of the first partial media resource and a deletion operation of the second partial media resource are performed on the second media resource to obtain the first media resource.

4. The method according to claim 1, characterized in that, After creating the index file corresponding to the frame difference information and storing the second media resource and the index file, the method further includes: Obtaining a third media resource to be stored, where the third media resource is a media resource obtained by correcting the second media resource for the second media resource; Performing frame division processing on the third media resource to obtain a third media frame set corresponding to the third media resource, where each third media frame in the third media frame set corresponds to a timestamp and a hash value; According to the differences between the third media frames and the second media frames in terms of timestamps and hash values, second frame difference information between the third media frame set and the second media frame set is determined; Creating a second index file corresponding to the second frame difference information, canceling the storage of the second media resource, and on the basis of storing the first index file, storing the third media resource and the second index file, where the second index file is used to trace back to the second media resource based on the third media resource.

5. The method according to claim 4, wherein After storing the third media resource and the second index file, the method further includes: In response to a resource acquisition request for requesting to acquire the first media resource, the second index file is identified to obtain a first media correction resource; Performing a correction operation of the first media correction resource on the third media resource to obtain the second media resource; Identifying the first index file to obtain a second media correction resource; Performing a correction operation of the second media correction resource on the second media resource to obtain the first media resource.

6. The method according to claim 1, wherein After obtaining the first media resource and the second media resource to be stored, the method further includes: Obtaining a fourth media resource to be stored, where the second media resource is a media resource obtained by a first operation object correcting the first media resource for the first media resource, and the fourth media resource is a media resource obtained by a second operation object correcting the first media resource for a third media resource; Performing frame division processing on the fourth media resource to obtain a fourth media frame set corresponding to the fourth media resource, where each fourth media frame in the fourth media frame set corresponds to a timestamp and a hash value; According to the differences between the fourth media frames and the first media frames in terms of timestamps and hash values, third frame difference information between the fourth media frame set and the first media frame set is determined; Obtain a first distribution interval of the timestamps of the media frames indicated by the first frame difference information, and obtain a second distribution interval of the timestamps of the media frames indicated by the third frame difference information; In the case where there is no overlapping part between the first distribution interval and the second distribution interval, based on the first media resource, perform a merging operation on the first media correction resource corresponding to the first frame difference information and the fourth media correction resource corresponding to the third frame difference information to obtain a fifth media resource; Store the fifth media resource, the first index file corresponding to the first frame difference information, and the third index file corresponding to the third frame difference information, where the first index file is used to backtrack to the fourth media resource based on the fifth media resource and is used to backtrack to the first media resource based on the second media resource, and the third index file is used to backtrack to the second media resource based on the fifth media resource and is used to backtrack to the first media resource based on the fourth media resource.

7. The method according to any one of claims 1 to 6, characterized in that The separately performing frame division processing on the first media resource and the second media resource to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource includes: Extract the first media frames of the first media resource and the second media frames of the second media resource respectively according to a preset frame rate, generate corresponding first pictures for each of the extracted first media frames and generate corresponding second pictures for each of the extracted second media frames, calculate the hash values of the first pictures and the second pictures respectively, and determine the hash value corresponding to the first media frame and the hash value corresponding to the second media frame.

8. A processing device for media resources, characterized in that, Includes: An obtaining unit, configured to obtain a first media resource and a second media resource to be stored, where the second media resource is a media resource obtained by performing first media resource correction on the first media resource; A frame division unit, configured to separately perform frame division processing on the first media resource and the second media resource to obtain a first media frame set corresponding to the first media resource and a second media frame set corresponding to the second media resource, where each first media frame in the first media frame set corresponds to a timestamp and a hash value, and each second media frame in the second media frame set corresponds to a timestamp and a hash value; A determining unit, configured to determine first frame difference information between the second media frame set and the first media frame set according to the differences between the second media frame and the first media frame in terms of timestamp and hash value; A storage unit, configured to create a first index file corresponding to the first frame difference information and store the second media resource and the first index file, where the first index file is used to backtrack to the first media resource based on the second media resource.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored program, where the program, when run by an electronic device, executes the method described in any one of claims 1 to 7.

10. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to execute the method described in any one of claims 1 to 7 through the computer program.