CN113438514B - Subtitle processing method, device, equipment and storage medium - Google Patents

Subtitle processing method, device, equipment and storage medium Download PDF

Info

Publication number
CN113438514B
CN113438514B CN202110455647.3A CN202110455647A CN113438514B CN 113438514 B CN113438514 B CN 113438514B CN 202110455647 A CN202110455647 A CN 202110455647A CN 113438514 B CN113438514 B CN 113438514B
Authority
CN
China
Prior art keywords
subtitle
target
preset
attribute value
original
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110455647.3A
Other languages
Chinese (zh)
Other versions
CN113438514A (en
Inventor
伍洋
罗阳志
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen TCL New Technology Co Ltd
Original Assignee
Shenzhen TCL New Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen TCL New Technology Co Ltd filed Critical Shenzhen TCL New Technology Co Ltd
Priority to CN202110455647.3A priority Critical patent/CN113438514B/en
Publication of CN113438514A publication Critical patent/CN113438514A/en
Priority to JP2023560195A priority patent/JP2024513380A/en
Priority to PCT/CN2022/083209 priority patent/WO2022227974A1/en
Application granted granted Critical
Publication of CN113438514B publication Critical patent/CN113438514B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • H04N21/2355Processing of additional data, e.g. scrambling of additional data or processing content descriptors involving reformatting operations of additional data, e.g. HTML pages
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/23Processing of content or additional data; Elementary server operations; Server middleware
    • H04N21/235Processing of additional data, e.g. scrambling of additional data or processing content descriptors
    • H04N21/2355Processing of additional data, e.g. scrambling of additional data or processing content descriptors involving reformatting operations of additional data, e.g. HTML pages
    • H04N21/2356Processing of additional data, e.g. scrambling of additional data or processing content descriptors involving reformatting operations of additional data, e.g. HTML pages by altering the spatial resolution
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • H04N21/4355Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream involving reformatting operations of additional data, e.g. HTML pages on a television screen
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/435Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream
    • H04N21/4355Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream involving reformatting operations of additional data, e.g. HTML pages on a television screen
    • H04N21/4356Processing of additional data, e.g. decrypting of additional data, reconstructing software from modules extracted from the transport stream involving reformatting operations of additional data, e.g. HTML pages on a television screen by altering the spatial resolution, e.g. to reformat additional data on a handheld device, attached to the STB
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/488Data services, e.g. news ticker
    • H04N21/4884Data services, e.g. news ticker for displaying subtitles

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention relates to a subtitle processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: acquiring configuration information of a target subtitle, wherein the configuration information comprises an original system of the target subtitle and a first attribute value of a target style attribute; when the original system is different from a preset system, modifying the first attribute value into a second attribute value according to the corresponding relation between the original system and the preset system; and rendering the target subtitles on the canvas corresponding to the preset system according to the second attribute value. By using the subtitle processing method, the canvas reconstruction in the system switching process can be avoided, and the system performance can be improved.

Description

Subtitle processing method, device, equipment and storage medium
Technical Field
The present invention relates to the field of multimedia technologies, and in particular, to a method, an apparatus, a device, and a storage medium for processing subtitles.
Background
The statements herein merely provide background information related to the present disclosure and may not necessarily constitute prior art.
With the popularization of 4K technology and the increasing importance of TTML2(time Text Markup Language, second edition) caption specification, the requirements for captions are increasing, and in the japanese ISDB-S3 standard (third generation integrated services digital broadcasting standard), TTML captions can be divided into multiple systems, generally including 2K system, 4K system, 8K system, and the like. Briefly, the difference between the 2K and 4K systems includes that the two systems are different in canvas, such as when the range of the subtitle region is represented as 960 × 540px, for the 2K canvas (1920 × 1080px), the rendering map will occupy 1/4 on the display screen, and for the 4K canvas (3840 × 2160px), the display field will be 1/16. On the other hand, to form a subtitle occupying the display field of the screen 1/4, 2K requires a graph of 960 × 540px, and 4K requires a graph of 1920 × 1080 px.
For the general audience, the different systems only have different reference objects and have scaling relations. However, for the realization of subtitles, subtitles of different systems have great difference in memory usage, and when different systems are switched, canvas reconstruction needs to be frequently performed, which has a certain influence on system performance.
Disclosure of Invention
The invention aims to provide a novel subtitle processing method, a device, equipment and a storage medium.
The purpose of the invention is realized by adopting the following technical scheme. The subtitle processing method provided by the invention comprises the following steps: acquiring configuration information of a target subtitle, wherein the configuration information comprises an original system of the target subtitle and a first attribute value of a target style attribute; when the original system is different from a preset system, modifying the first attribute value into a second attribute value according to the corresponding relation between the original system and the preset system; and rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value.
The object of the invention can be further achieved by the following technical measures.
In the subtitle processing method, the preset system includes a preset resolution specification, the original system includes an original resolution specification of the target subtitle, and the corresponding relationship includes a numerical relationship corresponding to the preset resolution specification and the original resolution specification; the modifying the first attribute value into a second attribute value according to the corresponding relationship between the original system and the preset system includes: determining the numerical relationship according to the preset resolution specification and the original resolution specification; and modifying the first attribute value according to the numerical relationship to obtain a modified second attribute value.
Before the target subtitle is rendered on the canvas corresponding to the preset system according to the second attribute value, the subtitle processing method further includes: and creating a canvas corresponding to the preset system.
In the subtitle processing method, the target style attribute includes a style attribute related to a display position or size of the target subtitle.
In the foregoing subtitle processing method, the obtaining configuration information of a target subtitle includes: analyzing an original code stream and the original system of the target caption from a media stream; and analyzing the content of the original code stream to obtain the first attribute value.
In the subtitle processing method, after the target subtitle is rendered on the canvas corresponding to the preset system according to the second attribute value, the method further includes: and displaying a subtitle image which is obtained by rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value and is suitable for the preset system.
In the foregoing subtitle processing method, the target subtitle is a Closed caption using the TTML2 specification under the ISDB-S3 standard.
The purpose of the invention is realized by adopting the following technical scheme. A subtitle processing apparatus according to the present disclosure includes: the system comprises an acquisition module, a storage module and a display module, wherein the acquisition module is used for acquiring configuration information of a target subtitle, and the configuration information comprises an original system of the target subtitle and a first attribute value of a target style attribute; a modification module, configured to modify the first attribute value into a second attribute value according to a correspondence between the original system and a preset system when the original system acquired by the acquisition module is different from the preset system; and the rendering module is used for rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value obtained by modification of the modification module.
The object of the invention can be further achieved by the following technical measures.
In the foregoing subtitle processing apparatus, the preset format includes a preset resolution specification, the original format includes an original resolution specification of the target subtitle, and the corresponding relationship includes a numerical relationship corresponding to the preset resolution specification and the original resolution specification; the modification module is specifically configured to: determining the numerical relationship according to the preset resolution specification and the original resolution specification acquired by the acquisition module; modifying the first attribute value according to the numerical relationship to obtain the modified second attribute value
The subtitle processing apparatus described above further includes: and the creating module is used for creating the canvas corresponding to the preset system before the rendering module renders the target subtitle on the canvas corresponding to the preset system according to the second attribute value.
In the subtitle processing apparatus described above, the target style attribute may include a style attribute related to a display position or size of the target subtitle.
In the foregoing subtitle processing apparatus, the obtaining module is specifically configured to: analyzing an original code stream and the original system of the target caption from a media stream; and analyzing the content of the original code stream to obtain the first attribute value.
The subtitle processing apparatus described above further includes: and the display module is used for displaying the subtitle image which is obtained by rendering the target subtitle on the canvas corresponding to the preset system by the rendering module according to the second attribute value and is suitable for the preset system.
The purpose of the invention is realized by adopting the following technical scheme. A subtitle processing apparatus proposed according to the present disclosure includes: a memory for storing non-transitory computer readable instructions; and a processor for executing the computer readable instructions, so that the processor realizes any one of the foregoing subtitle processing methods when executing the computer readable instructions.
The purpose of the invention is realized by adopting the following technical scheme. A computer-readable storage medium according to the present disclosure is provided for storing non-transitory computer-readable instructions which, when executed by a computer, cause the computer to perform any one of the foregoing methods of subtitle processing.
Compared with the prior art, the invention has obvious advantages and beneficial effects. By means of the technical scheme, the method, the device, the equipment and the storage medium for processing the subtitles adopt the canvas with the uniform preset system, when the original system of the target subtitle to be processed is different from the preset system, the original attribute value of the target style attribute of the target subtitle is modified according to the corresponding relation between the original system of the target subtitle and the preset system to obtain the modified attribute value suitable for the preset system, and then rendering is carried out on the canvas with the preset system based on the modified attribute value, so that canvas reconstruction when the subtitle system is changed can be avoided, system performance is improved, and subtitle processing such as creation of the subtitle canvas, generation and storage and transmission of a subtitle image is facilitated.
The foregoing description is only an overview of the technical solutions of the present invention, and in order to make the technical means of the present invention more clearly understood, the present invention may be implemented in accordance with the content of the description, and in order to make the above and other objects, features, and advantages of the present invention more clearly understandable, the following preferred embodiments are described in detail with reference to the accompanying drawings.
Drawings
Fig. 1 is a flowchart illustrating a subtitle processing method according to an embodiment of the present invention;
fig. 2 is a flowchart illustrating a subtitle processing method according to another embodiment of the present invention;
fig. 3 is a flowchart illustrating a subtitle processing method according to another embodiment of the present invention;
fig. 4 is a schematic flow chart of two subtitle rendering modes according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of glyph scaling provided by one embodiment of the invention;
fig. 6 is a flowchart illustrating a subtitle processing method according to another embodiment of the present invention;
fig. 7 is a schematic diagram of a subtitle processing apparatus according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a subtitle processing apparatus according to another embodiment of the present invention;
fig. 9 is a schematic diagram of a subtitle processing apparatus according to an embodiment of the present invention.
Detailed Description
To further illustrate the technical means and effects of the present invention adopted to achieve the predetermined objects, the following detailed description will be given of specific embodiments, structures, features and effects of a subtitle processing method, device, apparatus and storage medium according to the present invention with reference to the accompanying drawings and preferred embodiments.
It is noted that, in this document, relational terms such as "first," "second," and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. In addition, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Fig. 1 is a schematic flow chart diagram of a subtitle processing method according to an embodiment of the present invention. In some embodiments of the present invention, referring to fig. 1, the subtitle processing method according to the present invention mainly includes steps S11-S13.
In step S11, the terminal device obtains configuration information of the target subtitle, where the configuration information includes an original system of the target subtitle and a first attribute value of the target style attribute.
In the embodiments of the present application, the terminal device may be implemented in various forms, and may include, but is not limited to, a fixed terminal device such as a television, a desktop computer, and the like, and an electronic device such as a smart phone, a notebook computer, a digital broadcast receiver, a PDA (personal digital assistant), a PAD (PAD), a PMP (portable multimedia player), a navigation apparatus, a vehicle-mounted terminal device, a vehicle-mounted display terminal, a vehicle-mounted electronic rearview mirror, and the like.
In some optional embodiments of the application, the subtitles processed include subtitles in broadcast television signals, subtitles in media data stored in a computer storage medium, and the like. As a specific embodiment, the target caption is Closed Captions (CC, concealable caption, using the TTML2 specification) under the ISDB-S3 standard.
In the embodiment of the present application, the subtitle system may include a resolution specification of subtitles. The resolution of the subtitle may also be referred to as a size of a pixel expression, a canvas resolution, a canvas size, or a pixel point number of the canvas. It should be noted that the canvas system related to the present invention may be a current common system or a standard system, or may not be a common system or a standard system. Taking the canvas resolution as an example, the resolution specification of the current subtitle may be any size, including but not limited to 1280 × 720, 1920 × 1080, 3840 × 2160, 2048 × 1080, 4096 × 2160, and so on. Taking the subtitle based on the TTML2 standard under the ISDB-S3 standard as an example, the subtitle system conforming to the TTML2 standard in the ISDB-S3 standard generally includes 2K, 4K and 8K systems.
In the embodiment of the present application, the subtitle style attribute refers to an attribute related to a subtitle style. In an embodiment of the present application, the subtitle style attribute may include: a series of attributes related to subtitle display, such as font color (font color), font size (font size), background color (background color), display coordinate value (origin), transparency (opacity), width and height (extent) or line-height (line-height) of a subtitle display region, frame width, font stroke size, font style interval, line interval, character interval, special effect position, offset position, and the like. In some optional embodiments of the present application, the target style attribute includes one or more style attributes related to display and/or size of the subtitle, for example, the target style attribute includes a part or all of attributes related to display or size of the subtitle, such as font size or display coordinate values.
It should be noted that the target style attribute may include other types of style attributes besides the style attribute related to the display or size of the subtitle, which is not limited in the embodiment of the present application.
Optionally, the configuration information in the x-axis direction (the width direction of the display) and the configuration information in the y-axis direction (the height direction of the display) may be obtained separately, for example, for the original system, the canvas width system and the canvas height system of the target subtitle are obtained separately, and for the target style attribute, the width of the subtitle display area, the width of the font, the height of the subtitle display area, and the height of the font are obtained separately. In fact, only the configuration information in one of the width direction and the height direction of the subtitle may be obtained, and the configuration information in the other direction may not be obtained, so that the subtitle style attribute value in the corresponding direction is not adjusted in the subsequent step.
In the embodiment of the application, the terminal device first obtains configuration information of a target subtitle, wherein the configuration information comprises an original system of the target subtitle and a first attribute value of a target style attribute. The original format of the target subtitle refers to an original configured format of the target subtitle, for example, an original configured resolution specification. The first attribute value of the target style attribute refers to an attribute value to which the target style attribute of the target subtitle is originally configured.
Optionally, in this embodiment of the present application, the terminal device parses an original format in which the target subtitle is originally configured and an original code stream of the target subtitle from the media stream. For example, the original format of acquiring the target subtitles from the media stream is 4K. The terminal equipment analyzes the content of the original code stream to obtain a first attribute value of the target style attribute. For example, the target style attribute includes a font size of a target subtitle, a display coordinate value, and a width and a height of a display area, and the first attribute values (i.e., originally configured attribute values) of the target style attribute obtained by analyzing the content of the original code stream are: the font size is 20px, the display coordinate values are (200 ), and the width and height of the display area are (1000, 240). It should be noted that media streams generally have a field for identifying the subtitle format, the field may be located in a subtitle control stream, and the original format of a target subtitle can be directly obtained by obtaining and analyzing the field. It should be noted that the media stream is generally mixed (mux) with audio, video and subtitle streams, so the aforementioned parsing of the original stream of subtitles from the media stream includes demultiplexing (demux) the media stream to obtain respective data.
It should be noted that, in this embodiment of the present application, the configuration information of the target subtitle may further include other types of information related to the target subtitle besides the first attribute value of the original system and the target style attribute of the target subtitle, which is not limited in this embodiment of the present application.
Step S12, when the original system of the target caption is different from the preset system, the terminal device modifies the first attribute value of the target caption into the second attribute value according to the corresponding relation between the preset system and the original system of the target caption.
In the embodiment of the application, the preset system is a preset subtitle system. In the embodiment of the application, the preset system is irrelevant to the target caption, namely, the preset system cannot be changed according to the change of the target caption.
Optionally, the preset system that can be preset may be a common subtitle system under an adopted subtitle standard, or a subtitle system suitable for the specification of a display device such as a screen on which a target subtitle is displayed, or a subtitle system occupying a smaller or smallest storage space, or a subtitle system having a higher definition or a higher or largest resolution among the common subtitle systems, or the like. Optionally, the specifications of the display device such as the screen include the aspect ratio of the screen, for example, 16:9, 16:10, and the like.
For example, the subtitles used are subtitles based on the TTML2 specification under the ISDB-S3 standard. Subtitles conforming to the TTML2 specification in the ISDB-S3 standard generally include 2K, 4K and 8K systems, no matter what system the target subtitle to be processed is, the preset system preset in the embodiment of the present application is 2K, and in the embodiment of the present application, 2K canvases of the preset system, for example, 16:9 canvases of the size 1920 × 1080, are uniformly created.
Alternatively, the preset systems corresponding to the x-axis direction (the display width direction) and the y-axis direction (the display height direction) may be determined, for example, the preset canvas width value of the subtitle is preset to 1920, and the preset canvas height value of the subtitle is preset to 1080. In fact, only one preset system in the width direction and the height direction may be set, and neither a preset system preset in the other direction nor an attribute of the subtitle style in the corresponding direction may be adjusted.
In the embodiment of the application, after the terminal device obtains the original system of the target subtitle and the first attribute value of the target style attribute, if the original system of the target subtitle is different from the preset system, the terminal device modifies the first attribute value of the target subtitle into the second attribute value according to the corresponding relation between the preset system and the original system of the target subtitle. For example, if the original system in which the target subtitle is originally configured is 4K and the preset system is 2K, the terminal device modifies the first attribute value of the target style attribute of the target subtitle to a second attribute value corresponding to the preset system 2K according to the corresponding relationship between 4K and 2K.
Optionally, in this embodiment of the present application, the correspondence between the preset format and the original format may specifically refer to a corresponding numerical relationship between an original resolution specification of the target subtitle and the preset resolution specification.
For example, if the original format of the target subtitle is 4K and the preset format is 2K, it may be determined that the corresponding numerical relationship between the original resolution specification and the preset resolution specification is the scaling factor 1/2. And the terminal equipment modifies the first attribute value originally taken by the target style attribute into a second attribute value according to the scaling coefficient. And the obtained second attribute value is an attribute value of the target style attribute corresponding to the preset system 2K. As shown in table 1, an example of modification of a target style attribute is provided in the embodiment of the present application.
Table 1 example of modification of target style attribute provided in the embodiments of the present application
Figure BDA0003040425770000071
The target style attribute in this embodiment of the present application includes a font size of a target subtitle, a display coordinate value, a width and a height of a display area, and a line height, and first attribute values (i.e., originally configured attribute values) of the target style attribute are: the font size is 20px, the display coordinate values are (200 ), the width and height of the display area are (1000, 240), and the line height is 240. According to a scaling factor 1/2 between an original system 4K and a preset system 2K of a target subtitle, a first attribute value 20px of a font size is modified into a second attribute value 10px, a first attribute value (200 ) of display coordinate values is modified into a second attribute value (100 ), a first attribute value (1000, 240) of width and height of a display area is modified into a second attribute value (500, 120), and a first attribute value 240 of a line height is modified into a second attribute value 120.
It is noted that table 1 illustrates one alternative example of modification of target style properties and should not be construed as limiting the present application. In order to obtain the subtitle image suitable for the preset system, any corresponding target style attribute can be modified. For example, to generate a subtitle image of the target subtitle that is adapted to a preset canvas resolution, the subtitle style attributes that may be adjusted may further include: border-width size (Border-length), font-stroke size (Outline-length), Blur-radius size (Blur-radius), inter-spacing (Padding), glyph-spacing (Letter-spacing), Shadow-offset coordinate setting (Shadow-offset), and the like.
It should be noted that the corresponding relationship between the preset system and the original system may also include other corresponding relationships, and the foregoing is only an example of the corresponding relationship between the preset system and the original system, and should not be construed as a limitation to the present application.
And step S13, the terminal device renders the target subtitle on the canvas corresponding to the preset system according to the second attribute value of the target style attribute.
In the embodiment of the application, after modifying the first attribute value of the target subtitle into the second attribute value according to the corresponding relationship between the preset system and the original system of the target subtitle, the terminal device renders the target subtitle on the canvas corresponding to the preset system according to the modified second attribute value, thereby obtaining a subtitle image (also referred to as a subtitle layer) of the target subtitle, which is suitable for the preset system.
In the embodiment of the present application, the canvas corresponding to the preset system is created in advance at any time before the terminal device performs the aforementioned "rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value of the target style attribute".
Note that the canvas is an abstract space on which subtitles are rendered, the subtitles are rendered as a picture on the canvas, and the size of the canvas can be set to 1920 × 1080; the specification of video or screen is a logical concept in display, and 1920 × 1080 pictures need to be scaled to the size of a display window in display.
Note that in the embodiment of the present application, a subtitle image based on a preset system is obtained after rendering subtitle data, instead of a subtitle image based on an original system of a target subtitle.
Wherein, the rendering in the embodiment of the present application refers to: subtitles go from the original text form to the process of drawing image content on the canvas. Optionally, the result of rendering on the canvas is RGBA (representing a color space including red, green, blue, and Alpha channels) data stored with one memory block, which is stored in the memory.
Generally, after rendering the image data of the target subtitle, the terminal device temporarily stores the image data for subsequent processing such as displaying.
According to the subtitle processing method provided by the embodiment of the application, the uniform canvas with the preset system is adopted, when the original system of the target subtitle to be processed is different from the preset system, the first (original) attribute value of the target style attribute of the target subtitle is modified according to the corresponding relation between the original system of the target subtitle and the preset system to obtain the second attribute value suitable for the preset system, and finally, the modified second attribute value is rendered on the canvas with the preset system, so that the canvas reconstruction in the system switching process can be avoided, and the system performance is favorably improved.
It should be noted that the switching of the subtitle system may occur in many situations, including but not limited to, when different sources are switched, the canvas system on which the subtitles are based may be changed. For example, when a television program of a 2K signal source is switched to a television program of a 4K signal source, or a television program of a 4K signal source is switched to 2K, the system of subtitles of the television program generally changes with the system of the television program. For another example, when a message, news, or advertisement is inserted during a movie, a television program, or a live webcast, a subtitle format may also be changed because the resolution of the message, news, or advertisement may be different from the format of the currently played media. For another example, when a movie is played, if the caption systems of a plurality of pre-stored captions (e.g., captions in multiple languages) are different, caption system switching also occurs when the captions are switched. When the subtitle processing method provided by the embodiment of the application is used for processing the subtitle, when the canvas system based on the subtitle changes, the canvas which is created in advance and corresponds to the preset system is used for rendering the switched subtitle instead of newly creating the canvas, so that the canvas reconstruction in the system switching process can be reduced.
Fig. 2 is a schematic diagram of another embodiment of a subtitle processing method according to an embodiment of the present application.
Another embodiment of the subtitle processing method provided by the embodiment of the present application shown in fig. 2 includes steps S21-S26.
Step S21, a canvas corresponding to a preset format is created, where the preset format is a preset low format that occupies a small storage space. In the embodiment of the application, the terminal device reads the preset subtitle system which is configured in advance and occupies a small storage space, and creates the canvas corresponding to the preset subtitle system, wherein the canvas is used for rendering the subtitle image in the subsequent steps.
In the embodiment of the application, the canvas corresponding to the preset system is created by the terminal equipment in advance. The terminal device can only create the canvas corresponding to the preset system once, and in a subsequent preset time period, the terminal device can render the subtitles in any received media stream based on the canvas.
In particular, the preset format in this embodiment is a low format that is preset and occupies a small storage space, for example, a low format that occupies a small or minimum storage space in a common subtitle format. Taking subtitles based on the TTML2 specification under the ISDB-S3 standard as an example, subtitles conforming to the TTML2 specification in the ISDB-S3 standard generally include 2K, 4K and 8K systems specified by the specification, and when the method shown in the embodiment of the present application is used for subtitle processing, a 2K canvas is uniformly created, specifically, a 16:9 2K canvas with a size of 1920 × 1080 is available.
In step S22, the configuration information of the target subtitle is acquired. In the embodiment of the application, the terminal device obtains the media stream, analyzes the original system and the original code stream of the target caption from the media stream, and performs content analysis on the original code stream to obtain the first attribute value (original attribute value) of the target style attribute of the target caption.
As a specific embodiment, taking a TTML subtitle as an example, the process of obtaining an original system of a target subtitle specifically includes: and analyzing a caption specification adopted by the current TTML caption from the pcap code stream, for example, determining whether the target caption is in a 2K, 4K or 8K system, for example, the original system is 4K. The process of obtaining the first attribute value of the target style attribute of the target subtitle specifically includes: and analyzing the original code stream of the current TTML subtitle from the pcap code stream, and analyzing the content of the TTML subtitle to obtain an original attribute value set by the target style of the subtitle, namely the first attribute value. For example, the target style attribute includes a font size of a target subtitle, a display coordinate value, and a width and a height of a display area, and the first attribute values (i.e., originally configured attribute values) of the target style attribute obtained by analyzing the content of the original code stream are: the font size is 20px, the display coordinate values are (200 ), and the width and height of the display area are (1000, 240). The pcap code stream is a datagram commonly used in network packet capturing and network packet analysis. It should be noted that the present invention is not limited to the media stream used, and other types and formats of data, such as RTP bitstream packets, can be used instead of the pcap bitstream.
The detailed description of step S22 in the embodiment of the present application can be understood with reference to step S11 in fig. 1, which is not repeated herein.
Step S23, determining whether the original format of the target subtitle is the same as the preset format.
In this embodiment of the present application, after step S22 is performed to obtain the original system of the target subtitles, the terminal device determines, according to the original system and the preset system preset in step S21: whether the original system and the preset system of the target caption are the same or not.
Step S24, if the determination result in step S23 is that the original system of the target subtitle is different from the preset system, the terminal device modifies the first attribute value of the target subtitle to the second attribute value according to the corresponding relationship between the preset system and the original system of the target subtitle, where the preset system is a preset low system that occupies a small storage space.
The detailed description of step S24 in the embodiment of the present application can be understood with reference to step S12 in fig. 1, which is not repeated herein.
And step S25, rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value of the target style attribute of the target subtitle to obtain a subtitle image of the target subtitle which is suitable for the preset low system with small occupied storage space.
The detailed description of step S25 in the embodiment of the present application can be understood with reference to step S13 in fig. 1, which is not repeated herein.
Step S26, the subtitle image is displayed.
In the embodiment of the application, after the subtitle image of the target subtitle which is suitable for the preset system is obtained, the terminal device may further display the subtitle image, and the rendered subtitle image may be generally transmitted to a display module (for example, a Graphics Processing Unit (GPU) in a television or a computer) of the terminal device, so that the display module may display the subtitle on a screen. It should be noted that, corresponding to a picture with any size and a video with any resolution, the display module can adjust the zoom by itself to perform full-screen display or adjust to any other display area.
In the embodiment of the application, a uniform canvas with a preset system is adopted in the subtitle processing method provided by the embodiment, when an original system of a target subtitle to be processed is different from the preset system, a first (original) attribute value of a target style attribute of the target subtitle is modified according to a corresponding relation between the original system of the target subtitle and the preset system to obtain a second attribute value suitable for the preset system, and finally, rendering is performed on the canvas with the preset system based on the modified second attribute value, so that canvas reconstruction in a system switching process can be avoided, and system performance is improved. In addition, the adopted preset mode is a preset low mode which occupies a small storage space, so that the memory space required in the subtitle processing processes of canvas creation, generation, storage, transmission, on-screen display and the like can be reduced, the memory consumption in the rendering process can be reduced, and the problem that the subtitles cannot be displayed due to the fact that a large memory cannot be applied is avoided. By taking ISDB-S3 CC subtitles as an example, the subtitle processing method disclosed by the invention can reduce the memory usage of ISDB-S3 CC subtitles, avoid the phenomenon that other processes are cleared (kill) due to insufficient memory caused by overhigh memory occupation on equipment such as a television and the like, and simultaneously improve the rendering efficiency.
Fig. 3 is a schematic diagram of another embodiment of a subtitle processing method according to an embodiment of the present application.
Another embodiment of the subtitle processing method provided by the embodiment of the present application shown in fig. 3 includes steps S31-S36.
And step S31, creating a canvas corresponding to a preset system, wherein the preset system is a high system with high definition set in advance. In the embodiment of the application, the terminal equipment reads a preset subtitle system with high definition configured in advance, and creates a canvas corresponding to the preset subtitle system, wherein the canvas is used for rendering subtitle images in the subsequent steps.
In the embodiment of the application, the canvas corresponding to the preset system is created by the terminal equipment in advance. The terminal device can only create canvas corresponding to a preset system once, and in a subsequent preset time period, the terminal device can render subtitles in any received media stream based on the canvas.
Specifically, the preset system in the present embodiment is a high system of high definition set in advance, for example, a high system of high definition in a commonly used subtitle system. Taking a subtitle based on the TTML2 specification under the ISDB-S3 standard as an example, a subtitle conforming to the TTML2 specification in the ISDB-S3 standard generally comprises 2K, 4K and 8K systems specified by the specification, and when the method shown in the embodiment of the application is used for processing the subtitle, an 8K canvas with the highest definition is created uniformly.
In step S32, the configuration information of the target subtitle is acquired. In the embodiment of the application, the terminal device obtains the media stream, analyzes the original system and the original code stream of the target caption from the media stream, and performs content analysis on the original code stream to obtain the first attribute value (original attribute value) of the target style attribute of the target caption.
As a specific embodiment, taking a TTML subtitle as an example, the process of obtaining an original system of a target subtitle specifically includes: and analyzing a caption specification adopted by the current TTML caption from the pcap code stream, for example, determining whether the target caption is in a 2K, 4K or 8K system, for example, the original system is 4K. The process of obtaining the first attribute value of the target style attribute of the target subtitle specifically includes: and analyzing the original code stream of the current TTML subtitle from the pcap code stream, and analyzing the content of the TTML subtitle to obtain an original attribute value set by the target style of the subtitle, namely the first attribute value. For example, the target style attribute includes a font size of a target subtitle, a display coordinate value, and a width and a height of a display area, and the first attribute values (i.e., originally configured attribute values) of the target style attribute obtained by analyzing the content of the original code stream are: the font size is 20px, the display coordinate value is (200 ), and the width and height of the display area is (1000, 240). The pcap code stream is a datagram commonly used in network packet capturing and network packet analysis. It should be noted that the present invention is not limited to the media stream used, and other types and formats of data, such as RTP bitstream packets, can be used instead of the pcap bitstream.
The detailed description of step S32 in the embodiment of the present application can be understood with reference to step S11 in fig. 1, which is not repeated herein.
Step S33, determine whether the original format of the target subtitle is the same as the preset format.
In this embodiment of the present application, after step S32 is performed to obtain the original system of the target subtitles, the terminal device determines, according to the original system and the preset system preset in step S31: whether the original system and the preset system of the target caption are the same or not.
Step S34, if the determination result in step S33 is that the original system of the target subtitle is different from the preset system, the terminal device modifies the first attribute value of the target subtitle to the second attribute value according to the corresponding relationship between the preset system and the original system of the target subtitle, where the preset system is a preset high-definition system.
The detailed description of step S34 in the embodiment of the present application can be understood with reference to step S12 in fig. 1, which is not repeated herein.
And step S35, rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value of the target style attribute of the target subtitle to obtain a subtitle image of the target subtitle which is suitable for the preset high-definition high system.
Step S36, the subtitle image is displayed.
In the embodiment of the application, after the subtitle image of the target subtitle which is suitable for the preset system is obtained, the terminal device may further display the subtitle image, and the rendered subtitle image may be generally transmitted to a display module (for example, a Graphics Processing Unit (GPU) in a television or a computer) of the terminal device, so that the display module may display the subtitle on a screen. It should be noted that, corresponding to a picture with any size and a video with any resolution, the display module can adjust the zoom by itself to perform full-screen display or adjust to any other display area.
In the embodiment of the application, a uniform canvas with a preset system is adopted in the subtitle processing method provided by the embodiment, when an original system of a target subtitle to be processed is different from the preset system, a first (original) attribute value of a target style attribute of the target subtitle is modified according to a corresponding relation between the original system of the target subtitle and the preset system to obtain a second attribute value suitable for the preset system, and finally, rendering is performed on the canvas with the preset system based on the modified second attribute value, so that canvas reconstruction in a system switching process can be avoided, and system performance is improved. In addition, the adopted preset system is a preset high-definition high system, so that the definition of the subtitles can be improved, and the problem that the subtitles are amplified by a display module and blurred in the subsequent processing can be avoided.
In still other embodiments of the subtitle processing method provided by the present invention, the preset subtitle system is a canvas system conforming to a screen specification or a canvas system of a common standard system. The subtitles are rendered based on the preset canvas which meets the screen specification or the canvas which meets the common standard system, so that the subtitles of different systems can be adjusted to the subtitles which meet the screen specification and the subtitles of the common standard system, and the execution of subtitle processing processes such as canvas creation, generation, storage, transmission, display and the like is facilitated.
Note that different ways may be used to obtain the subtitle image that conforms to the preset system. The foregoing embodiment of the present invention adopts a source scaling manner, that is, scaling is performed at the start position of the service flow, which is also called a manner of modifying the style attribute value: and firstly, adjusting the first attribute value of the target style attribute to obtain a second attribute value, and then rendering according to the second attribute value to obtain a subtitle image conforming to a preset system. Thus, with the above-described embodiment, the style attribute value at the source point is scaled directly to the value of the target point. In other embodiments, an end scaling mode may also be adopted, that is, scaling is performed at the end position of the business process, which is also referred to as a mode of modification during rendering: rendering a subtitle image of a target subtitle based on an original system of the target subtitle according to an original set value (namely a first attribute value) of a target style attribute of the subtitle, and adjusting the subtitle image of the original system of the target subtitle according to a corresponding relation between a preset system and the original system of the target subtitle so as to adjust the subtitle image to a canvas conforming to the preset system.
It should be noted that the two modifications have a large difference in memory and time consumption. Fig. 4 is a schematic flow chart of two subtitle rendering methods according to the present invention. Referring to fig. 4, the original format of the target subtitle is 4K canvas resolution, and the preset format is 2K canvas resolution. The upper half of fig. 4 represents the case where the aforementioned end scaling approach (i.e., the approach modified at rendering) is employed: the method comprises the steps of rendering the content of the 4K caption into a 4K system caption with the width and the height of 400 x 100, zooming into a caption layer with the width and the height of 200 x 50, then placing the caption layer on a 2K canvas, and finally sending the caption layer to a display module to be zoomed into a 4K picture by hardware of the display module for displaying. The lower half of fig. 4 shows the case where the source-side scaling manner (i.e., the manner of style attribute value modification) described above is adopted: firstly, adjusting an original attribute value of a 4K caption in accordance with a 4K system to obtain an attribute value in accordance with a 2K system, then directly rendering the content of the 4K caption on a 2K canvas according to the adjusted attribute value to obtain a caption layer with the width and the height of 200 multiplied by 50, and finally sending the caption layer to a display module for the hardware of the display module to zoom the caption layer to a 4K picture for display. Therefore, the subtitles are rendered in the original 4K mode and then scaled to 2K, and the memory is applied for one more time (the size of the memory is the original size of the 4K subtitles, 400 multiplied by 100 multiplied by 4B) compared with the direct rendering in the 2K mode, and the time consumption of scaling is increased for one more time. Therefore, the source-side scaling method mentioned in the foregoing embodiment of the present invention has a great advantage in terms of memory and time consumption.
It should be noted that the adjustment of the subtitle image by the display module is the processing performed by the display module (generally related to the GPU), and generally only related to the set size of the display window, and is not related to the style attribute modification and the modification during rendering mentioned in the present invention. For example, in the case of a display module that displays a 1920 by 768px map, whether the map is displayed full screen or only 1/4 size (with arbitrary coordinates) of the screen, the display module will restore the map code to a 1920 by 768px map (which, of course, generally allows decoding of a portion of the map, otherwise several billion pixels of the map would consume memory), and then scale to the size of the area specified by the display window.
In some embodiments of the present invention, the target subtitles utilize vector-based fonts. The subtitle of the vector font is different from the subtitle of PNG resources and the like, and the vector data has the characteristic of being arbitrarily scaled without influencing the definition of the text during text rendering.
Further, the rendering process of the foregoing step S13 includes: and zooming, displacing, rotating and/or inclining the original vector font corresponding to the text of the target caption to obtain a caption image which accords with the second attribute value of the target caption. Specifically, the vector glyph may be scaled, shifted, rotated, and/or tilted by using the matrix during rendering, so as to obtain a subtitle image adapted to a preset system.
As a specific example, the formula for scaling the caption with the matrix can be expressed as
Figure BDA0003040425770000141
Wherein the matrix
Figure BDA0003040425770000142
Is a matrix for scaling for magnifying the coordinate values by a factor of 2 in total. The same may also be used to adjust the subtitle style using a displacement matrix, a rotation matrix, a tilt matrix, etc.
It should be noted that when the canvas system is changed and scaling is needed, it is the basic decoding scaling for the picture; for text rendering, the biggest problem is whether the font size can be scaled directly. In some embodiments of the present invention, a mode of scaling the style attribute is adopted in the subtitle system modification, and the theoretical basis of style scaling is a proportional relationship. And in some embodiments of the invention, the rendering of glyphs is based on a uniform "canvas" so that font sizes may have a simple multiple relationship.
The process of forming words of different font sizes (font sizes) is effectively a scaling of the original glyph. Generally speaking, TTF (all called TrueType), SVG (all called Scalable Vector Graphics) glyphs are expressed by vectors, and the Vector expression is based on a mathematical expression of a specified space, and if normalized, the coordinate of each key point is understood as the percentage of the specified space. For example, as shown in fig. 5, for a vector glyph whose font is set to Advance 2048, the original vector representation of the font is based on 2048 × 2048 space, and when the font is set to 144px 72px, the vector diagram expressed based on 2048 × 2048 space is scaled to 144 × 72. Note that the font setting described above is 144px by 72px, which indicates that the size in the horizontal direction is 144px, and the size in the vertical direction is 72px, which includes whitespace; it is further noted that the horizontal direction and the vertical direction are allowed to be separately provided. Thus, if the canvas is enlarged by a certain factor, the font size is scaled by an equal factor. For example, when 4K is scaled to 2K, the canvas produces a 2-fold scaling relationship in both the horizontal and vertical directions, then the font should also have a 2-fold scaling relationship, which is equivalent to 2048 x 2048 scaling to 72px 36px, and then the 4K set 144px font size is equal to the 2K set 72px font size, i.e., font size scaling by an equal factor. After the final screen zoom (display module zoom), the user perceives the same size of words relative to the screen.
It should be noted that if the original system of the target subtitle is consistent with the preset system, the subtitle image may not be adjusted, but the original code stream is directly used for playing. Specifically, in some embodiments of the present invention, before the foregoing step S12, the subtitle processing method according to an example of the present invention further includes: judging whether the original system of the target caption is consistent with the preset system; if the judgment result is inconsistent, the processes of the step S12 and the step S13 are performed to adjust the original code stream of the subtitle to be a subtitle image suitable for a preset system, and then the subtitle image can be sent to a display module for display; and if the judgment result is consistent, rendering is directly carried out according to the original code stream of the subtitle, and the subtitle can be sent to a display module for displaying.
In some embodiments of the invention, the subtitles are soft decoded, and the subtitle streams resulting from demultiplexing the media stream are processed separately and then displayed on separate layers. For example, the subtitle and the video are independent, the subtitle image is formed into one display layer, the video is formed into the other display layer, and the subtitle layer and the video layer are processed and sent to the display module respectively. Note that subtitles and video processing are generally independent and unrelated; the relationship between the subtitles and the videos is that the subtitles and the videos operate in the same time axis, the subtitles and the videos are synchronized in time, and the subtitles and the videos can be displayed synchronously when operations such as pause, play, fast forward and the like are performed.
In some embodiments of the present invention, the subtitle processing method further includes: the subtitle images are mixed with the video content.
In some examples of the present invention, the display module and the device for executing the subtitle processing method of the present invention may be two independent devices, for example, the subtitle processing device may be a CPU in a terminal device such as a television, a computer, a smart phone, etc., and the display module may be a GPU therein. In other examples of the present invention, the apparatus for performing the subtitle processing method of the present invention includes a module for performing subtitle processing and a display module, i.e., the operations of the subtitle processing method of the present invention and the operations performed by the display module are performed by the same apparatus.
In some embodiments of the present invention, the step of displaying the subtitle by the display module according to the subtitle image of the target subtitle that is suitable for the preset system in the foregoing embodiments may specifically include: and the display module adjusts the subtitle images of the target subtitles, which are suitable for the preset system, into images according with the size and the position of the display area for displaying. Note that the final display condition of the subtitle image includes, but is not limited to, the size and display position set by the original system of the subtitle. In fact, the size and position of the display area of the subtitle on the screen may be any, and the playing interface of the subtitle may be any, for example, displayed in a non-full screen display mode, a split screen display mode, a picture-in-picture mode, and the like. Optionally, the image is displayed with the size of the display window set by the application program as the display range, so that the display module may adjust the subtitle image, increase or decrease the subtitle image, and change the display position to adapt to the size and position of the display area, for example, the display position of the subtitle may be adjusted when the display area of the video deviates from the center of the screen, where the display area is the final display range.
As a specific example, the original format of the target subtitle may be a resolution specification of 3840 × 2160 (not abbreviated as 4K), and if the default preset format is a resolution specification of 1920 × 1080 (not abbreviated as 2K), a subtitle image based on 2K canvas may be rendered by using the foregoing method; if the screen resolution is 4K and the display range set by the application program is full screen, the display module restores the subtitle image based on the 2K canvas to 4K canvas for displaying; and if the display range set by the application program is in a non-full screen state, for example, the display range is 1/4 screens, the display module adjusts the subtitle image based on the 2K canvas to a size suitable for 1/4 screens for presentation.
In some caption specifications, some style attributes of a caption may not be represented with specific values, but with a correspondence to a canvas. For example, in the TTML2 specification, styles such as coordinates, font size, etc. are allowed to be represented using percentages relative to the canvas size. Although the style attribute in such a proportional form may be converted into a specific value form and processed by using the subtitle processing method shown in fig. 1, the style attribute in such a proportional form may also be directly used for subtitle processing.
Fig. 6 is a schematic flow chart diagram of another embodiment of a subtitle processing method according to the present invention. Referring to fig. 6, an embodiment of the present invention further provides another subtitle processing method, which mainly includes steps S41-S43:
in step S41, the configuration information of the target subtitle is acquired. Wherein the configuration information comprises a corresponding relationship between the target style attribute of the target subtitle and the canvas. The correspondence may be a ratio of the attribute value of the target style attribute to the attribute value of the canvas in terms of the style attribute associated with the display position and size.
And step S42, determining the style attribute value of the target caption suitable for the preset system according to the corresponding relation between the target style attribute of the target caption and the canvas and the attribute of the canvas corresponding to the preset system.
And step S43, rendering the target subtitle on the canvas corresponding to the preset system according to the style attribute value suitable for the preset system of the target subtitle.
Note that, when the original system of the target subtitle is different from the preset system, in the step S42, the value of the style attribute of the target subtitle, which is determined based on the attribute of the canvas corresponding to the preset system, is not the original value of the style attribute of the target subtitle, but is adapted to the modified style attribute of the preset system, which is equivalent to the second attribute value in the embodiment corresponding to fig. 1.
As a specific example, the target style attribute of the target subtitle includes an attribute related to a display position and size; the attributes of the canvas corresponding to the preset system comprise the position and the size of the canvas; the corresponding relationship between the target style attribute and the canvas comprises a proportional relationship between the target style attribute and the canvas attribute. Therefore, when style attributes such as coordinates, positions, intervals and the like are adjusted, if the percentage relation between the style attribute and the canvas in the directions of the x axis and the y axis is determined, after the canvas is adjusted by being amplified by delta, the percentage relation between the style attribute and the canvas is unchanged, and the attribute value of the style attribute is equally amplified by delta.
Optionally, the preset system is a preset low system occupying a small storage space, or a preset high system with a large definition, or a preset system suitable for the specification of the display device.
It should be noted that, because the difference between the subtitle processing method illustrated in fig. 6 and the subtitle processing method illustrated in fig. 1 is mainly that the form of the configuration information of the initially obtained target subtitle is different, and the subsequent rendering process is basically consistent, the foregoing specific details corresponding to fig. 1 are also applicable to the subtitle processing method illustrated in fig. 6, and the detailed description and the technical effect thereof may refer to the corresponding description in the foregoing embodiments, and are not repeated herein.
Fig. 7 is a schematic block diagram of a subtitle processing apparatus according to an embodiment of the present invention. Referring to fig. 7, an embodiment of the present invention further provides a subtitle processing apparatus 100, which mainly includes: an acquisition module 101, a modification module 102, and a rendering module 103.
Wherein, the obtaining module 101 is configured to: and acquiring configuration information of the target subtitle, wherein the configuration information comprises an original system of the target subtitle and a first attribute value of the target style attribute.
In some optional embodiments of the present invention, the obtaining module 101 is specifically configured to: analyzing an original code stream and an original system of the target caption from the media stream; and analyzing the content of the original code stream to obtain a first attribute value.
The modification module 102 is configured to: when the original system acquired by the acquisition module 101 is different from the preset system, the first attribute value is modified into the second attribute value according to the corresponding relationship between the original system and the preset system.
The rendering module 103 is configured to: and rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value obtained by modification by the modification module 102. In some optional embodiments of the present invention, the aforementioned target style attribute comprises a style attribute related to a display position or size of the target subtitle.
In some optional embodiments of the present invention, the preset format includes a preset resolution specification, the original format includes an original resolution specification of the target subtitle, and a correspondence between the original format of the target subtitle and the preset format includes a numerical relationship between the preset resolution specification and a correspondence between the original resolution specification. The modification module 102 is specifically configured to: determining a numerical relationship according to the preset resolution specification and the original resolution specification acquired by the acquisition module 101; and modifying the first attribute value according to the numerical relation to obtain a modified second attribute value.
In some optional embodiments of the present invention, the subtitle processing apparatus 100 further comprises: and a creating module (not shown in the figure) for creating the canvas corresponding to the preset system before the rendering module 103 renders the target subtitle on the canvas corresponding to the preset system according to the second attribute value.
In some optional embodiments of the present invention, the subtitle processing apparatus 100 further includes: and a display module (not shown in the figure) configured to display a subtitle image that is suitable for the preset system and is obtained by rendering the target subtitle on the canvas corresponding to the preset system by the rendering module 103 according to the second attribute value.
In addition, various subtitle processing apparatuses 100 shown in the embodiments of the present invention include modules and units for executing the methods described in the foregoing embodiments, and for detailed description and technical effects, reference may be made to corresponding descriptions in the foregoing embodiments, which are not described herein again.
Fig. 8 is a schematic block diagram of a subtitle processing apparatus according to another embodiment of the present invention. Referring to fig. 8, an embodiment of the present invention further provides a subtitle processing apparatus 100', which mainly includes: an acquisition module 101 ', a determination module 112, and a rendering module 103'.
Wherein, the obtaining module 101' is configured to: and acquiring configuration information of the target subtitle, wherein the configuration information comprises the corresponding relation between the target style attribute of the subtitle and the canvas.
The determination module 112 is configured to: and determining a style attribute value of the target subtitle suitable for the preset system according to the corresponding relation between the target style attribute of the target subtitle and the canvas and the attribute of the canvas corresponding to the preset system.
The subtitle rendering module 103' is configured to: and rendering the target subtitles on the canvas corresponding to the preset system according to the style attribute value of the target subtitles suitable for the preset system.
In addition, various subtitle processing apparatuses 100' shown in the embodiments of the present invention include modules and units for executing the methods described in the foregoing respective embodiments, and for detailed descriptions and technical effects thereof, reference may be made to corresponding descriptions in the foregoing respective embodiments, which are not described herein again.
Fig. 9 is a schematic block diagram illustrating a subtitle processing apparatus according to an embodiment of the present invention. As shown in fig. 9, a subtitle processing apparatus 200 according to an embodiment of the present disclosure includes a memory 201 and a processor 202.
The memory 201 is used to store non-transitory computer readable instructions. In particular, memory 201 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc.
The processor 202 may be a Central Processing Unit (CPU) or other form of processing unit having data processing capabilities and/or instruction execution capabilities, and may control other components in the subtitle processing apparatus 200 to perform desired functions. In an embodiment of the present disclosure, the processor 202 is configured to execute the computer readable instructions stored in the memory 201, so that the subtitle processing apparatus 200 performs all or part of the steps of the aforementioned subtitle processing method according to various embodiments of the present disclosure.
Those skilled in the art should understand that, in order to solve the technical problem of how to obtain a good user experience, the present embodiment may also include well-known structures such as a communication bus, an interface, and the like, and these well-known structures should also be included in the protection scope of the present invention.
For the detailed description and the technical effects of the present embodiment, reference may be made to the corresponding descriptions in the foregoing embodiments, which are not repeated herein.
Embodiments of the present invention further provide a computer storage medium, where computer instructions are stored, and when the computer instructions are executed on a device, the device executes the above related method steps to implement the subtitle processing method in the above embodiments.
Embodiments of the present invention further provide a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the subtitle processing method in the above embodiments.
In addition, the embodiment of the present invention further provides an apparatus, which may specifically be a chip, a component or a module, and the apparatus may include a processor and a memory connected to each other; the memory is used for storing computer execution instructions, and when the device runs, the processor can execute the computer execution instructions stored in the memory, so that the chip can execute the subtitle processing method in the above-mentioned method embodiments.
The apparatus, the computer storage medium, the computer program product, or the chip provided by the present invention are all configured to execute the corresponding methods provided above, and therefore, the beneficial effects achieved by the apparatus, the computer storage medium, the computer program product, or the chip may refer to the beneficial effects in the corresponding methods provided above, and are not described herein again.
Although the present invention has been described with reference to a preferred embodiment, it should be understood that various changes, substitutions and alterations can be made herein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (14)

1. A method for processing subtitles, the method comprising:
acquiring configuration information of a target subtitle, wherein the configuration information comprises an original system of the target subtitle and a first attribute value of a style attribute of the target subtitle;
when the original system is different from the unified preset system, modifying the first attribute value into a second attribute value according to the corresponding relation between the original system and the preset system;
and rendering the target subtitles on the canvas corresponding to the preset system according to the second attribute value.
2. The method according to claim 1, wherein the preset format comprises a preset resolution specification, the original format comprises an original resolution specification of the target subtitle, and the corresponding relationship comprises a numerical relationship corresponding to the preset resolution specification and the original resolution specification;
the modifying the first attribute value into a second attribute value according to the corresponding relationship between the original system and the preset system includes:
determining the numerical relationship according to the preset resolution specification and the original resolution specification;
and modifying the first attribute value according to the numerical relationship to obtain the modified second attribute value.
3. The method according to claim 1 or 2, wherein before rendering the target subtitle on the canvas corresponding to the preset standard according to the second attribute value, the method further comprises:
and creating a canvas corresponding to the preset system.
4. The method of claim 1 or 2, wherein the style attribute of the target subtitle comprises a style attribute related to a display position or size of the target subtitle.
5. The method according to claim 1 or 2, wherein the obtaining of the configuration information of the target subtitle comprises:
analyzing an original code stream and the original system of the target caption from a media stream;
and analyzing the content of the original code stream to obtain the first attribute value.
6. The method according to claim 1 or 2, wherein after rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value, the method further comprises:
and displaying a subtitle image which is obtained by rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value and is suitable for the preset system.
7. The method of any one of claims 1 or 2, wherein the target subtitles are Closed Captions using TTML2 specification under ISDB-S3 standard.
8. A subtitle processing apparatus, comprising:
the system comprises an acquisition module, a storage module and a display module, wherein the acquisition module is used for acquiring configuration information of a target subtitle, and the configuration information comprises an original system of the target subtitle and a first attribute value of a style attribute of the target subtitle;
a modification module, configured to modify the first attribute value into a second attribute value according to a correspondence between the original system and a preset system when the original system acquired by the acquisition module is different from the unified preset system; and the number of the first and second groups,
and the rendering module is used for rendering the target subtitle on the canvas corresponding to the preset system according to the second attribute value obtained by the modification of the modification module.
9. The apparatus of claim 8,
the preset system comprises a preset resolution specification, the original system comprises an original resolution specification of the target subtitle, and the corresponding relation comprises a numerical value relation corresponding to the preset resolution specification and the original resolution specification;
the modification module is specifically configured to: determining the numerical relationship according to the preset resolution specification and the original resolution specification acquired by the acquisition module; and modifying the first attribute value according to the numerical relationship to obtain a modified second attribute value.
10. The apparatus of claim 8 or 9, further comprising:
and the creating module is used for creating the canvas corresponding to the preset system before the rendering module renders the target subtitle on the canvas corresponding to the preset system according to the second attribute value.
11. The apparatus according to claim 8 or 9,
the acquisition module is specifically configured to: analyzing an original code stream and the original system of the target caption from a media stream; and analyzing the content of the original code stream to obtain the first attribute value.
12. The apparatus of claim 8 or 9, further comprising:
and the display module is used for displaying the subtitle image which is obtained by rendering the target subtitle on the canvas corresponding to the preset system by the rendering module according to the second attribute value and is suitable for the preset system.
13. A subtitle processing apparatus comprising:
a memory for storing non-transitory computer readable instructions; and
a processor for executing the computer readable instructions such that the computer readable instructions, when executed by the processor, implement the subtitle processing method of any one of claims 1 to 7.
14. A computer-readable storage medium comprising computer instructions which, when executed on a device, cause the device to perform a subtitle processing method according to any one of claims 1 to 7.
CN202110455647.3A 2021-04-26 2021-04-26 Subtitle processing method, device, equipment and storage medium Active CN113438514B (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN202110455647.3A CN113438514B (en) 2021-04-26 2021-04-26 Subtitle processing method, device, equipment and storage medium
JP2023560195A JP2024513380A (en) 2021-04-26 2022-03-25 Subtitle processing methods, devices, devices and storage media
PCT/CN2022/083209 WO2022227974A1 (en) 2021-04-26 2022-03-25 Subtitle processing method, apparatus and device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110455647.3A CN113438514B (en) 2021-04-26 2021-04-26 Subtitle processing method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN113438514A CN113438514A (en) 2021-09-24
CN113438514B true CN113438514B (en) 2022-07-08

Family

ID=77752992

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110455647.3A Active CN113438514B (en) 2021-04-26 2021-04-26 Subtitle processing method, device, equipment and storage medium

Country Status (3)

Country Link
JP (1) JP2024513380A (en)
CN (1) CN113438514B (en)
WO (1) WO2022227974A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113438514B (en) * 2021-04-26 2022-07-08 深圳Tcl新技术有限公司 Subtitle processing method, device, equipment and storage medium
CN116668285B (en) * 2022-12-05 2024-05-03 荣耀终端有限公司 Method, device and storage medium for configuring system

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5805153A (en) * 1995-11-28 1998-09-08 Sun Microsystems, Inc. Method and system for resizing the subtitles of a video
JP4449622B2 (en) * 2004-07-23 2010-04-14 船井電機株式会社 Television broadcast receiver
CN101086834A (en) * 2006-06-06 2007-12-12 华为技术有限公司 A method for controlling display effect of caption and control device
CN101594481A (en) * 2008-05-30 2009-12-02 新奥特(北京)视频技术有限公司 A kind of method of making and revising captions
US8754984B2 (en) * 2011-05-02 2014-06-17 Futurewei Technologies, Inc. System and method for video caption re-overlaying for video adaptation and retargeting
CN102739994A (en) * 2011-05-10 2012-10-17 新奥特(北京)视频技术有限公司 Method for switching subtitle projects in different systems
CN102932607B (en) * 2012-10-29 2015-05-20 北京东方艾迪普科技发展有限公司 Caption graphics and text information generation method and device
CN103686352A (en) * 2013-11-15 2014-03-26 乐视致新电子科技(天津)有限公司 Smart television media player and subtitle processing method thereof, and smart television
JP6881303B2 (en) * 2015-06-30 2021-06-02 ソニーグループ株式会社 Receiver, receiver, transmitter and transmitter
WO2017006948A1 (en) * 2015-07-09 2017-01-12 ソニー株式会社 Reception device, reception method, transmission device, and transmission method
CN105554589A (en) * 2015-12-14 2016-05-04 武汉兴图新科电子股份有限公司 Subtitle superposition method of back end display
TWI728061B (en) * 2016-03-15 2021-05-21 日商新力股份有限公司 Sending device and receiving device
CN107135415A (en) * 2017-04-11 2017-09-05 青岛海信电器股份有限公司 Video caption processing method and processing device
CN109819343A (en) * 2019-01-08 2019-05-28 深圳市华曦达科技股份有限公司 A kind of method for processing caption, device and electronic equipment
CN113438514B (en) * 2021-04-26 2022-07-08 深圳Tcl新技术有限公司 Subtitle processing method, device, equipment and storage medium

Also Published As

Publication number Publication date
JP2024513380A (en) 2024-03-25
CN113438514A (en) 2021-09-24
WO2022227974A1 (en) 2022-11-03

Similar Documents

Publication Publication Date Title
KR100948863B1 (en) Display device and method for starting a web browser for use on a television screen
US7911536B2 (en) Screen filled display of digital video content
US8723891B2 (en) System and method for efficiently processing digital video
CN113438514B (en) Subtitle processing method, device, equipment and storage medium
CN108063976B (en) Video processing method and device
CN109640167B (en) Video processing method and device, electronic equipment and storage medium
CN110868625A (en) Video playing method and device, electronic equipment and storage medium
US10728562B2 (en) Video transmitting device and video playing device
KR20160128710A (en) Source device, controlling method thereof, sink device and processing method for improving image quality thereof
US9449585B2 (en) Systems and methods for compositing a display image from display planes using enhanced blending hardware
KR20200027491A (en) Adaptive high dynamic range tone mapping using overlay instructions
US10290110B2 (en) Video overlay modification for enhanced readability
JP2002033972A (en) Method and system for using single osd pixmap in multiple-video raster sizes by making osd header to ink
US20020034254A1 (en) Moving picture reproducing device and method of reproducing a moving picture
JP2005033741A (en) Television character information display device, and television character information display method
JP2002033974A (en) Method and system for using single osd pixmap in multiple video raster sizes by using multiple headers
US7630018B2 (en) On-screen display apparatus and on-screen display generation method
US8675135B2 (en) Display apparatus and display control method
CN114827620A (en) Image processing method, apparatus, device and medium
CN110519530B (en) Hardware-based picture-in-picture display method and device
US20050162446A1 (en) Common on screen display size for multiple display formats
US8068179B2 (en) On-screen display device with compressed data and display method thereof
JP2008092316A (en) Display device
JP2007139923A (en) Osd generating device
JPWO2005101819A1 (en) Display device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant