Method, device, live broadcast system, equipment and medium for generating special effect resource file
By detecting layer information and generating special effects resource files carrying marker data, the problem of fixed styles for special effects resource files is solved, enabling flexible configuration and rich display of special effects resource files on the terminal.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGZHOU FANGGUI INFORMATION TECHNOLOGY CO LTD
- Filing Date
- 2022-09-08
- Publication Date
- 2026-04-21
AI Technical Summary
In existing technologies, the styles of special effects resource files are fixed after being parsed and rendered on the terminal, which limits the flexibility of configuring special effects resource files and affects the display effect of special effects resources.
By detecting whether the layer information contains empty layers with preset naming characteristics, a special effects resource file carrying marked data is generated, enabling the terminal to render according to the background image data and present a special effects resource with the corresponding background image as the background.
It improves the configuration flexibility of special effects resource files, enriches the display methods and styles of special effects resources, and enhances the display effect.
Smart Images

Figure CN115587074B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video and live streaming technology, and in particular to a method, apparatus, electronic device, and computer-readable storage medium for generating special effects resource files. Background Technology
[0002] With the development of video and network technologies, applications such as live streaming can not only provide users with live video playback, but also add special effects resources such as live streaming effects to enrich the information displayed in the live stream. These special effects resources are typically output after animations are created using relevant software and added to the rendering queue. For example, an AVI or MP4 format special effects resource file can be output. This file is sent to the terminal, where it is parsed to obtain the special effects resource data, which is then rendered onto the screen.
[0003] In current technology, the special effects resource files produced by relevant software are displayed in a fixed and uniform style after being parsed and rendered on the terminal. This limits the flexibility of configuring special effects resource files and also affects the display effect of special effects resources. Summary of the Invention
[0004] Therefore, it is necessary to provide a method, apparatus, electronic device, and computer-readable storage medium for generating special effects resource files to address the aforementioned technical problems.
[0005] Firstly, this application provides a method for generating special effects resource files. The method includes:
[0006] Obtain the layer information used to generate special effects resource files;
[0007] Detect whether the layer information contains an empty layer with a preset naming characteristic;
[0008] If the layer information contains an empty layer with a preset naming feature, then markup data that can be added to the background of the special effects resource is generated;
[0009] Based on the layer information and the marker data, a special effects resource file carrying the marker data is generated; the special effects resource file is used by the terminal to render the special effects resource with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
[0010] In one embodiment, detecting whether the layer information contains an empty layer with a preset naming feature includes: obtaining a preset layer naming keyword; performing keyword matching in the layer names corresponding to each layer contained in the layer information according to the preset layer naming keyword; if the matching result indicates that there is a layer name containing the preset layer naming keyword in the layer names corresponding to each layer, then determining that the layer information contains the empty layer with the preset naming feature.
[0011] In one embodiment, the method further includes: providing an indicator control for adding background requirements to the special effects resource file to be generated; in response to an operation on the indicator control, creating an empty layer based on the existing layer information of the special effects resource file to be generated, generating a preset layer naming keyword based on the existing layer names of the special effects resource file to be generated; and generating a layer name for the empty layer based on the preset layer naming keyword.
[0012] In one embodiment, the operation is a multiple operation; generating the layer name of the empty layer based on the preset layer naming keyword includes: generating a layer name containing the preset layer naming keyword and the number of operations based on the preset layer naming keyword and the number of operations.
[0013] In one embodiment, generating the layer name of the empty layer based on the preset layer naming keyword includes: obtaining a layer name containing the preset layer naming keyword according to the preset layer naming keyword, setting the layer name containing the preset layer naming keyword as the layer name of the empty layer; when it is detected that the layer names of other subsequent layers of the special effects resource file to be generated contain the preset layer naming keyword, obtaining an updated preset layer naming keyword based on the preset layer naming keyword and preset characters, and updating the layer name of the empty layer according to the updated preset layer naming keyword.
[0014] In one embodiment, generating marker data for marking backgrounds that can be added to special effects resources includes: detecting operation count information contained in the layer name of the empty layer; obtaining the number of background layers that can be added based on the operation count information; and generating the marker data carrying the information on the number of background layers that can be added based on the number of background layers that can be added.
[0015] In one embodiment, generating a special effects resource file carrying the marker data based on the layer information and marker data includes: based on generating a special effects resource file according to the layer information, writing the marker data into a preset field of the special effects resource file to obtain a special effects resource file carrying the marker data; wherein, the special effects resource file is used by the terminal to obtain the background image data corresponding to each background layer when parsing the marker data from the preset field and obtaining the background layer number information, and then rendering the special effects resource data after rendering the background image data in the order of background layers.
[0016] Secondly, this application provides a live streaming system. The system includes a terminal and a live streaming server; wherein the live streaming server is used to acquire a live streaming special effects resource file carrying marker data generated according to the method described above, and send it to the terminal; the terminal is used to play live streaming special effects resources with a corresponding background image as the background in the live streaming screen based on the live streaming special effects resource file carrying marker data and corresponding background image data.
[0017] Thirdly, this application provides an apparatus for generating special effects resource files. The apparatus includes:
[0018] The layer acquisition module is used to obtain layer information for generating special effects resource files;
[0019] The layer detection module is used to detect whether the layer information contains an empty layer with a preset naming feature;
[0020] The marker generation module is used to generate marker data that can be added to the background of the special effects resource if the layer information contains an empty layer with a preset naming feature;
[0021] The file generation module is used to generate a special effects resource file carrying the marker data based on the layer information and marker data. The special effects resource file is used by the terminal to render the special effects resource file with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
[0022] Fourthly, this application provides an electronic device. The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to perform the following steps:
[0023] The process involves: acquiring layer information for generating special effects resource files; detecting whether the layer information contains empty layers with preset naming characteristics; if the layer information contains empty layers with preset naming characteristics, generating marker data for marking the background of special effects resources that can be added; generating a special effects resource file carrying the marker data based on the layer information and the marker data; and rendering the special effects resource file with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
[0024] Fifthly, this application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, performs the following steps:
[0025] The process involves: acquiring layer information for generating special effects resource files; detecting whether the layer information contains empty layers with preset naming characteristics; if the layer information contains empty layers with preset naming characteristics, generating marker data for marking the background of special effects resources that can be added; generating a special effects resource file carrying the marker data based on the layer information and the marker data; and rendering the special effects resource file with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
[0026] The aforementioned method, apparatus, system, device, and storage medium for generating special effects resource files acquire layer information for generating the special effects resource files, detect whether the layer information contains an empty layer with a preset naming characteristic, and if the layer information contains such an empty layer, generate marker data for marking the background of the special effects resource that can be added. Based on the layer information and the marker data, a special effects resource file carrying the marker data is generated. When the terminal parses the marker data in this special effects resource file, it can render it according to the corresponding background image data and the special effects resource data parsed from the special effects resource file, presenting a special effects resource with the corresponding background image as the background. This solution generates special effects resource files carrying markers for adding backgrounds based on layer processing, improving the flexibility of special effects resource file configuration. This allows the terminal to add backgrounds to special effects resources according to these markers and business scenario requirements, thereby enriching the display methods and styles of special effects resources and improving their display effects. Attached Figure Description
[0027] Figure 1 This is an application scenario diagram of the method for generating special effects resource files in the embodiments of this application;
[0028] Figure 2This is a flowchart illustrating the method for generating special effects resource files in an embodiment of this application;
[0029] Figure 3 This is a schematic diagram of the structure of the live streaming system in the embodiments of this application;
[0030] Figure 4 This is a schematic diagram of the interface for playing live streaming effects resources in the application example of this application;
[0031] Figure 5 This is a structural block diagram of the apparatus for generating special effects resource files in the embodiments of this application;
[0032] Figure 6 This is a diagram of the internal structure of the electronic device in an embodiment of this application. Detailed Implementation
[0033] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0034] The method for generating special effects resource files provided in this application can be applied to, for example... Figure 1 In the application scenario shown, the scenario can include a terminal 110 and a server 120. The terminal 110 communicates with the server 120 via a network. The method for generating special effects resource files provided in this application can be executed by either the terminal 110 or the server 120. When the terminal 110 executes the method, it can be considered a provider of the special effects resource file. After obtaining the special effects resource file according to the method, the terminal 110 can send it to the server 120, which then sends it to the terminal that requests the special effects resource file, i.e., the demand side. When the server 120 executes the method, it can also be considered a provider of the special effects resource file. After obtaining the special effects resource file according to the method, the server 120 can send it to the terminal 110, in which case the terminal 110 can be considered a demand side. The terminal 110 can be, but is not limited to, various personal computers, laptops, smartphones, and tablets. The server 120 can be a standalone server or a server cluster composed of multiple servers.
[0035] In one embodiment, such as Figure 2 As shown, a method for generating special effects resource files is provided, which can be applied to, for example... Figure 1 Taking terminal 110 as an example, the method includes the following steps:
[0036] Step S201: Obtain the layer information used to generate the special effects resource file.
[0037] In this step, designers can set layer information for generating special effects resource files on terminal 110. Terminal 110 then obtains this layer information. Specifically, if the special effects resource requires background attributes, the designer creates an empty layer (a layer without content) and names it with preset naming characteristics, such as names containing specific characters, strings, or numbers. In other words, designers can set empty layers with preset naming characteristics during the generation of special effects resource files so that terminal 110 can access background attributes. Based on this, terminal 110 obtains the layer information set by the designer for the special effects resource files, thus acquiring the layer information used to generate the special effects resource files.
[0038] Step S202: Detect whether the layer information contains an empty layer with a preset naming feature.
[0039] This step involves detecting whether the layer information used to generate the special effects resource file contains an empty layer with a preset naming characteristic when outputting the special effects resource file. That is, for special effects resources that require background attributes, the designers create an empty layer during the layer information setting stage and name it according to the preset naming characteristic. Therefore, during the special effects resource file output stage, the terminal 110 can detect whether the layer information contains an empty layer with the preset naming characteristic based on this preset naming characteristic.
[0040] Step S203: If the layer information contains an empty layer with a preset naming feature, then generate marker data that can be added to the background of the special effects resource.
[0041] In this step, if terminal 110 detects that the layer information contains an empty layer with a preset naming characteristic, terminal 110 can know that the special effect resource needs to have a background that can be added. Therefore, terminal 110 will generate marker data to indicate that the special effect resource has an addable background. Alternatively, if terminal 110 does not detect an empty layer with a preset naming characteristic in the layer information, terminal 110 can directly generate the special effect resource file based on the layer information. As an example, for a special effect resource that needs to have an addable background attribute, the relevant designer can create an empty layer during the layer information setting stage and set the layer name of the empty layer according to the aforementioned preset naming characteristic. During the special effect resource file output stage, terminal 110 can traverse all layer information corresponding to the special effect resource and check whether it contains an empty layer with a preset naming characteristic. If so, terminal 110 can generate JSON data to mark the addable background data of the special effect resource, setting a background:true flag.
[0042] Step S204: Generate an effects resource file carrying the marker data based on the layer information and marker data.
[0043] In this step, after obtaining layer information and marker data, terminal 110 generates a special effects resource file carrying the marker data based on the layer information and marker data. Specifically, terminal 110 can obtain the corresponding special effects resource file based on the layer information, and then write the marker data into the special effects resource file to obtain the special effects resource file carrying the marker data. After generating the special effects resource file, terminal 110 can send it to the terminal that requests the special effects resource file via server 120. When the terminal receiving the special effects resource file parses the marker data from it, it can render the special effects resource based on the corresponding background image data and the special effects resource data parsed from the special effects resource file, presenting a special effects resource with the corresponding background image as the background. The background image data can be pre-stored on the terminal that requests the special effects resource file, or it can be sent by the server 120 to the terminal that requests the special effects resource file. The background image data can be in the form of GIF, PNG, etc. The form and content of the background image data can be changed according to the actual business scenario requirements. That is, for the same special effects resource file, the terminal that requests the special effects resource file can render a GIF background image or a PNG background image. It can render GIF background image A or GIF background image B, or it can render PNG background image A or PNG background image B.
[0044] As an example, step S204 may include: based on generating an effects resource file according to the layer information, writing the marker data into a preset field of the effects resource file to obtain an effects resource file carrying the marker data. Specifically, the terminal 110 can use the ffmpeg tool to generate a corresponding MP4 effects resource file based on the layer information, and then write JSON data (corresponding to the marker data) into the metadata field (corresponding to the preset field) of the MP4 effects resource file through the ffmpeg command line, thereby obtaining an MP4 effects resource file carrying the marker data. Furthermore, the following steps may also be included: sending the MP4 effects resource file carrying the tag data to the terminal that requires the MP4 effects resource file via server 120, so that after the terminal obtains the MP4 effects resource file, it can parse the tag data from the metadata field of the MP4 effects resource file. When the terminal parses the tag data, it can know that the MP4 effects resource file is an MP4 file with background attributes that can be added. The terminal can render according to the corresponding background image data and effects resource data. Specifically, the terminal renders the background image data first and then renders the effects resource data, thereby playing effects resources with the corresponding background image as the background. This achieves the purpose of improving the flexibility of the effects resource file configuration, enriching the display methods and styles of the effects resources, and enhancing the display effect of the effects resources.
[0045] Since the layer with the preset naming feature set in the layer information is an empty layer, the special effects resource file generated in this way and the special effects resource file without an empty layer are displayed in the same way on the terminal. If the special effects resource file corresponds to a special effects resource, then the special effects resource displayed on the terminal is the same whether the special effects resource file with an empty layer or without an empty layer is set. That is, the special effects resource file obtained by this application can not destroy the original special effects resource display effect, and also adds marker data so that the terminal can know that the special effects resource has the attribute of background that can be added, so that it can perform operations such as adding background based on this marker.
[0046] The method provided in this embodiment obtains layer information for generating special effects resource files, detects whether the layer information contains an empty layer with a preset naming characteristic, and if the layer information contains such an empty layer, generates marker data for marking the background of the special effects resource that can be added. Based on the layer information and the marker data, a special effects resource file carrying the marker data is generated. When the terminal parses the marker data in this special effects resource file, it can render it according to the corresponding background image data and the special effects resource data parsed from the special effects resource file, presenting a special effects resource with the corresponding background image as the background. This solution generates special effects resource files carrying markers for adding backgrounds based on layer processing, improving the flexibility of special effects resource file configuration. This allows the terminal to add backgrounds to special effects resources according to these markers and business scenario requirements, thereby enriching the display methods and styles of special effects resources and improving their display effect.
[0047] In one embodiment, detecting whether the layer information in step S202 includes an empty layer with a preset naming characteristic may include:
[0048] Obtain the preset layer naming keywords; based on the preset layer naming keywords, perform keyword matching in the layer names corresponding to each layer contained in the layer information; if the matching result indicates that there is a layer name containing the preset layer naming keywords in the layer names corresponding to each layer, then determine that the layer information contains an empty layer with the preset naming characteristics.
[0049] This embodiment provides a simple and effective method for detecting whether layer information contains empty layers with preset naming characteristics. Specifically, the preset naming characteristics include preset layer naming keywords, such as "background". Therefore, during the layer information setting stage, designers create empty layers and name them with a keyword containing the preset layer naming keyword. Then, during the effects resource file output stage, the terminal 110 can perform keyword matching based on the preset layer naming keyword in the layer names corresponding to each layer included in the layer information. For example, it can search for layer names containing the aforementioned preset layer naming keyword. The matching result indicates whether a layer name containing the preset layer naming keyword "background" exists in the layer names corresponding to each layer. If the matching result indicates that no layer name containing the preset layer naming keyword "background" exists in the layer names corresponding to each layer, the terminal 110 can determine that the layer information does not contain empty layers with the preset naming characteristics. If the matching result indicates that there is a layer name containing the preset layer name keyword "background" in the layer name of each layer, then the terminal 110 determines that the layer information contains an empty layer with the preset naming characteristics, thereby realizing a simple and effective detection with strong operability.
[0050] Furthermore, in one embodiment, based on the embodiments described above, the method provided in this application may further include the following steps:
[0051] Provides an indicator control for adding desired backgrounds to the special effects resource file to be generated; in response to the operation of the indicator control, creates an empty layer based on the existing layer information of the special effects resource file to be generated, generates a preset layer naming keyword based on the existing layer names of the special effects resource file to be generated, and generates a layer name for the empty layer based on the preset layer naming keyword.
[0052] This embodiment is a solution adopted to further facilitate relevant designers in setting empty layers and their layer names for special effects resources that require background attributes during the layer information setting stage. It can automatically and effectively set empty layers and their layer names for relevant designers for special effects resources that require background attributes, thereby improving the generation efficiency of special effects resource files. Specifically, during the layer information setting stage, terminal 110 can provide an indicator control for the background addition requirements of the special effects resource file to be generated. For a special effects resource to be generated that requires background addition attributes, the relevant designer can input a portion of the layer information that it should originally have into terminal 110, which is recorded as the existing layer information of the special effects resource file to be generated. The relevant designer can trigger the operation of the aforementioned indicator control at this time by clicking or other means. In response to the operation, terminal 110 creates an empty layer based on the aforementioned existing layer information. At this time, terminal 110 needs to set the layer name for the empty layer. Terminal 110 can read the layer name of the existing layer in the special effects resource file to be generated, i.e., the existing layer name. Based on the existing layer name, a preset layer name keyword is generated. The preset layer name keyword is a keyword not included in the existing layer name to avoid incorrect detection of empty layers during the output stage of the special effects resource file. As an example, terminal 110 can preset some keyword sets, such as BK, BJ, background, etc. Thus, terminal 110 can select a keyword not included in the existing layer name from the keyword set as the preset layer name keyword based on the existing layer name. Next, the terminal 110 can generate the layer name of the empty layer based on the preset layer naming keyword. For example, the layer name of the empty layer can be directly set to the preset layer naming keyword, so that the output stage of the special effects resource file can effectively and quickly determine whether it contains an empty layer with preset naming characteristics by matching the keyword.
[0053] Furthermore, in one embodiment, the process of generating an empty layer name based on a preset layer naming keyword in the above embodiments may further include:
[0054] Based on the preset layer naming keywords, obtain the layer names containing the preset layer naming keywords, and set the layer names containing the preset layer naming keywords as the layer names of empty layers; when it is detected that the layer names of other layers in the effect resource file to be generated contain the preset layer naming keywords, obtain the updated preset layer naming keywords based on the preset layer naming keywords and preset characters, and update the layer names of empty layers according to the updated preset layer naming keywords.
[0055] In this embodiment, after inputting some layer information, the designer can click the indicator control. Then, the terminal 110 can create an empty layer and select a keyword not included in the existing layer names from the keyword set as the preset layer name keyword. This preset layer name keyword, such as "background," can then be used to set the layer name of the empty layer. Considering that the designer can still continuously input other layer information or change the previous layer information, this is recorded as the layer information of other layers in the special effects resource file to be generated. This layer information includes layer names, which are the layer names of the other layers in the special effects resource file to be generated. Among these layer names, there may be layer names that contain keywords from the already set empty layer names. To ensure that the output stage of the special effects resource file can effectively and quickly determine whether there are empty images with preset naming characteristics based on keyword matching, further steps are taken. In this embodiment, the layer names of subsequent layers in the special effects resource file can be continuously detected. When it is detected that the layer names of subsequent layers contain preset layer naming keywords, the preset layer naming keywords need to be updated. The terminal 110 can obtain updated preset layer naming keywords based on the preset layer naming keywords and preset characters. For example, the terminal 110 can combine the preset layer naming keywords with special characters such as ## to obtain updated preset layer naming keywords. Then, the corresponding part of the layer name of the empty layer can be updated according to the updated preset layer naming keywords. For example, if the preset layer naming keyword background is updated to #background#, the corresponding part background in the layer name background2 of the empty layer can be updated to #background#, and the updated layer name of the empty layer is #background#2.
[0056] Furthermore, in one embodiment, the relevant designer can trigger multiple operations on the aforementioned indicator control through methods such as multiple clicks. In the case of multiple operations, the layer naming based on preset layer naming keywords in the aforementioned embodiment to generate empty layer names may include:
[0057] Based on preset layer naming keywords and the number of operations, generate layer names that include preset layer naming keywords and the number of operations.
[0058] In this embodiment, a special effects resource can be configured to have the attribute of adding multiple background images. Specifically, designers can repeatedly manipulate the aforementioned indicator control to allow the terminal 110 to set this attribute for the special effects resource. During the layer information setting phase, after the designer clicks the indicator control, the terminal 110 automatically creates an empty layer for the special effects resource and generates its layer name. The terminal 110 can name the empty layer "background1" based on the preset layer naming keyword "background". When the designer clicks the indicator control again, the terminal 110 generates a layer name "background2" containing the preset layer naming keyword and the number of operations, thereby automatically setting the number of background image layers for the special effects resource and further improving the flexibility of the special effects resource file configuration.
[0059] In some embodiments, generating tagging data for marking backgrounds of special effects resources in step S203 may include:
[0060] Detect the number of operations contained in the layer name of the empty layer; based on the number of operations, obtain the number of background layers that can be added; based on the number of background layers that can be added, generate labeled data carrying the information of the number of background layers that can be added.
[0061] In this embodiment, designers can manually or automatically configure the number of background images that can be added to special effects resources, either manually or automatically by the terminal 110, thereby improving the flexibility of configuring special effects resource files. Specifically, during the layer information setting stage, in the manual case, designers create an empty layer and name it with a preset layer naming keyword and operation count information, such as background2. In the case of automatic configuration by the terminal 110, designers can click the indicator control multiple times to make the terminal 110 automatically create an empty layer and name it with a preset layer naming keyword and operation count information, such as background2. Based on this, during the special effects file output stage, after the terminal 110 detects that the layer information contains an empty layer with a preset naming feature, it further detects the operation count information contained in the layer name of the empty layer, such as the 2 in the aforementioned layer name background2. The terminal 110 obtains the number of background layers that can be added based on this operation count information. If the operation count information is N, then the number of background layers that can be added is N. Then, the terminal 110 generates marker data carrying the background layer addition information based on the background layer addition information, so as to carry the marker data containing the background layer addition information in the special effects resource file, thereby further improving the flexibility of the special effects resource file configuration and the display form and style of the special effects resources.
[0062] Furthermore, based on the above embodiments, in one embodiment, the step S204 of generating a special effects resource file carrying the marked data according to the layer information and the marked data may include: based on generating a special effects resource file according to the layer information, writing the marked data into a preset field of the special effects resource file to obtain a special effects resource file carrying the marked data. This special effects resource file can be used by the terminal to obtain the background image data corresponding to each background layer when parsing the marked data from the preset field and obtaining the background layer information, and then rendering the special effects resource data sequentially according to the background layer order.
[0063] Specifically, taking an MP4 file as an example, after terminal 110 generates marker data carrying information about the number of background layers that can be added, it can use the ffmpeg tool to generate a corresponding MP4 effects resource file based on the layer information. Then, via the ffmpeg command line, it writes the JSON data (corresponding to the marker data) carrying the information about the number of background layers into the metadata field (corresponding to the preset field) of the MP4 effects resource file. Thus, terminal 110 obtains an MP4 effects resource file containing marker data carrying information about the number of background layers that can be added. Terminal 110 can then send this MP4 effects resource file to the terminal that requires it via server 120. After receiving the MP4 effects resource file, the terminal 110 parses the data carrying the marker data from the metadata field of the MP4 effects resource file. The system uses marker data to indicate the number of background layers that can be added. Based on this marker data, the terminal can obtain the background image data corresponding to each background layer. For example, if the number of background layers that can be added is 2, the terminal can obtain the background image data corresponding to the first and second background layers. Then, it can render the background image data corresponding to the second background layer first, and then render the background image data corresponding to the first background layer, according to the background layer order. After the background image data corresponding to the two background layers are rendered, the special effects resource data obtained from the MP4 special effects resource file is rendered. This achieves the effect of playing special effects resources with corresponding multi-layered background images as backgrounds, further improving the flexibility of special effects resource file configuration, enriching the display methods and styles of special effects resources, and further enhancing the display effect of special effects resources.
[0064] In one embodiment, such as Figure 3As shown, a live streaming system is also provided, which may include a terminal and a live streaming server. The live streaming server is configured to acquire a live streaming special effects resource file carrying marker data generated according to the method for generating special effects resource files as described in any of the preceding embodiments, and send it to the terminal of the live streaming system. Specifically, the live streaming server can acquire the live streaming special effects resource file carrying marker data from a provider of the live streaming special effects resource file. The marker data is used to mark that the live streaming special effects resource has an attribute where a background can be added. The provider of the live streaming special effects resource file, such as terminal 110, can generate the live streaming special effects resource file carrying marker data according to the method for generating special effects resource files as described in any of the preceding embodiments and then send it to the live streaming server. After obtaining the live streaming special effects resource file, the live streaming server sends it to the terminal of the live streaming system. Thus, the terminal of the live streaming system, upon receiving the live streaming special effects resource file carrying marker data sent by the live streaming server, combines the live streaming special effects resource file carrying marker data with corresponding background image data to play the live streaming special effects resource with the corresponding background image as the background in the live streaming screen. Specifically, the terminal of this live streaming system can obtain the marker data after parsing the live streaming effect resource file carrying the marker data. When the terminal parses the marker data, it can determine that the live streaming effect resource file is a live streaming effect resource file with background attributes that can be added. The terminal can also obtain, for example, background image data provided by the live streaming server. Therefore, the terminal can render based on the background image data provided by the live streaming server and the live streaming effect resource data parsed from the live streaming effect resource file. It renders the background image data first and then renders the live streaming effect resource data. In this way, live streaming effect resources with the corresponding background image as the background can be played in the live streaming screen. As an application example, such as... Figure 4 As shown, the terminal of the live streaming system can play live streaming special effects resources 420 with background image 430 as the background in the live streaming screen 410, thereby improving the flexibility of the configuration of live streaming special effects resource files, and enabling the terminal of the live streaming system to add backgrounds to the live streaming special effects resources according to the marking and business scenario requirements, thereby enriching the display methods and styles of live streaming special effects resources and improving the display effect of live streaming special effects resources.
[0065] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0066] Based on the same inventive concept, this application also provides an apparatus for generating special effects resource files to implement the method for generating special effects resource files described above. The solution provided by this apparatus is similar to the solution described in the above method. Therefore, the specific limitations in one or more apparatus embodiments for generating special effects resource files provided below can be found in the limitations of the method for generating special effects resource files above, and will not be repeated here.
[0067] In one embodiment, such as Figure 5 As shown, an apparatus for generating special effects resource files is provided. The apparatus 500 may include:
[0068] Layer acquisition module 501 is used to acquire layer information for generating special effects resource files;
[0069] The layer detection module 502 is used to detect whether the layer information contains an empty layer with a preset naming feature;
[0070] The marker generation module 503 is used to generate marker data that can be added to the background of the special effects resource if the layer information contains an empty layer with a preset naming feature.
[0071] The file generation module 504 is used to generate a special effects resource file carrying the marker data according to the layer information and marker data; the special effects resource file is used by the terminal to render the special effects resource with the corresponding background image as the background when the terminal parses the marker data, according to the corresponding background image data and the special effects resource data parsed from the special effects resource file.
[0072] In one embodiment, the layer detection module 502 is used to obtain a preset layer naming keyword; perform keyword matching in the layer names corresponding to each layer contained in the layer information according to the preset layer naming keyword; if the matching result indicates that there is a layer name containing the preset layer naming keyword in the layer names corresponding to each layer, then it is determined that the layer information contains the empty layer with the preset naming feature.
[0073] In one embodiment, the device 500 may further include: a layer setting module for providing an indicator control for adding background to a special effects resource file to be generated; in response to an operation of the indicator control, creating an empty layer based on existing layer information of the special effects resource file to be generated, generating a preset layer naming keyword based on the existing layer names of the special effects resource file to be generated; and generating a layer name for the empty layer based on the preset layer naming keyword.
[0074] In one embodiment, the operation is a series of operations; the layer setting module is used to generate a layer name containing the preset layer naming keyword and the number of operations based on the preset layer naming keyword and the number of operations.
[0075] In one embodiment, the layer setting module is configured to obtain a layer name containing the preset layer naming keyword based on the preset layer naming keyword, and set the layer name containing the preset layer naming keyword as the layer name of the empty layer; when it is detected that the layer name of other subsequent layers of the special effects resource file to be generated contains the preset layer naming keyword, an updated preset layer naming keyword is obtained based on the preset layer naming keyword and preset characters, and the layer name of the empty layer is updated according to the updated preset layer naming keyword.
[0076] In one embodiment, the marker generation module 503 is used to detect the number of operation counts contained in the layer name of the empty layer; obtain the number of background layers that can be added based on the number of operation counts; and generate the marker data carrying the information on the number of background layers that can be added based on the number of background layers that can be added.
[0077] In one embodiment, the file generation module 504 is used to generate an effects resource file based on the layer information, and then write the marker data into a preset field of the effects resource file to obtain an effects resource file carrying the marker data; wherein, the effects resource file is used by the terminal to obtain the background image data corresponding to each background layer when parsing the marker data from the preset field and obtaining the background layer information, and then rendering the effects resource data after rendering the background image data in the order of the background layers.
[0078] Each module in the aforementioned device for generating special effects resource files can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in an electronic device, or stored in the memory of the electronic device as software, so that the processor can call and execute the operations corresponding to each module.
[0079] In one embodiment, an electronic device is provided, which can be a server or a terminal, and its internal structure diagram can be as follows. Figure 6 As shown, the electronic device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The network interface is used to communicate with external devices via a network connection. When the computer program is executed by the processor, it implements a method for generating special effects resource files.
[0080] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0081] In one embodiment, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above method embodiments.
[0082] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0083] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0084] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0085] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A method for generating special effects resource files, characterized in that, The method includes: Obtain the layer information used to generate special effects resource files; Detect whether the layer information contains an empty layer with a preset naming characteristic; If the layer information includes an empty layer with a preset naming feature, then markup data for marking the background that can be added to the special effects resource is generated, including: detecting the number of operation times information contained in the layer name of the empty layer; obtaining the number of background layers that can be added based on the number of operation times information; and generating the markup data carrying the information on the number of background layers that can be added based on the number of background layers that can be added. Based on the layer information and the marker data, a special effects resource file carrying the marker data is generated; the special effects resource file is used by the terminal to render the special effects resource with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
2. The method according to claim 1, characterized in that, The step of detecting whether the layer information contains an empty layer with a preset naming characteristic includes: Get the preset layer naming keywords; Based on the preset layer naming keywords, keyword matching is performed in the layer names corresponding to each layer contained in the layer information; If the matching result indicates that there is a layer name containing the preset layer naming keyword in the layer name corresponding to each layer, then it is determined that the layer information includes the empty layer with the preset naming feature.
3. The method according to claim 2, characterized in that, The method further includes: Provides indicator controls for adding desired backgrounds to the special effects resource files to be generated; In response to the operation of the indicator control, an empty layer is created based on the existing layer information of the special effects resource file to be generated, and a preset layer naming keyword is generated according to the existing layer names of the special effects resource file to be generated. Based on the preset layer naming keywords, generate the layer name for the empty layer.
4. The method according to claim 3, characterized in that, The operation involves multiple steps; generating the layer name for the empty layer based on the preset layer naming keywords includes: Based on the preset layer naming keywords and the number of operations, generate a layer name that includes the preset layer naming keywords and the number of operations.
5. The method according to claim 3, characterized in that, The process of generating a layer name for the empty layer based on the preset layer naming keywords includes: Based on the preset layer naming keywords, obtain the layer name containing the preset layer naming keywords, and set the layer name containing the preset layer naming keywords as the layer name of the empty layer; When it is detected that the layer names of other layers in the special effects resource file to be generated contain the preset layer naming keyword, an updated preset layer naming keyword is obtained based on the preset layer naming keyword and preset characters, and the layer name of the empty layer is updated according to the updated preset layer naming keyword.
6. The method according to claim 1, characterized in that, The step of generating a special effects resource file carrying the marker data based on the layer information and marker data includes: Based on the generated special effects resource file according to the layer information, the marker data is written into the preset field of the special effects resource file to obtain the special effects resource file carrying the marker data; wherein, the special effects resource file is used by the terminal to obtain the background image data corresponding to each background layer when parsing the marker data from the preset field and obtaining the background layer information, and then rendering the special effects resource data in the order of background layer.
7. A live streaming system, characterized in that, The system includes: a terminal and a live streaming server; wherein... The live streaming server is used to obtain the live streaming special effects resource file carrying marker data generated by the method according to any one of claims 1 to 6, and send it to the terminal; The terminal is used to play live effects resources with corresponding background images as backgrounds in the live broadcast screen based on the live effects resource file carrying the marked data and the corresponding background image data.
8. An apparatus for generating special effects resource files, characterized in that, The device includes: The layer acquisition module is used to obtain layer information for generating special effects resource files; The layer detection module is used to detect whether the layer information contains an empty layer with a preset naming feature; A marker generation module is used to generate marker data for marking the background of special effects resources that can be added if the layer information includes an empty layer with a preset naming feature. The marker data includes: detecting the number of operation times information contained in the layer name of the empty layer; obtaining the number of background layers that can be added based on the number of operation times information; and generating the marker data carrying the information on the number of background layers that can be added based on the number of background layers that can be added. The file generation module is used to generate a special effects resource file carrying the marker data based on the layer information and marker data. The special effects resource file is used by the terminal to render the special effects resource file with the corresponding background image as the background when the terminal parses the marker data, based on the corresponding background image data and the special effects resource data parsed from the special effects resource file.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Animation configuration method and device, animation playing method and device, electronic equipment, system and medium
CN111818354A
Animation processing method and device, computer readable storage medium and computer equipment
CN112073794A
Video data processing method, device and equipment, storage medium and program product
CN113613062A