Generating and playing method and device of general animation format file, equipment and medium

By generating a universal animation format file that includes compressed animation resources, file header configuration, and default placeholder images, the code redundancy and compatibility issues caused by the diversity of animation resource formats are resolved. This achieves compatibility of multiple animation resources with a single format, reduces maintenance costs, and optimizes resource management.

CN121815030APending Publication Date: 2026-04-07GUANGZHOU MIZAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-12-18
Publication Date
2026-04-07

AI Technical Summary

Technical Problem

The diverse formats of animation resources in existing technologies require clients to maintain multiple sets of player code, and format updates necessitate code modification and re-release. Furthermore, older player versions are incompatible with newer formats, impacting user experience.

Method used

Generates universal animation format files, including compressed animation resources, file header configuration, and default placeholder images. It has built-in multi-format playback logic, identifies resource updates by version number and filename timestamp, and supports backward compatibility.

Benefits of technology

It achieves compatibility with multiple animation resources in a single format, reduces code redundancy, lowers maintenance costs, improves iteration efficiency, ensures user experience, and optimizes resource transmission and cache management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121815030A_ABST
    Figure CN121815030A_ABST
Patent Text Reader

Abstract

The invention provides a general animation format file generation and playing method and device, equipment and a medium, and relates to the technical field of animation resource processing. The method comprises the following steps: importing original animation resources of any common animation format or common dynamic picture format; performing compression optimization processing on the original animation resource to obtain a compressed animation resource; file header configuration of the general animation format file is created, and file basic information is recorded by the file header configuration; embedding the preset single-frame static graph into the general animation format file as a default placeholder graph; and packaging the compressed animation resource, the file header configuration and the default placeholder to generate a general animation format file. Acquiring a general animation format file; analyzing the general animation format file, and extracting the format of the original animation resource; and calling a corresponding playing logic to play the original animation resource based on the format of the original animation resource. A single format is compatible with multiple types of resources, a client only needs to maintain a set of playing codes, and animation updating does not need to modify the codes of the client.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of animation resource processing technology, and in particular to a method, apparatus, device, and medium for generating and playing universal animation format files. Background Technology

[0002] With the development of animation technology, various animated GIF and animation resource formats are currently available on the market, such as GIF, APNG, WebP, and SVG, as well as SVG, MP4, and VAP. Different resource formats vary in color support, compression methods, compatibility, and file size at the same quality. Therefore, in practical applications, different resource formats must be selected according to different scenarios.

[0003] However, the way animation resources are used in existing technologies has significant drawbacks:

[0004] 1. The client needs to maintain multiple sets of player code: Since different animation formats are used in different scenarios, the client needs to develop and maintain corresponding player logic for each format, resulting in code redundancy and high maintenance costs;

[0005] 2. Poor format update compatibility: When business requirements change and the animation format needs to be changed, the existing client code cannot be compatible with the new format. The code must be modified and a new version must be released, which not only increases development costs but may also affect user experience.

[0006] 3. Lack of a unified resource management mechanism: The caching and update logic for resources of different formats is not unified, and the client needs to design a separate caching strategy for each format, which further increases the development complexity;

[0007] 4. Compatibility issues with older player versions: When adding new animation formats, older client players may not support the format, resulting in blank screens where the animation cannot be played, affecting the user experience. Summary of the Invention

[0008] This invention provides a method, apparatus, device, and medium for generating and playing universal animation format files, which solves the defects in the prior art where the variety of animation formats leads to the need for the client to maintain multiple sets of player code and the need to modify and redistribute the code when the format is updated. It achieves a single format that is compatible with multiple animation resources, the client only needs to maintain one set of playback code, and the client code does not need to be modified when the animation is updated.

[0009] This invention provides a method for generating a universal animation format file, comprising:

[0010] Import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg;

[0011] The original animation resources are compressed and optimized to obtain compressed animation resources;

[0012] Create a file header configuration for a generic animation format file, wherein the file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource;

[0013] A preset single-frame static image is embedded as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0014] The compressed animation resources, the file header configuration, and the default placeholder image are encapsulated to generate the general animation format file.

[0015] According to the present invention, a method for generating a universal animation format file is provided.

[0016] The preset single-frame static image is a screenshot of the first frame of the original animation resource or a static image uploaded by the user.

[0017] This invention also provides an animation playback method applied to a player for the aforementioned common animation format files. The player has built-in playback logic for common animation format files, including:

[0018] Obtain common animation format files;

[0019] Parse the common animation format file to extract the format of the original animation resource;

[0020] Based on the format of the original animation resource, the corresponding playback logic is invoked to play the original animation resource.

[0021] According to an animation playback method provided by the present invention, the player parsing further extracts the player version number of the original animation resource. After parsing the general animation format file and extracting the format of the original animation resource, the method further includes:

[0022] Determine whether the version number of the player for the general animation format file is lower than the version number of the player for the original animation resource;

[0023] If so, then display the default placeholder image in the general animation format file;

[0024] If not, then execute the step of calling the corresponding playback logic to play the original animation resource based on the format of the original animation resource.

[0025] According to an animation playback method provided by the present invention, before obtaining the universal animation format file, the method further includes:

[0026] Based on the filename of the universal animation format file, determine whether the universal animation format file exists in the local cache;

[0027] If so, the corresponding general animation format file in the local cache is directly called, and the original animation resource is played using the corresponding playback logic;

[0028] If not, perform the step of obtaining the universal animation format file and store the universal animation format file in the local cache.

[0029] According to an animation playback method provided by the present invention, the filename of the universal animation format file includes a name word and a timestamp, wherein the timestamp is automatically added by the system when the file is generated;

[0030] The step of determining whether the common animation format file exists in the local cache based on the filename of the common animation format file includes:

[0031] Based on the naming words and timestamps of the filenames of the general animation format files, determine whether the general animation format files exist in the local cache;

[0032] If the local cache contains a file with the same name but different timestamps as the general animation format file, the old file in the local cache will be deleted, and the general animation format file will be cached in the local cache.

[0033] The present invention also provides an apparatus for generating universal animation format files, comprising:

[0034] The import module is used to import original animation resources in any common animation format or common animated image format. The common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg.

[0035] A compression module is used to compress and optimize the original animation resources to obtain compressed animation resources;

[0036] A creation module is used to create a file header configuration for a generic animation format file. The file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource.

[0037] An embedding module is used to embed a preset single-frame static image as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0038] The generation module is used to encapsulate the compressed animation resources, the file header configuration, and the default placeholder image to generate the general animation format file.

[0039] The present invention also provides an animation playback device for playing the aforementioned common animation format files. The device has built-in playback logic for common animation format files, including:

[0040] The acquisition module is used to acquire common animation format files;

[0041] The parsing module is used to parse the common animation format file and extract the format of the original animation resource;

[0042] The playback module is used to play the original animation resource by calling the corresponding playback logic based on the original animation resource's format.

[0043] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the method for generating a general animation format file as described above or the animation playback method.

[0044] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method for generating a general animation format file as described above or the animation playback method.

[0045] The present invention provides a method, apparatus, device, and medium for generating and playing universal animation format files. Compared with the prior art, the present invention has the following significant advantages:

[0046] 1. Single unified format compatible with multiple types of resources: The universal animation format can encapsulate various common animation / GIF formats such as gif, apng, webp, svg, svga, mp4, and vap. Clients with built-in universal animation format players do not need to pay attention to the original resource format, but only need to handle the universal animation format, which greatly simplifies the development process.

[0047] 2. The client only needs to maintain one set of playback code: The player for general animation formats has built-in multi-format preset playback logic, eliminating the need to develop a separate player for each animation format, reducing code redundancy and maintenance costs;

[0048] 3. No need to modify client code for animation updates: Resource updates are identified through time suffix naming rules. The client automatically downloads the new universal animation format file and adapts it for playback. No code modification and redeployment are required, improving iteration efficiency and reducing communication costs.

[0049] 4. Supports backward compatibility: By using the version number and the default placeholder image mechanism, older versions of the player can still display placeholder images even if they do not support the new formats, ensuring a basic user experience and avoiding blank scenes;

[0050] 5. Optimize resource transmission and caching: Common animation format files are compressed and optimized to reduce size and download time; cache status is quickly identified by filename, cache management logic is optimized, and resource loading efficiency is improved. Attached Figure Description

[0051] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0052] Figure 1 This is a flowchart illustrating the method for generating universal animation format files provided by the present invention;

[0053] Figure 2 This is a flowchart illustrating the animation playback method provided by the present invention;

[0054] Figure 3 This is a schematic diagram of the structure of the universal animation format file generation device provided by the present invention;

[0055] Figure 4 This is a schematic diagram of the structure of the animation playback device provided by the present invention;

[0056] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0058] It should be noted that in the description of the embodiments of the present invention, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The terms "first," "second," etc., used in this invention are used to distinguish similar objects and are not used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that embodiments of the invention can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and do not limit the number of objects; for example, a first object can be one or more. Furthermore, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0059] The following is combined with Figures 1 to 5 This invention describes a method, apparatus, device, and medium for generating and playing a universal animation format file.

[0060] like Figure 1 As shown, this invention provides a method for generating a universal animation format file. The generated universal animation format file is a packaged file capable of carrying any commonly used animation resources and commonly used animated GIF resources. The method specifically includes the following steps:

[0061] Step 110: Import the original animation resources in any common animation format or common animated GIF format. The common animation format includes at least one of svga, mp4, and vap, and the common animated GIF format includes at least one of gif, apng, webp, and svg.

[0062] Step 120: Compress and optimize the original animation resources to obtain compressed animation resources.

[0063] Specifically, the original animation resources are packaged and compressed using optimization algorithms to reduce file size, balancing animation quality and transmission efficiency. The compression optimization algorithm can be either lossless or lossy compression, depending on the requirements.

[0064] Step 130: Create a file header configuration for a generic animation format file. The file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource.

[0065] Specifically, the file header configuration, as the core metadata area of ​​a common animation format file, records basic file information, including but not limited to:

[0066] (1) Size of the general animation format file: The total number of bytes of the general animation format file, which can be used for client download and parsing verification;

[0067] (2) Original animation resource format: Records the specific format of the original animation resources packaged inside, such as svga, webp, mp4, etc., to provide the player with the basis for adaptation;

[0068] (3) Player version number of the original animation resource: used to identify the compatible version of the player corresponding to the general animation format file, and supports backward compatibility judgment.

[0069] Step 140: Embed a preset single-frame static image as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played.

[0070] Specifically, considering compatibility issues with older player versions and resource download time, the universal animation format file also includes a default image of a single frame of animation. The preset single-frame static image is used as a placeholder when the player does not support the version of the original animation resource that can be played, or when the original animation resource is corrupted and cannot be played, to avoid blank scenes.

[0071] In some embodiments, the preset single-frame static image is a screenshot of the first frame of the original animation resource or a static image uploaded by the user.

[0072] Step 150: Encapsulate the compressed animation resources, the file header configuration, and the default placeholder image to generate the universal animation format file.

[0073] Specifically, a dedicated universal animation format resource generation tool is used to convert the original animation resource format to a universal animation format. The tool integrates resource processing and preview functions to ensure the usability of the output universal animation format file. Animators can preview and verify the playback effect of the universal animation format file before exporting to ensure that the animation is displayed normally.

[0074] In some embodiments, the generated general animation format file has the file extension "gag", which stands for General Animation Graphics.

[0075] To ensure that clients can clearly know whether resource files have been cached or need to be updated, in some embodiments, the file names of general animation format files adopt the naming format of "name word + time suffix (milliseconds) + .gag" to ensure that each generated file name is unique. The timestamp can be automatically added by the system when the file is generated. By adding time suffix differences, the client can quickly identify the resource cache status and update needs.

[0076] like Figure 2 As shown, the present invention also provides an animation playback method, which can be applied to a player for the aforementioned common animation format files. The player has built-in playback logic for common animation format files, and specifically includes the following steps:

[0077] Step 210: Obtain the universal animation format file.

[0078] Specifically, taking the application client as an example, the client can have the aforementioned player built-in, and the client can download and obtain the target general animation format file from the server according to the business scenario requirements.

[0079] To enable the client to quickly determine the resource status by filename and clearly know whether the resource file has been cached, in some embodiments, the following is included before step 210:

[0080] Based on the filename of the universal animation format file, determine whether the universal animation format file exists in the local cache;

[0081] If so, the corresponding general animation format file in the local cache is directly called, and the original animation resource is played using the corresponding playback logic;

[0082] If not, proceed to step 210 and store the general animation format file in the local cache.

[0083] In this embodiment, the client maintains a local cache library of common animation format files. Before downloading, the filename is compared with the filename in the cache library. If a filename with the same name exists in the cache, the locally cached file can be directly accessed; otherwise, the common animation format file is downloaded and cached locally.

[0084] To further inform the client whether resource files need to be updated, in some embodiments, the filename of the generic animation format file includes a name and a timestamp, which is automatically added by the system when the file is generated.

[0085] Accordingly, determining whether the common animation format file exists in the local cache based on the filename of the common animation format file includes:

[0086] Based on the naming words and timestamps of the filenames of the general animation format files, determine whether the general animation format files exist in the local cache;

[0087] If the local cache contains a file with the same name but different timestamps as the general animation format file, the old file in the local cache will be deleted, and the general animation format file will be cached in the local cache.

[0088] In this embodiment, a naming rule that includes a timestamp in the file name is adopted. The local cache is compared to see if there is a file with the same file name. If the names are the same but the timestamps of the name suffixes are different, it means that the new file is an updated version of the old file in the cache. In this case, the old file is deleted and the downloaded new file is updated and stored in the local cache.

[0089] Step 220: Parse the general animation format file and extract the format of the original animation resource.

[0090] Specifically, the player decodes and parses the acquired common animation format files to extract core data. The player reads the file header configuration of the common animation format files and parses out information such as file size, original animation resource format, and version number.

[0091] To facilitate the retrieval of animation resource data, in some embodiments, the original animation resource data packaged in a common animation format file is also cached in the local cache.

[0092] Step 230: Based on the format of the original animation resource, call the corresponding playback logic to play the original animation resource.

[0093] Specifically, the player flexibly adapts to the playback based on the format of the parsed original animation resource. The player has built-in playback logic for all common animation and GIF formats. The player automatically calls the corresponding playback logic to play the video based on the actual format of the original animation resource parsed from the file header, without requiring any additional configuration on the client side.

[0094] Considering compatibility issues with older player versions and resource download time, in some embodiments, the player parsing also extracts the player version number of the original animation resource. After step 220, the process further includes:

[0095] Determine whether the version number of the player for the general animation format file is lower than the version number of the player for the original animation resource;

[0096] If so, then display the default placeholder image in the general animation format file;

[0097] If not, proceed to step 230.

[0098] In this embodiment, if the version number of the player is lower than the version number of the original animation resource being parsed, that is, the player does not support the current original resource format, the default placeholder image in the general animation format file is directly displayed to ensure the basic user experience.

[0099] In some embodiments, the player can also verify the integrity of the common animation format based on the parsed file size. If the file is corrupted and cannot be played, a default placeholder image is displayed to avoid a blank scene; if the file is intact, step 230 is executed. Furthermore, the original animation resource data packaged in the file is extracted and cached in the client's memory for subsequent playback.

[0100] Understandably, comparing file size and version number simultaneously can determine whether a common animation format file can be played normally.

[0101] The following example illustrates an application scenario where animators use a universal animation format resource generation tool to generate universal animation format files and then play them.

[0102] Taking the common animation format gag as an example, firstly, the animator generates the animation. Let's assume the original animation resource is SVGA. Then, a gag resource generation tool imports this SVGA file. The tool packages the original animation resource, modifies the gag file header configuration, and finally exports a compressed and optimized gag file. Considering compatibility issues with older player versions and resource download time, the gag format also includes a default frame of animation, used as a placeholder when the animation resource cannot be played. To ensure the client clearly knows whether the resource file is cached or needs updating, the generated gag file is named in the format of time extension (milliseconds) + .gag.

[0103] After the client downloads the resource, it uses the gag player to decode and analyze the file; finally, it decodes the file and caches the obtained SVGA data in memory, and then uses the SVGA-specific logic contained in the gag to play it.

[0104] If animators need to update an animation (including changing the original resource format, modifying the animation content, etc.), no client-side code modification is required. For example, if the original animation resource is changed from SVGA to WebP format, and a tool is used to convert it into a GAG file, the new file's filename and extension will differ from the old file due to the different generation times. Since the filename has changed, the client detects this change, automatically recognizes the updated resource, and knows the old cache is no longer needed. It first deletes the old cache, then synchronously downloads the new file and re-decodes it. The re-decoded file contains WebP-related configurations and data. Similarly, playback can be achieved using the WebP-specific logic contained within the GAG ​​file, achieving seamless animation update compatibility. The animation update process requires no code modification on the client side.

[0105] The method for generating and playing a universal animation format file provided above has the following significant advantages compared with existing technologies:

[0106] 1. Single unified format compatible with multiple types of resources: The universal animation format can encapsulate various common animation / GIF formats such as gif, apng, webp, svg, svga, mp4, and vap. Clients with built-in universal animation format players do not need to pay attention to the original resource format, but only need to handle the universal animation format, which greatly simplifies the development process.

[0107] 2. The client only needs to maintain one set of playback code: The player for general animation formats has built-in multi-format preset playback logic, eliminating the need to develop a separate player for each animation format, reducing code redundancy and maintenance costs;

[0108] 3. No need to modify client code for animation updates: Resource updates are identified through time suffix naming rules. The client automatically downloads the new universal animation format file and adapts it for playback. No code modification and redeployment are required, improving iteration efficiency and reducing communication costs.

[0109] 4. Supports backward compatibility: By using the version number and the default placeholder image mechanism, older versions of the player can still display placeholder images even if they do not support the new formats, ensuring a basic user experience and avoiding blank scenes;

[0110] 5. Optimize resource transmission and caching: Common animation format files are compressed and optimized to reduce size and download time; cache status is quickly identified by filename, cache management logic is optimized, and resource loading efficiency is improved.

[0111] The apparatus for generating universal animation format files provided by the present invention is described below. The apparatus for generating universal animation format files described below can be referred to in correspondence with the method for generating universal animation format files described above.

[0112] like Figure 3 As shown, the present invention also provides an apparatus for generating universal animation format files, comprising:

[0113] Import module 310 is used to import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg;

[0114] Compression module 320 is used to compress and optimize the original animation resources to obtain compressed animation resources;

[0115] A creation module 330 is used to create a file header configuration for a universal animation format file. The file header configuration records basic file information, including: the size of the universal animation format file, the format of the original animation resource, and the player version number of the original animation resource.

[0116] The embedding module 340 is used to embed a preset single-frame static image as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0117] The generation module 350 is used to encapsulate the compressed animation resources, the file header configuration, and the default placeholder image to generate the general animation format file.

[0118] Accordingly, the animation playback device provided by the present invention will be described below, and the animation playback device described below can be referred to in correspondence with the animation playback method described above.

[0119] like Figure 4 As shown, the present invention also provides an animation playback device that can be used to play the aforementioned common animation format files. The device has built-in playback logic for common animation format files, including:

[0120] Module 410 is used to acquire common animation format files;

[0121] The parsing module 420 is used to parse the general animation format file and extract the format of the original animation resource;

[0122] The playback module 430 is used to play the original animation resource by calling the corresponding playback logic based on the format of the original animation resource.

[0123] Figure 5 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 5As shown, the electronic device may include: a processor 510, a communication interface 520, a memory 530, and a communication bus 540, wherein the processor 510, the communication interface 520, and the memory 530 communicate with each other via the communication bus 540. The processor 510 can call logical instructions in the memory 530 to execute a method for generating a general animation format file, the method including:

[0124] Import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg;

[0125] The original animation resources are compressed and optimized to obtain compressed animation resources;

[0126] Create a file header configuration for a generic animation format file, wherein the file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource;

[0127] A preset single-frame static image is embedded as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0128] The compressed animation resources, the file header configuration, and the default placeholder image are encapsulated to generate the general animation format file.

[0129] Alternatively, execute the animation playback method, which includes:

[0130] Obtain common animation format files;

[0131] Parse the common animation format file to extract the format of the original animation resource;

[0132] Based on the format of the original animation resource, the corresponding playback logic is invoked to play the original animation resource.

[0133] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0134] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is capable of executing the method for generating a general animation format file provided by the above methods, the method comprising:

[0135] Import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg;

[0136] The original animation resources are compressed and optimized to obtain compressed animation resources;

[0137] Create a file header configuration for a generic animation format file, wherein the file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource;

[0138] A preset single-frame static image is embedded as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0139] The compressed animation resources, the file header configuration, and the default placeholder image are encapsulated to generate the general animation format file.

[0140] Alternatively, execute the animation playback method, which includes:

[0141] Obtain common animation format files;

[0142] Parse the common animation format file to extract the format of the original animation resource;

[0143] Based on the format of the original animation resource, the corresponding playback logic is invoked to play the original animation resource.

[0144] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a method for generating a general animation format file provided by the methods described above, the method comprising:

[0145] Import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg;

[0146] The original animation resources are compressed and optimized to obtain compressed animation resources;

[0147] Create a file header configuration for a generic animation format file, wherein the file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource;

[0148] A preset single-frame static image is embedded as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played;

[0149] The compressed animation resources, the file header configuration, and the default placeholder image are encapsulated to generate the general animation format file.

[0150] Alternatively, execute the animation playback method, which includes:

[0151] Obtain common animation format files;

[0152] Parse the common animation format file to extract the format of the original animation resource;

[0153] Based on the format of the original animation resource, the corresponding playback logic is invoked to play the original animation resource.

[0154] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0155] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0156] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for generating a universal animation format file, characterized in that, include: Import original animation resources in any common animation format or common animated image format, wherein the common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg; The original animation resources are compressed and optimized to obtain compressed animation resources; Create a file header configuration for a generic animation format file, wherein the file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource; A preset single-frame static image is embedded as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played; The compressed animation resources, the file header configuration, and the default placeholder image are encapsulated to generate the general animation format file.

2. The method for generating a universal animation format file according to claim 1, characterized in that, The preset single-frame static image is a screenshot of the first frame of the original animation resource or a static image uploaded by the user.

3. An animation playback method, characterized in that, A player for common animation format files as described in claim 1 or 2, wherein the player has built-in playback logic for common animation format files, including: Obtain common animation format files; Parse the common animation format file to extract the format of the original animation resource; Based on the format of the original animation resource, the corresponding playback logic is invoked to play the original animation resource.

4. The animation playback method according to claim 3, characterized in that, The player parsing also extracts the player version number of the original animation resource. After parsing the common animation format file and extracting the format of the original animation resource, it also includes: Determine whether the version number of the player for the general animation format file is lower than the version number of the player for the original animation resource; If so, then display the default placeholder image in the general animation format file; If not, then execute the step of calling the corresponding playback logic to play the original animation resource based on the format of the original animation resource.

5. The animation playback method according to claim 3, characterized in that, Before obtaining the universal animation format file, the following is also included: Based on the filename of the universal animation format file, determine whether the universal animation format file exists in the local cache; If so, the corresponding general animation format file in the local cache is directly called, and the original animation resource is played using the corresponding playback logic; If not, perform the step of obtaining the universal animation format file and store the universal animation format file in the local cache.

6. The animation playback method according to claim 5, characterized in that, The filename of the general animation format file includes a name word and a timestamp, the timestamp being automatically added by the system when the file is generated; The step of determining whether the common animation format file exists in the local cache based on the filename of the common animation format file includes: Based on the naming words and timestamps of the filenames of the general animation format files, determine whether the general animation format files exist in the local cache; If the local cache contains a file with the same name but different timestamps as the general animation format file, the old file in the local cache will be deleted, and the general animation format file will be cached in the local cache.

7. A device for generating universal animation format files, characterized in that, include: The import module is used to import original animation resources in any common animation format or common animated image format. The common animation format includes at least one of svga, mp4, and vap, and the common animated image format includes at least one of gif, apng, webp, and svg. A compression module is used to compress and optimize the original animation resources to obtain compressed animation resources; A creation module is used to create a file header configuration for a generic animation format file. The file header configuration records basic file information, including: the size of the generic animation format file, the format of the original animation resource, and the player version number of the original animation resource. An embedding module is used to embed a preset single-frame static image as a default placeholder image into the general animation format file, wherein the default placeholder image is used for placeholder display when the original animation resource cannot be played; The generation module is used to encapsulate the compressed animation resources, the file header configuration, and the default placeholder image to generate the general animation format file.

8. An animation playback device, characterized in that, For playing common animation format files as described in claim 1 or 2, the device has built-in playback logic for common animation format files, including: The acquisition module is used to acquire common animation format files; The parsing module is used to parse the common animation format file and extract the format of the original animation resource; The playback module is used to play the original animation resource by calling the corresponding playback logic based on the original animation resource's format.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the method for generating a general animation format file as described in any one of claims 1 to 6 or the animation playback method.

10. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the method for generating a general animation format file as described in any one of claims 1 to 6 or the animation playback method.