Method and device for setting subtitle background color in Ass format and electronic equipment

By processing video frame data of Ass format subtitles and creating regular rectangular background image data, the problem of irregular background colors in the case of multiple lines of Ass format subtitles is solved, and the viewing experience and information communication are improved.

CN119814946APending Publication Date: 2025-04-11WANGXU TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411939975.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-26
Publication Date
2025-04-11

AI Technical Summary

Technical Problem

The background color displayed in Ass format subtitles in multiple lines is irregular, which affects the viewing experience and the effectiveness of information communication.

Method used

By obtaining the subtitle data of the video frame, determining the height and width of the text data, and creating rectangular background image data based on the first background color, processing it in combination with the text image data, and generating new Ass subtitle data to achieve regular subtitle background color.

Benefits of technology

The regular background color display of Ass format subtitles is realized, which improves the effectiveness of viewing experience and information communication.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119814946A_ABST
    Figure CN119814946A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for setting subtitle background colors in an Ass format and electronic equipment, and relates to the field of subtitle processing, and the method comprises the steps: obtaining subtitle data of each video frame in a video in response to a setting request for replacing the subtitle background colors; the subtitle data comprises text data and text image data displayed by the text data in corresponding video frames; the setting request comprises a first background color to be set; for any text data, determining the height and the width based on the boundary data of the text image data corresponding to the text data; determining rectangular background image data with the first background color based on the height, the width and the first background color; and processing the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame. According to the method, the regular subtitle background color is added to the subtitles in the AAs format, so that the watching experience feeling and the effectiveness of information transmission are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of subtitle processing, and in particular to a method, device and electronic device for setting the background color of subtitles in an Ass format. Background Art

[0002] In Ass format subtitles, when setting the background color for subtitles, when the subtitles have multiple lines (a subtitle is automatically changed to multiple lines or there is a line break in the middle of the subtitles), such as bilingual subtitles, the text content in a subtitle bar is composed of bilingual plus line breaks. The background color actually displayed by the subtitles in the video is an irregular image, which affects the viewing experience and the effectiveness of information transmission. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a method, device and electronic device for setting the subtitle background color in Ass format, so as to solve the above-mentioned problems existing in the prior art, and to obtain a regular subtitle background color to improve the viewing experience.

[0004] In a first aspect, a method for setting a subtitle background color in an Ass format is provided, and the method may include:

[0005] In response to a setting request for changing the subtitle background color, obtaining subtitle data of each video frame in the video; the subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes a first background color to be set;

[0006] For any text data, determine the height and width based on the boundary data of the text image data corresponding to the text data;

[0007] Determine rectangular background image data having the first background color based on the height, the width and the first background color;

[0008] The rectangular background image data and the text image data are processed to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0009] In a possible implementation, processing the rectangular background image data and the text image data includes:

[0010] Based on the configured Layer value, respectively set the view level of the rectangular background image data and the text image data;

[0011] The level of the text data is greater than the view level of the rectangular background image data.

[0012] In a possible implementation, after respectively setting the view levels of the rectangular background image data and the text image data, the method further includes:

[0013] The text image data is set at the center of the rectangular background image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0014] In a possible implementation, the setting request further includes a second background color to be set;

[0015] Before processing the rectangular background image data and the text image data, the method further includes:

[0016] Filling the second background color as the background color of the text data to obtain processed text image data;

[0017] The rectangular background image data and the processed text image data are processed to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0018] In a possible implementation, the text data is data consisting of one or more lines of text; wherein the text is Chinese text and / or non-Chinese text.

[0019] In a possible implementation, the boundary data based on the text image data corresponding to the text data includes:

[0020] When the data is multiple lines of text, the length of the longest text line in the multiple lines of text is used as the length of the text image data, and the total height of the multiple lines of text is used as the height of the text image data.

[0021] In a possible implementation, after determining the rectangular background image data having the first background color, the method further includes:

[0022] Based on the number of lines of the text data, the area of ​​the rectangular background image data is divided horizontally to obtain multiple sub-areas, and based on the configured different background colors, the multiple sub-areas are filled with background colors to obtain rectangular background image data composed of different background colors.

[0023] In a second aspect, a device for setting a subtitle background color in an Ass format is provided, and the device may include:

[0024] An acquisition unit, configured to acquire subtitle data of each video frame in a video in response to a setting request for changing a subtitle background color; the subtitle data includes text data and text image data of the text data displayed in a corresponding video frame; the setting request includes a first background color to be set;

[0025] A determination unit, used for determining the height and width of any text data based on the boundary data of the text image data corresponding to the text data;

[0026] and, based on the height, the width and the first background color, determining rectangular background image data having the first background color;

[0027] The processing unit is used to process the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0028] In a third aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0029] Memory, used to store computer programs;

[0030] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.

[0031] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0032] The present application provides a method for setting the background color of subtitles in Ass format, the method comprising: in response to a setting request for changing the background color of subtitles, obtaining subtitle data of each video frame in a video; the subtitle data comprises: text data and text image data displayed by the text data in the corresponding video frame; the setting request comprises a first background color to be set; for any text data, determining the height and width based on the boundary data of the text image data corresponding to the text data; determining the rectangular background image data having the first background color based on the height, width and the first background color; processing the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame. The present application adds a regular subtitle background color to subtitles in Ass format, thereby improving the viewing experience and the effectiveness of information transmission. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0034] Figure 1 A system architecture diagram of a method for setting the background color of subtitles in Ass format provided in an embodiment of the present application;

[0035] Figure 2 A flowchart of a method for setting the background color of subtitles in Ass format provided in an embodiment of the present application;

[0036] Figure 3 A schematic diagram of an irregular subtitle background in Ass format in the prior art;

[0037] Figure 4 A schematic diagram of an irregular subtitle background in Ass format in the prior art;

[0038] Figure 5 A schematic diagram of a regular subtitle background provided by an embodiment of the present application;

[0039] Figure 6 A schematic diagram of a regular subtitle background provided by an embodiment of the present application;

[0040] Figure 7 A schematic diagram of the structure of a device for setting the background color of subtitles in Ass format provided in an embodiment of the present application;

[0041] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0042] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0043] The method for setting the background color of subtitles in Ass format provided in the embodiment of the present application can be applied to Figure 1 In the system architecture shown in Figure 1As shown, the system may include: servers and terminals in the background of the enterprise. The server may be a physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal may be a user equipment (UE) such as a mobile phone, smart phone, laptop, digital broadcast receiver, personal digital assistant (PDA), tablet computer (PAD), handheld device, vehicle-mounted device, wearable device, computing device or other processing device connected to a wireless modem, mobile station (MS), mobile terminal, etc. The terminal and the server may be directly or indirectly connected by wired or wireless communication, which is not limited in this application.

[0044] The terminal is used to obtain a setting request for changing the subtitle background color and corresponding video data, and send the video data and the setting request to the server.

[0045] The server is used to receive video data and the setting request, and respond to the setting request for changing the subtitle background color to execute a method for setting the subtitle background color in an Ass format provided by the present application.

[0046] In offline videos, subtitles in Ass format are commonly used. Subtitles in Ass format support complex styles and special effects, such as fonts, colors, positions, etc. Subtitles in Ass format are composed of lines of subtitles, each of which contains the time code, text content, and style information of the subtitles.

[0047] The player can directly load subtitle files in Ass format to display subtitles, or the subtitle file in Ass format can have the same name as the video and be placed in the same directory, and the player can automatically load it, or render the ass subtitles into the video through code.

[0048] In Ass format subtitles, when setting the background color for subtitles, when the subtitles have multiple lines (a subtitle is automatically changed to multiple lines or there is a line break in the middle of the subtitles), such as bilingual subtitles, the text content in a subtitle bar is composed of bilingual plus line breaks. The background color actually displayed by the subtitles in the video is an irregular image, which affects the viewing experience and the effectiveness of information transmission.

[0049] Therefore, the embodiment of the present application provides a method for setting the subtitle background color in the Ass format, which is used to solve the above-mentioned problems existing in the prior art, and can obtain a regular subtitle background color to improve the viewing experience.

[0050] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0051] Figure 2 The following is a flow chart of a method for setting the background color of subtitles in Ass format provided in an embodiment of the present application. Figure 2 As shown, the method may include:

[0052] Step S210: In response to a setting request for changing the subtitle background color, obtaining subtitle data of each video frame in the video.

[0053] The subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes a first background color and a second background color to be set.

[0054] It can be understood that text data refers to the text content and the attributes of the text content (size and font); text image data refers to the image of the text content displayed in the corresponding video frame, the image position and the start and end time points of the text data in the video, that is, the corresponding start and end video frames.

[0055] Since the video frame corresponds to an image, the subtitle data cannot be directly obtained. The acquisition process may include: obtaining through the voice acquisition model configured in the interface corresponding to the audio data. The voice acquisition model can extract the subtitle data in each video frame in the video; it can be understood that the subtitle data includes text data and the time period when the text data is displayed in the video (that is, the time points when the text data starts and ends in the video are obtained).

[0056] The corresponding text image data is obtained by loading the subtitle file in Ass format through the Libass library.

[0057] The subtitle strip in Ass format is as follows: Format:Layer,Start,End,Style,Name,MarginL,MarginR,MarginV,Effect,Text.

[0058] It should be noted that subtitle data can be descriptive subtitles, informative subtitles and emphasis subtitles. Descriptive subtitles are mainly used to supplement the picture information, such as the introduction of historical background; informative subtitles are independent and convey independent information; emphasis subtitles are used to highlight important information and enhance the audience's attention and understanding.

[0059] Step S220: for any text data, determine the height and width based on the boundary data of the text image data corresponding to the text data.

[0060] Specifically, for any text data, the text data is set as an Ass subtitle file, and the Ass subtitle file has unique identification information.

[0061] That is to say, each text data has corresponding identification information, and the Ass subtitle file is loaded by calling the Libass library (Libass is an open source library used to render subtitles). A linked list pointer of text image data is obtained by rendering the subtitles, and the linked list of subtitle images is traversed to calculate the boundary of each text image data to obtain the actual displayed height and width of each text image data.

[0062] In some embodiments, the text data is data consisting of one or more lines of text; wherein the text is Chinese text and / or non-Chinese text.

[0063] In another example, when the text data is multiple lines of text, the length of the longest text line in the multiple lines of text is used as the length of the text image data, and the total height of the multiple lines of text is used as the height of the text image data. In other words, subtitles in Ass format may divide a line of text content into multiple lines for display (multiple text image data), so the sizes of these images need to be merged to obtain the height of the entire line of subtitles.

[0064] Step S230: Determine rectangular background image data having the first background color based on the determined height, width and first background color.

[0065] Specifically, based on the determined height and width, a vector graphic of a rectangular block is created by using the p1 command, eg: {\p1}m 0 0l 100 0l 100 100l 0 100l 0 0;

[0066] Afterwards, the created vector graphics of the rectangular block are filled with the first background color, thereby obtaining rectangular background image data with the first background color.

[0067] In some embodiments, after determining the rectangular background image data having the first background color, the method further includes:

[0068] Based on the number of lines of text data, the area of ​​the rectangular background image data is horizontally divided to obtain multiple sub-areas, and based on the configured different background colors, the multiple sub-areas are filled with background colors to obtain rectangular background image data composed of different background colors. Specifically, the actual number of lines of text data can be obtained by rendering through the Libass library, and then the background color of each sub-area of ​​the rectangular background image data is set to a different color.

[0069] Step S240: Process the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0070] Specifically, before processing the rectangular background image data and the text image data, the method further includes:

[0071] Filling the second background color into the background color of the text data to obtain processed text image data;

[0072] This process can be understood as follows: the text data is a subtitle bar with text content, and the subtitle bar also needs to be set with a certain background color (second background color), but the color of the second background color is set to be extremely light and transparent (almost visually invisible), so that the rendered size is consistent with the size of the rectangular background image data.

[0073] Based on the configured Layer value, set the view level of the rectangular background image data and the text image data respectively;

[0074] The level of the text data is greater than the view level of the rectangular background image data.

[0075] This process can be understood as: ensuring that the Layer value of the subtitle bar of the text content is larger than the Layer value of the rectangular color block subtitle bar corresponding to the rectangular background image data, so that the text data can be displayed on the color block. The Layer values ​​of the two cannot be the same, otherwise there will be exclusion and they cannot be superimposed together.

[0076] Afterwards, the rectangular background image data and the processed text image data are superimposed to obtain new Ass subtitle data corresponding to the corresponding video frame. Specifically, during the superimposition process, the text image data is set at the center of the rectangular background image data.

[0077] It can be understood that, since the text image data includes the position of the image in the corresponding video frame, after superposition, the position of the new Ass subtitle data in the corresponding video frame can be determined.

[0078] In some embodiments, the rectangular background image data area can also be divided horizontally according to the language attribute of the text data to obtain multiple sub-areas; therefore, the background colors corresponding to the text data in different languages ​​can be displayed to be different. Specifically, the language attribute of the text data can first be identified by the configured language model to determine whether there is a language with multiple attributes in the text data; if so, the subtitles are identified with different identification information for the text data corresponding to different language attributes; then, background subtitles (rectangular background image data) of the text data with different language attributes are created respectively; similarly, different background subtitles are identified with different identification information. It can be understood that there is a corresponding relationship between the subtitles of the text data with different language attributes and the corresponding background subtitles. Afterwards, the subtitles of one of the text data are superimposed with the corresponding background subtitles; and so on, the superimposition of the subtitles of all the text data and the corresponding background subtitles is completed, and then, according to the arrangement order of each text data, the superimposed subtitles are spliced ​​to obtain the new Ass subtitle data corresponding to the corresponding video frame.

[0079] Combination Figure 3 and Figure 4 As shown, Figure 3 and Figure 4 It is an irregular subtitle background in Ass format in the prior art.

[0080] Combination Figure 5 and Figure 6 As shown, Figure 5 and Figure 6 Subtitle background for this application Ass format rules.

[0081] This application is for when the subtitles of a video need to display multiple lines of subtitles and a background color at the same time, and the shape of the background color is a regular rectangle. Since the background color of the multi-line subtitles in the Ass format cannot be displayed as a regular rectangle, at this time, a line of subtitle bars can be split into 2 lines of subtitle bars. One line of subtitle bars does not contain subtitle text content, and only a colored rectangular block is drawn. The colored rectangular block needs to set the width and height, and the other line of subtitle bars displays the text content. In this way, the background color of the multi-line subtitles can be displayed in the shape of a rectangle (a right-angled rectangle or a rounded rectangle) by superposition.

[0082] The present application provides a method for setting the background color of subtitles in Ass format, the method comprising: in response to a setting request for changing the background color of subtitles, obtaining subtitle data of each video frame in a video; the subtitle data comprises: text data and text image data displayed by the text data in the corresponding video frame; the setting request comprises a first background color to be set; for any text data, determining the height and width based on the boundary data of the text image data corresponding to the text data; determining the rectangular background image data having the first background color based on the height, width and the first background color; processing the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame. The present application adds a regular subtitle background color to subtitles in Ass format, thereby improving the viewing experience and the effectiveness of information transmission.

[0083] Corresponding to the above method, the embodiment of the present application also provides a device for setting the background color of subtitles in Ass format, such as Figure 7 As shown, the device comprises:

[0084] The acquisition unit 710 is used to acquire the subtitle data of each video frame in the video in response to the setting request of changing the subtitle background color; the subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes the first background color to be set;

[0085] A determination unit 720, configured to determine the height and width of any text data based on the boundary data of the text image data corresponding to the text data;

[0086] and, based on the height, the width and the first background color, determining rectangular background image data having the first background color;

[0087] The processing unit 730 is used to process the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0088] The functions of the various functional units of the device for setting the subtitle background color in the Ass format provided in the above embodiment of the present application can be implemented through the above method steps. Therefore, the specific working process and beneficial effects of the various units in the device for setting the subtitle background color in the Ass format provided in the embodiment of the present application are not repeated here.

[0089] The present application also provides an electronic device, such as Figure 8 As shown, it includes a processor 810 , a communication interface 820 , a memory 830 and a communication bus 840 , wherein the processor 810 , the communication interface 820 , and the memory 830 communicate with each other via the communication bus 840 .

[0090] Memory 830, used for storing computer programs;

[0091] The processor 810 is used to execute the program stored in the memory 830 to implement the following steps:

[0092] In response to a setting request for changing the subtitle background color, obtaining subtitle data of each video frame in the video; the subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes a first background color to be set;

[0093] For any text data, determine the height and width based on the boundary data of the text image data corresponding to the text data;

[0094] Determine rectangular background image data having the first background color based on the height, the width and the first background color;

[0095] The rectangular background image data and the text image data are processed to obtain new Ass subtitle data corresponding to the corresponding video frame.

[0096] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0097] The communication interface is used for communication between the above electronic device and other devices.

[0098] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0099] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0100] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 2 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0101] In another embodiment provided by the present application, a computer-readable storage medium is also provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes a method for setting the subtitle background color in an Ass format as described in any of the above embodiments.

[0102] In another embodiment provided by the present application, a computer program product including instructions is also provided. When the computer program product is run on a computer, the computer executes a method for setting a subtitle background color in an Ass format as described in any of the above embodiments.

[0103] Those skilled in the art will appreciate that the embodiments in the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt a complete hardware embodiment, a complete software embodiment, or a form of an embodiment combining software and hardware. Moreover, the present application may adopt a form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.

[0104] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0105] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0106] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.

[0107] Unless otherwise defined, the technical terms or scientific terms used in this application should be understood by people with ordinary skills in the field to which the present invention belongs. "First", "second" and similar words used in this application do not indicate any order, quantity or importance, but are only used to distinguish different components. "Include" or "comprise" and similar words mean that the elements or objects appearing before the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect", "couple" or "connected" and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.

[0108] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they are aware of the basic creative concepts. Therefore, the present application embodiments are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application embodiments.

[0109] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application are within the scope of the embodiments in the present application and their equivalents, the embodiments in the present application are also intended to include these modifications and variations.

Claims

1. A method for setting the background color of subtitles in Ass format, characterized in that: The method comprises: In response to a setting request for changing the subtitle background color, obtaining subtitle data of each video frame in the video; the subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes a first background color to be set; For any text data, determine the height and width based on the boundary data of the text image data corresponding to the text data; Determine rectangular background image data having the first background color based on the height, the width and the first background color; The rectangular background image data and the text image data are processed to obtain new Ass subtitle data corresponding to the corresponding video frame.

2. The method according to claim 1, characterized in that Processing the rectangular background image data and the text image data includes: Based on the configured Layer value, respectively set the view level of the rectangular background image data and the text image data; The level of the text data is greater than the view level of the rectangular background image data.

3. The method according to claim 1, characterized in that After respectively setting the view levels of the rectangular background image data and the text image data, the method further includes: The text image data is set at the center of the rectangular background image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

4. The method according to claim 1, characterized in that The setting request also includes a second background color to be set; Before processing the rectangular background image data and the text image data, the method further includes: Filling the second background color as the background color of the text data to obtain processed text image data; The rectangular background image data and the processed text image data are processed to obtain new Ass subtitle data corresponding to the corresponding video frame.

5. The method according to claim 1, characterized in that The text data is data consisting of one or more lines of text; wherein the text is Chinese text and / or non-Chinese text.

6. The method according to claim 5, characterized in that The boundary data based on the text image data corresponding to the text data includes: When the data is multiple lines of text, the length of the longest text line in the multiple lines of text is used as the length of the text image data, and the total height of the multiple lines of text is used as the height of the text image data.

7. The method according to claim 5, characterized in that After determining the rectangular background image data having the first background color, the method further includes: Based on the number of lines of the text data, the area of ​​the rectangular background image data is divided horizontally to obtain multiple sub-areas, and based on the configured different background colors, the multiple sub-areas are filled with background colors to obtain rectangular background image data composed of different background colors.

8. A device for setting the background color of subtitles in Ass format, characterized in that: The device comprises: An acquisition unit is used to acquire subtitle data of each video frame in the video in response to a setting request for changing the subtitle background color; the subtitle data includes: text data and text image data of the text data displayed in the corresponding video frame; the setting request includes a first background color to be set; A determination unit, used for determining the height and width of any text data based on the boundary data of the text image data corresponding to the text data; and, based on the height, the width and the first background color, determining rectangular background image data having the first background color; The processing unit is used to process the rectangular background image data and the text image data to obtain new Ass subtitle data corresponding to the corresponding video frame.

9. An electronic device, characterized in that: The electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, for implementing the method steps described in any one of claims 1 to 7 when executing a program stored in a memory.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method steps described in any one of claims 1 to 7 are implemented.