CN113127785A - Subtitle processing method, subtitle processing device, computer equipment and storage medium - Google Patents

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

Info

Publication number
CN113127785A
CN113127785A CN202110541871.4A CN202110541871A CN113127785A CN 113127785 A CN113127785 A CN 113127785A CN 202110541871 A CN202110541871 A CN 202110541871A CN 113127785 A CN113127785 A CN 113127785A
Authority
CN
China
Prior art keywords
subtitle
target
text
output information
browser
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.)
Pending
Application number
CN202110541871.4A
Other languages
Chinese (zh)
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 CN202110541871.4A priority Critical patent/CN113127785A/en
Publication of CN113127785A publication Critical patent/CN113127785A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9577Optimising the visualization of content, e.g. distillation of HTML documents
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/38Creation or generation of source code for implementing user interfaces

Abstract

The application discloses a subtitle processing method and device, computer equipment and a storage medium. The method comprises the following steps: acquiring a text resource of a time sequence text markup language (TTML) subtitle; determining at least one group of subtitle output information according to the text resources of the TTML subtitles, wherein each group of subtitle output information comprises subtitle output time and subtitle content; and creating a subtitle object of the browser according to the target subtitle output information, wherein the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output target subtitle content in the hypertext markup language page according to the target subtitle event in the browser. And creating a subtitle object which can be supported by the browser according to the text resource of the time sequence text markup language, wherein the browser can respond to a target subtitle event triggered by the subtitle object, and then playing the time sequence text markup language subtitle in an HTML page, so that the compatibility of the browser is improved.

Description

Subtitle processing method, subtitle processing device, computer equipment and storage medium
Technical Field
The present disclosure relates to browser technologies, and in particular, to a method and an apparatus for processing subtitles, a computer device, and a storage medium.
Background
Time-series Text Markup Language (TTML) is an Extensible Markup Language (XML) based time-series Text Markup Language.
Many video content providers now use the sequential text markup language to edit subtitles. However, when the browser does not support the sequential text markup language subtitles, the browser cannot play the sequential text markup language subtitles, and the browser compatibility is poor.
Disclosure of Invention
The application provides a subtitle processing method, a subtitle processing device, computer equipment and a storage medium, so that subtitles of a time sequence text markup language are played in a browser, and the compatibility of the browser is improved.
In a first aspect, an embodiment of the present application provides a subtitle processing method, including:
acquiring a text resource of a time sequence text markup language (TTML) subtitle;
determining at least one group of subtitle output information according to the text resources of the TTML subtitles, wherein each group of subtitle output information comprises subtitle output time and subtitle content;
and creating a subtitle object of the browser according to the target subtitle output information, wherein the target subtitle output information is any one group of subtitle output information in at least one group of subtitle output information, the target subtitle output information comprises target subtitle content and target subtitle output time, and the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output the target subtitle content in a hypertext Markup Language (HTML) page according to the target subtitle event in the browser.
In a second aspect, an embodiment of the present application further provides a subtitle processing apparatus, including:
the text resource acquisition module is used for acquiring text resources of the TTML subtitles;
a caption output information determining module, configured to determine caption output information according to a text resource of the TTML caption, where the caption output information includes: caption output time and caption content;
and the subtitle object generating module is used for creating a subtitle object of the browser according to the subtitle output information, and the subtitle object is used for triggering a subtitle event at the subtitle output time so that the browser can output subtitle contents in the HTML page according to the subtitle event.
In a third aspect, an embodiment of the present application further provides a computer device, which includes a memory, a processor, and a computer program stored on the memory and executable on the processor, and when the processor executes the computer program, the subtitle processing method as shown in the embodiment of the present application is implemented.
In a fourth aspect, the present application further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are used to perform the subtitle processing method according to the present application.
The subtitle processing method provided by the embodiment of the application obtains text resources of a time sequence text markup language (TTML) subtitle; determining at least one group of subtitle output information according to the text resources of the TTML subtitles; and creating a subtitle object of the browser according to the target subtitle output information, wherein the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output target subtitle content in the HTML page according to the target subtitle event in the browser. Compared with the problem that the current browser cannot play the time sequence text markup language subtitles and is poor in compatibility, the method and the device for playing the time sequence text markup language subtitles can determine subtitle output information according to the text resources of the time sequence text markup language letters after acquiring the text resources of the time sequence text markup language subtitles, create the subtitle objects of the browser according to the target subtitle output information, and enable the created subtitle objects to trigger the target subtitle events at the target letter output time. And the browser outputs the target subtitle content in response to the target subtitle event, so that the target subtitle content is output in the HTML page. And creating a subtitle object which can be supported by the browser according to the text resource of the time sequence text markup language, wherein the browser can respond to a target subtitle event triggered by the subtitle object, and then playing the time sequence text markup language subtitle in an HTML page, so that the compatibility of the browser is improved.
Drawings
Fig. 1 is a flowchart of a subtitle processing method according to a first embodiment of the present application;
fig. 2 is a flowchart of a subtitle processing method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a subtitle processing apparatus according to a third embodiment of the present application;
fig. 4 is a schematic structural diagram of a computer device in the fourth embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the application and are not limiting of the application. It should be further noted that, for the convenience of description, only some of the structures related to the present application are shown in the drawings, not all of the structures.
Currently, many video content providers (such as BBC, Netflix, HBO) use time sequential text markup language (TTML) as subtitles. However, because the sequential text markup language adopts a relatively bloated XML format, some current browsers do not support the TTML subtitles, such as google Chrome browser. The browser has poor support, which causes embarrassment of TTML subtitles originally designed for Internet media at the Internet end.
In order to solve the problem, the scheme adopts the imscJS open source framework to realize the rendering of the TTML subtitles. imscJS is used to render IMSC text and image profile documents as JavaScript libraries in HTML. Firstly, downloading open-source imscJS.js; secondly, introducing js into a web page by the browser; then, writing a script for initializing imscJS; and finally, analyzing and rendering the caption resource of application/TTML + xml type in the < Track > tag, thereby realizing the effect of outputting the TTML caption in the browser. The parsing and rendering of the TTML subtitles is achieved using open source imscJS. In this way, pages in HTML5 may be provided with the ability to render TTML subtitles without relying on a browser or other underlying implementation. The following examples are intended to illustrate the details.
Example one
Fig. 1 is a flowchart of a subtitle processing method according to an embodiment of the present application, where the method is applicable to a situation where a browser outputs a sequential text markup language, and the method may be executed by a computer device or a smart television, where the computer device or the smart television can run an application that outputs an HTML page, where the application may be a browser, and the method specifically includes the following steps:
and step 110, acquiring a text resource of the time sequence text markup language (TTML) subtitles.
Web pages containing time sequential text markup language (TTML) subtitles can be written using hypertext markup language (html). The hypertext markup language describes tags contained in a web page containing time-sequential text markup language (TTML) subtitles and the content of each tag. The method comprises a label for displaying the caption, wherein the label records the address of the text resource of the time sequence text markup language TTML caption. And accessing the address to obtain the text resource of the TTML subtitle. Optionally, the text resource of the time-series text Markup Language TTML subtitle is written in an Extensible Markup Language (XML) format.
And step 120, determining at least one group of subtitle output information according to the text resources of the TTML subtitles.
Wherein each set of subtitle output information includes a subtitle output time and subtitle content. The text resource of the time sequence text markup language TTML caption comprises at least one group of caption output information. Each set of subtitle output information includes a subtitle output time representing a time at which a subtitle is output and subtitle content.
Since the caption is combined with the multimedia playing, the caption output time is associated with the playing duration of the multimedia playing, or associated with one or more frame pictures of the multimedia. When the caption output time is associated with the playing time of the multimedia playing, the caption output time is the multimedia playing time, and when the multimedia playing reaches the playing time, the caption content is output. When the caption output time is associated with one or more frame pictures of the multimedia, the caption output time is the multimedia playing duration, and when the multimedia is played to the playing duration, the caption content is output.
Optionally, the subtitle output information includes a subtitle output time and subtitle content. The subtitle output information may include a plurality of subtitle content information pairs, each subtitle content information pair including a subtitle output time, subtitle content, and a subtitle style. The subtitle is divided into a plurality of pairs of subtitle content information according to output time. Illustratively, the pair of subtitle content information is (first second, a), indicating that in the first second of multimedia data playback, the subtitle content is played as a.
Optionally, step 120, determining at least one group of subtitle output information according to the text resource of the TTML subtitle may be implemented in the following manner:
and analyzing the text resource of the TTML caption according to the XML grammar to obtain at least one group of caption output information.
The text resources of the chronological text markup language (TTML) subtitles may be text edited using an XML grammar. The caption output information can be marked in advance according to XML grammar to obtain the text resource of the time sequence text markup language TTML caption in the XML format. Step 120, when the text resource of the time sequence text markup language TTML subtitle in the XML format is obtained, analyzing the text resource according to the XML grammar to obtain at least one group of subtitle output information. The XML grammar has universality, and therefore reliability of subtitle output information identification is achieved.
Step 130, creating a subtitle object of the browser according to the target subtitle output information.
The target caption output information is any one group of caption output information in at least one group of caption output information, the target caption output information comprises target caption content and target caption output time, and the caption object is used for triggering a target caption event at the target caption output time so as to output the target caption content in an HTML page according to the target caption event in a browser.
One subtitle object is created for each set of subtitle output information. And configuring a target subtitle object to start a target subtitle event at the target subtitle output time according to the target subtitle output information, wherein the target subtitle event can be recognized by the browser. The target caption event is used to output target caption content in the HTML page at a target caption output time.
The HTML page includes a tag for displaying a subtitle, which is also called a subtitle display tag. Converting the target caption content into a caption text conforming to HTML; embedding the subtitle text of HTML into the tag for displaying subtitles; and outputting the subtitle text of the HTML according to the subtitle display tag.
Optionally, the page may be an HTML page, and optionally, the page is an HTML5 page. HTML5 is a language description way to build Web content. HTML5 is the next generation standard for the internet and is a language way to build and present internet content. The HTML5 page is an HTML page described using the HTML5 language. The syntax of the page is in the hypertext markup language HTML.
The subtitle processing method provided by the embodiment of the application obtains text resources of a time sequence text markup language (TTML) subtitle; determining at least one group of subtitle output information according to the text resources of the TTML subtitles; and creating a subtitle object of the browser according to the target subtitle output information, wherein the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output target subtitle content in the HTML page according to the target subtitle event in the browser. Compared with the problem that the current browser cannot play the time sequence text markup language subtitles and is poor in compatibility, the method and the device for playing the time sequence text markup language subtitles can determine subtitle output information according to the text resources of the time sequence text markup language letters after acquiring the text resources of the time sequence text markup language subtitles, create the subtitle objects of the browser according to the target subtitle output information, and enable the created subtitle objects to trigger the target subtitle events at the target letter output time. And the browser outputs the target subtitle content in response to the target subtitle event, so that the target subtitle content is output in the HTML page. And creating a subtitle object which can be supported by the browser according to the text resource of the time sequence text markup language, wherein the browser can respond to a target subtitle event triggered by the subtitle object, and then playing the time sequence text markup language subtitle in an HTML page, so that the compatibility of the browser is improved.
Example two
Fig. 2 is a flowchart of a subtitle processing method according to a second embodiment of the present application. In a usage scenario, the output mode of the TTML subtitle provided by the embodiment of the present application runs under the imscjs. Js is an open source TTML subtitle rendering framework written in JavaScript. The latest imsc1.1 standard of W3C is supported. com/sandflow/imscJS may download the latest version of imscJS through https:// github. And after loading the imscjs.js, editing an imscjs.js file, wherein the file comprises the script which is edited by the JavaScript language and corresponds to the analysis and the mode of the TTML subtitle. Js file content can also be read. The webpage designer can edit the imscJS.js file under the imscJS.js frame. When the browser outputs the HTML page, the imscJS.js frame is previewed and loaded, so that the content of the imscJS.js file can be read under the frame, and the TTML subtitles in the HTML page are analyzed and rendered. When the page contains the TTML subtitles, introducing an imscJS.js file into the page so as to obtain a script edited by a JavaScript language recorded in the imscJS.js file.
As a further description of the above embodiment, before step 110, the method further includes: and generating a subtitle display area in the HTML page according to the subtitle display tag in the browser. Accordingly, the step 130 of outputting the caption content in the HTML page according to the caption event in the browser may be implemented as follows: converting the target caption content into a target caption text conforming to HTML; and embedding the target subtitle text into the subtitle display tag so that the browser outputs the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag. When implemented in the above manner, the method comprises:
and step 210, generating a subtitle display area in the HTML page according to the subtitle display tag in the browser.
From the code of the HTML page, a subtitle display tag for displaying a subtitle can be known. When an HTML page is initialized, a plurality of regions are created according to the code of the HTML page, with different regions acting differently according to the content of the code tags. Alternatively, a < div > tag may be used as a subtitle display tag. And when the browser acquires the tag according to the code of the HTML page, a subtitle display area is created in the HTML page.
And step 220, acquiring a text resource of the time sequence text markup language (TTML) subtitle.
The execution of step 220 may refer to the description of step 110.
Optionally, step 220, obtaining the text resource of the time-series text markup language (TTML) subtitle may be implemented in the following manner:
acquiring a link address of a text resource of the TTML through a track tag, wherein a subtitle display tag comprises the track tag; and acquiring the text resource of the TTML subtitle according to the link address.
In the code of the HTML page, the Track tag may be a < Track > tag in HTML, which is nested within a subtitle display tag. The < Track > tag stores a link address, which is an address of a text resource of the TTML. After the link address of the text resource of the TTML is obtained, the text resource of the TTML subtitle can be downloaded by accessing the link address.
The designer of the HTML page can configure different subtitles for the HTML page by changing the link address in the < Track > tag. Furthermore, designers of the HTML webpage can modify the text resource of the TTML subtitle and move to adjust the subtitle in the HTML page accessing the text resource of the TTML subtitle, so that the subtitle modification efficiency is improved.
Step 230, determining at least one group of subtitle output information according to the text resource of the TTML subtitle, wherein each group of subtitle output information comprises subtitle output time and subtitle content.
The process of step 230 can be performed as described with reference to step 120.
Step 240, creating a subtitle object of the browser according to the target subtitle output information.
The target caption output information is any one group of caption output information in at least one group of caption output information, the target caption output information comprises target caption content and target caption output time, and the caption object is used for triggering a target caption event at the target caption output time.
The execution of step 240 can be as described with reference to step 130.
Further, the target subtitle output information includes a target subtitle style. Accordingly, step 240, creating a subtitle object of the browser according to the target subtitle output information, may be implemented by:
and creating a target subtitle object according to the target subtitle output information, wherein the target subtitle object is used for triggering a target subtitle event at the target subtitle output time, so that the browser can output target subtitle content in a target subtitle mode in the HTML page according to the target subtitle event.
Optionally, the subtitle output information includes a subtitle output time, subtitle content, and subtitle style.
The subtitle output information may include a plurality of subtitle content information pairs, each subtitle content information pair including a subtitle output time, subtitle content, and a subtitle style. The subtitle is divided into a plurality of pairs of subtitle content information according to output time. Illustratively, the pair of subtitle content information is (first second, a), which means that in the first second of multimedia data playing, the subtitle content is a and the subtitle style is a.
The TTML subtitle can mark not only the output time and content of the subtitle but also the style of the subtitle. And if the target subtitle output information comprises a target subtitle style, triggering a target subtitle event by the created target subtitle object at the target subtitle output time, wherein the subtitle event comprises rendering the target subtitle content according to the target subtitle style.
According to the embodiment, the subtitles in the HTML page can be rendered according to the style characteristics of the TTML subtitles, so that the subtitle styles are enriched, and the subtitle visual effect is improved.
Step 250, when the target caption event is triggered, converting the target caption content into a target caption text conforming to the HTML.
Optionally, the ISD is created when a target caption event is triggered. ISD is the HTML representation of the subtitle style. And assigning the ISD according to the target subtitle content and the target subtitle style conversion so as to obtain a subtitle text conforming to the HTML. And transferring the subtitle text conforming to the HTML into the subtitle display tag, so that when the browser runs the page, the subtitle text is output according to the subtitle text conforming to the HTML transferred into the subtitle display tag.
And step 260, embedding the target subtitle text into the subtitle display tag, so that the browser outputs the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag.
The target caption text conforms to the HTML syntax, and optionally, the assigned ISD may be used as the target caption text. And embedding the target subtitle text into a subtitle display tag of the HTML page code. When the HTML page is displayed according to the HTLM page code, the target subtitle text is output in the subtitle display area.
Further, after outputting the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag in the browser, in other words, after outputting the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag in the browser, the method further includes:
and deleting the target subtitle text in the target subtitle display label.
When there are a plurality of subtitle output information, a plurality of target subtitle events are generated. The output time corresponding to each target subtitle event is different. And after a certain target subtitle text is output, if the next target subtitle event of the target subtitle event corresponding to the target subtitle text is triggered, deleting the target subtitle text. And migrating the target caption text corresponding to the next target caption event into the target caption display label. And deleting the target subtitle text in the target subtitle display label in real time to realize the alternate playing of the subtitles.
The above method is explained below by means of an example of use:
the method comprises the following steps: js is loaded in the output device of the HTML page.
And (3) downloading the latest version of the imscJS through https:// github.com/sandflow/imscJS, and configuring the imscJS architecture.
Step two: from the code of the HTML page, a subtitle display tag (< div > tag) is created for which the subtitle is rendered blank, and the display of the subtitle will be implemented within the div.
When the HTML page is output, the previously edited imscjs. According to the JavaScript statement described in the document, the following steps are executed: and acquiring the URL address of the TTML subtitle text through a Track tag < Track > contained in the code of the HTML page, and downloading the text resource of the TTML subtitle.
Step three: parsing and rendering TTML subtitles according to records of imsc.JS files
3.1 analyzing the text resource of the TTML caption to obtain at least one group of caption output information. And analyzing information such as time, caption content, caption style and the like according to the TTML caption file in the XML format.
3.2 creating the subtitle object of the browser according to the target subtitle output information. And generating a subtitle object supported by the browser according to the acquired subtitle output information. When the subtitle object outputs multimedia data, a target subtitle event is triggered when the target subtitle output time is reached.
3.3 when the target caption event is triggered, the ISD is created. And assigning the ISD according to the subtitle output information to obtain a target subtitle text conforming to the HTML.
3.4 rendering subtitles. And 3.3, embedding the target subtitle text generated in the step 3.3 into div of a subtitle rendering area, and presenting a rich subtitle effect.
3.5 clear subtitles. When the browser triggers a subtitle end event, the HTML elements in the div of the subtitle rendering area are emptied.
3.6, the current caption event is ended, the next caption event is waited to start, and the steps 3.3, 3.4 and 3.5 are repeated.
The subtitle processing method provided by the embodiment of the application obtains text resources of a time sequence text markup language (TTML) subtitle; determining at least one group of subtitle output information according to the text resources of the TTML subtitles; and creating a subtitle object of the browser according to the target subtitle output information, wherein the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output target subtitle content in the HTML page according to the target subtitle event in the browser. Compared with the problem that the current browser cannot play the time sequence text markup language subtitles and is poor in compatibility, the method and the device for playing the time sequence text markup language subtitles can determine subtitle output information according to the text resources of the time sequence text markup language letters after acquiring the text resources of the time sequence text markup language subtitles, create the subtitle objects of the browser according to the target subtitle output information, and enable the created subtitle objects to trigger the target subtitle events at the target letter output time. And the browser outputs the target subtitle content in response to the target subtitle event, so that the target subtitle content is output in the HTML page. And creating a subtitle object which can be supported by the browser according to the text resource of the time sequence text markup language, wherein the browser can respond to a target subtitle event triggered by the subtitle object, and then playing the time sequence text markup language subtitle in an HTML page, so that the compatibility of the browser is improved. The development work and the platform adaptation amount can be effectively reduced through the imscJS. Meanwhile, the latest TTML standard can be better supported, and the TTML subtitles meeting the Internet requirements at the beginning of design are better met. According to the embodiment of the application, the method based on the front end (browser) is adopted to realize the support of the TTML subtitles, the scheme has the characteristics of cross-platform, good compatibility and small workload, and meanwhile, the realization mode based on the front end is in accordance with the original intention of the design of the TTML. The method supports a mainstream browser (such as a Google browser) and simultaneously supports the latest standard of the IMSC1.1 of W3C, wherein the embedding of rich media contents such as audio, images and fonts is newly added, and the richness and the universality of subtitle contents are high.
EXAMPLE III
Fig. 3 is a flowchart of a subtitle processing method according to a third embodiment of the present application, where the present embodiment is applicable to a case where a browser outputs a sequential text markup language, the apparatus may be executed by a computer device, and the computer device can run the browser, where the apparatus specifically includes: a text resource obtaining module 310, a subtitle output information determining module 320, and a subtitle object generating module 330.
A text resource obtaining module 310, configured to obtain a text resource of a time series text markup language (TTML) subtitle;
the subtitle output information determining module 320 is configured to determine at least one group of subtitle output information according to text resources of the TTML subtitles, where each group of subtitle output information includes subtitle output time and subtitle content;
and the subtitle object generating module 330 is configured to create a subtitle object of the browser according to the target subtitle output information, where the target subtitle output information is any one of at least one group of subtitle output information, the target subtitle output information includes target subtitle content and target subtitle output time, and the subtitle object is configured to trigger a target subtitle event at the target subtitle output time, so as to output the target subtitle content in an HTML page according to the target subtitle event in the browser.
On the basis of the foregoing embodiment, the subtitle output information determining module 320 is configured to:
and analyzing the text resource of the TTML caption according to the XML grammar to obtain at least one group of caption output information.
On the basis of the embodiment, the browser also comprises a subtitle display area generating module, which is used for generating a subtitle display area in the HTML page according to the subtitle display tag in the browser;
accordingly, the subtitle object generating module 330 is configured to:
converting the target caption content into a target caption text conforming to HTML;
and embedding the target subtitle text into the subtitle display tag so that the browser outputs the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag.
On the basis of the above embodiment, the subtitle display device further includes a subtitle deletion module for deleting the target subtitle text in the target subtitle display tag.
On the basis of the foregoing embodiment, the text resource obtaining module 310 is configured to:
acquiring a link address of a text resource of the TTML through a track tag, wherein a subtitle display tag comprises the track tag;
and acquiring the text resource of the TTML subtitle according to the link address.
On the basis of the foregoing embodiment, the target subtitle output information further includes a target subtitle style, and accordingly, the subtitle object generating module 330 is configured to:
and creating a target subtitle object according to the target subtitle output information, wherein the target subtitle object is used for triggering a target subtitle event at the target subtitle output time, so that the browser can output target subtitle content in a target subtitle mode in the HTML page according to the target subtitle event.
In the subtitle processing apparatus provided in the embodiment of the present application, the text resource obtaining module 310 obtains a text resource of a time series text markup language (TTML) subtitle; the subtitle output information determining module 320 determines at least one group of subtitle output information according to the text resource of the TTML subtitle; the subtitle object generating module 330 creates a subtitle object of the browser according to the target subtitle output information, where the subtitle object is used to trigger a target subtitle event at a target subtitle output time, so as to output target subtitle content in an HTML page according to the target subtitle event in the browser. Compared with the problem that the current browser cannot play the time sequence text markup language subtitles and is poor in compatibility, the method and the device for playing the time sequence text markup language subtitles can determine subtitle output information according to the text resources of the time sequence text markup language letters after acquiring the text resources of the time sequence text markup language subtitles, create the subtitle objects of the browser according to the target subtitle output information, and enable the created subtitle objects to trigger the target subtitle events at the target letter output time. And the browser outputs the target subtitle content in response to the target subtitle event, so that the target subtitle content is output in the HTML page. And creating a subtitle object which can be supported by the browser according to the text resource of the time sequence text markup language, wherein the browser can respond to a target subtitle event triggered by the subtitle object, and then playing the time sequence text markup language subtitle in an HTML page, so that the compatibility of the browser is improved. The development work and the platform adaptation amount can be effectively reduced through the imscJS. Meanwhile, the latest TTML standard can be better supported, and the TTML subtitles meeting the Internet requirements at the beginning of design are better met. According to the embodiment of the application, the method based on the front end (browser) is adopted to realize the support of the TTML subtitles, the scheme has the characteristics of cross-platform, good compatibility and small workload, and meanwhile, the realization mode based on the front end is in accordance with the original intention of the design of the TTML. The method supports a mainstream browser (such as a Google browser) and simultaneously supports the latest standard of the IMSC1.1 of W3C, wherein the embedding of rich media contents such as audio, images and fonts is newly added, and the richness and the universality of subtitle contents are high.
The subtitle processing device provided by the embodiment of the application can execute the subtitle processing method provided by any embodiment of the application, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a schematic structural diagram of a computer apparatus according to a fourth embodiment of the present application, as shown in fig. 4, the computer apparatus includes a processor 40, a memory 41, an input device 42, and an output device 44; the number of processors 40 in the computer device may be one or more, and one processor 40 is taken as an example in fig. 4; the processor 40, the memory 41, the input device 42 and the output device 43 in the computer apparatus may be connected by a bus or other means, and the connection by the bus is exemplified in fig. 4.
The memory 41, as a computer-readable storage medium, may be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the subtitle processing method in the embodiment of the present application (for example, the text resource obtaining module 310, the subtitle output information determining module 320, and the subtitle object generating module 330 in the subtitle processing apparatus). The processor 40 executes various functional applications of the computer device and data processing by running software programs, instructions, and modules stored in the memory 41, that is, implements the subtitle processing method described above.
The memory 41 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 41 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 41 may further include memory located remotely from processor 40, which may be connected to a computer device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 42 is operable to receive input numeric or character information and to generate key signal inputs relating to user settings and function controls of the computer apparatus. The output device 43 may include a display device such as a display screen.
EXAMPLE five
A fifth embodiment of the present application further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for processing subtitles, the method including:
acquiring a text resource of a time sequence text markup language (TTML) subtitle;
determining at least one group of subtitle output information according to the text resources of the TTML subtitles, wherein each group of subtitle output information comprises subtitle output time and subtitle content;
and creating a subtitle object of the browser according to the target subtitle output information, wherein the target subtitle output information is any one group of subtitle output information in at least one group of subtitle output information, the target subtitle output information comprises target subtitle content and target subtitle output time, and the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output the target subtitle content in an HTML page according to the target subtitle event in the browser.
On the basis of the above embodiment, determining at least one set of subtitle output information according to the text resource of the TTML subtitle includes:
and analyzing the text resource of the TTML caption according to the XML grammar to obtain at least one group of caption output information.
On the basis of the above embodiment, before acquiring the text resource of the time-series text markup language (TTML) subtitle, the method further includes:
generating a subtitle display area in an HTML page according to the subtitle display tag in the browser;
correspondingly, the method for outputting the caption content in the HTML page according to the caption event in the browser comprises the following steps:
converting the target caption content into a target caption text conforming to HTML;
and embedding the target subtitle text into the subtitle display tag so that the browser outputs the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag.
On the basis of the above embodiment, after outputting the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag in the browser, the method further includes:
and deleting the target subtitle text in the target subtitle display label.
On the basis of the above embodiment, acquiring a text resource of a TTML subtitle includes:
acquiring a link address of a text resource of the TTML through a track tag, wherein a subtitle display tag comprises the track tag;
and acquiring the text resource of the TTML subtitle according to the link address.
On the basis of the above embodiment, the target subtitle output information further includes a target subtitle style, and the creating of the subtitle object for the browser according to the subtitle output information includes:
and creating a target subtitle object according to the target subtitle output information, wherein the target subtitle object is used for triggering a target subtitle event at the target subtitle output time, so that the browser can output target subtitle content in a target subtitle mode in the HTML page according to the target subtitle event.
Of course, the storage medium provided in the embodiments of the present application contains computer-executable instructions, and the computer-executable instructions are not limited to the above method operations, and may also perform related operations in the subtitle processing method provided in any embodiments of the present application.
From the above description of the embodiments, it is obvious for those skilled in the art that the present application can be implemented by software and necessary general hardware, and certainly can be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods described in the embodiments of the present application.
It should be noted that, in the embodiment of the subtitle processing apparatus, the included units and modules are merely divided according to functional logic, but are not limited to the above division as long as the corresponding functions can be implemented; in addition, specific names of the functional units are only used for distinguishing one functional unit from another, and are not used for limiting the protection scope of the application.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present application and the technical principles employed. It will be understood by those skilled in the art that the present application is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the application. Therefore, although the present application has been described in more detail with reference to the above embodiments, the present application is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present application, and the scope of the present application is determined by the scope of the appended claims.

Claims (9)

1. A subtitle processing method, comprising:
acquiring a text resource of a time sequence text markup language (TTML) subtitle;
determining at least one group of subtitle output information according to the text resources of the TTML subtitles, wherein each group of subtitle output information comprises subtitle output time and subtitle content;
and creating a subtitle object of the browser according to target subtitle output information, wherein the target subtitle output information is any one group of subtitle output information in the at least one group of subtitle output information, the target subtitle output information comprises target subtitle content and target subtitle output time, and the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output the target subtitle content in an HTML (hypertext markup language) page according to the target subtitle event in the browser.
2. The method of claim 1, wherein determining at least one set of subtitle output information based on the text resources of the TTML subtitle comprises:
and analyzing the text resource of the TTML subtitle according to XML grammar to obtain the at least one group of subtitle output information.
3. The method according to claim 1 or 2, before acquiring the text resource of the time-series text markup language (TTML) subtitle, further comprising:
generating a subtitle display area in an HTML page according to a subtitle display tag in the browser;
correspondingly, the outputting the caption content in the browser according to the caption event in an HTML page includes:
converting the target caption content into a target caption text conforming to HTML;
and embedding the target subtitle text into the subtitle display tag so that the browser can output the target subtitle content in the subtitle display area according to the target subtitle text in the subtitle display tag.
4. The method of claim 3, wherein after outputting the target subtitle content in the subtitle display area in the browser according to the target subtitle text in the subtitle display tag, further comprising:
and deleting the target subtitle text in the target subtitle display label.
5. The method of claim 4, wherein the obtaining the text resource of the TTML subtitle comprises:
acquiring a link address of a text resource of the TTML through a track tag, wherein the subtitle display tag comprises the track tag;
and acquiring text resources of the TTML subtitles according to the link address.
6. The method of claim 3, wherein the target subtitle output information further includes a target subtitle style, and wherein creating a subtitle object for a browser according to the subtitle output information includes:
and creating a target subtitle object according to the target subtitle output information, wherein the target subtitle object is used for triggering a target subtitle event at target subtitle output time so that the browser can output the target subtitle content in a HTML page in a target subtitle mode according to the target subtitle event.
7. A subtitle processing apparatus, comprising:
the text resource acquisition module is used for acquiring text resources of the TTML subtitles;
the caption output information determining module is used for determining at least one group of caption output information according to the text resources of the TTML caption, wherein each group of caption output information comprises caption output time and caption content;
and the subtitle object generating module is used for creating a subtitle object of the browser according to target subtitle output information, the target subtitle output information is any one group of subtitle output information in the at least one group of subtitle output information, the target subtitle output information comprises target subtitle content and target subtitle output time, and the subtitle object is used for triggering a target subtitle event at the target subtitle output time so as to output the target subtitle content in an HTML (hypertext markup language) page according to the target subtitle event in the browser.
8. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the subtitle processing method according to any one of claims 1-6 when executing the program.
9. A storage medium containing computer-executable instructions for performing the subtitle processing method according to any one of claims 1-6 when executed by a computer processor.
CN202110541871.4A 2021-05-18 2021-05-18 Subtitle processing method, subtitle processing device, computer equipment and storage medium Pending CN113127785A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110541871.4A CN113127785A (en) 2021-05-18 2021-05-18 Subtitle processing method, subtitle processing device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110541871.4A CN113127785A (en) 2021-05-18 2021-05-18 Subtitle processing method, subtitle processing device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113127785A true CN113127785A (en) 2021-07-16

Family

ID=76782254

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110541871.4A Pending CN113127785A (en) 2021-05-18 2021-05-18 Subtitle processing method, subtitle processing device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113127785A (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104883614A (en) * 2015-05-19 2015-09-02 福建宏天信息产业有限公司 WEB video playing method based on Adobe FlashPlayer and Jquery frame
CN105704582A (en) * 2015-05-11 2016-06-22 深圳Tcl数字技术有限公司 Browser-based subtitle displaying method and device
CN106804011A (en) * 2017-02-10 2017-06-06 深圳创维数字技术有限公司 The method and system of loading caption file during a kind of broadcasting video
CN106954095A (en) * 2017-04-17 2017-07-14 腾讯科技(深圳)有限公司 The player method and device of a kind of multimedia file
US20180197098A1 (en) * 2017-01-10 2018-07-12 Facebook, Inc. Systems and methods for captioning content
US20180205975A1 (en) * 2015-07-06 2018-07-19 Lg Electronics Inc. Broadcast signal transmission device, broadcast signal reception device, broadcast signal transmission method, and broadcast signal reception method
CN111601142A (en) * 2020-05-08 2020-08-28 青岛海信传媒网络技术有限公司 Subtitle display method and display equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105704582A (en) * 2015-05-11 2016-06-22 深圳Tcl数字技术有限公司 Browser-based subtitle displaying method and device
CN104883614A (en) * 2015-05-19 2015-09-02 福建宏天信息产业有限公司 WEB video playing method based on Adobe FlashPlayer and Jquery frame
US20180205975A1 (en) * 2015-07-06 2018-07-19 Lg Electronics Inc. Broadcast signal transmission device, broadcast signal reception device, broadcast signal transmission method, and broadcast signal reception method
US20180197098A1 (en) * 2017-01-10 2018-07-12 Facebook, Inc. Systems and methods for captioning content
CN106804011A (en) * 2017-02-10 2017-06-06 深圳创维数字技术有限公司 The method and system of loading caption file during a kind of broadcasting video
CN106954095A (en) * 2017-04-17 2017-07-14 腾讯科技(深圳)有限公司 The player method and device of a kind of multimedia file
CN111601142A (en) * 2020-05-08 2020-08-28 青岛海信传媒网络技术有限公司 Subtitle display method and display equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
PETERBE: "initial en-us content checkin", 《HTTPS://GITHUB.COM/MDN/CONTENT/COMMIT/CBE151A06D6E5B4D1FBB46081BD16E69EF4C1630》 *
奇舞周刊: "TTML—让W3C获得艾美奖的字幕规范", 《CSDN》 *

Similar Documents

Publication Publication Date Title
CN108415702B (en) Dynamic rendering method and device for application interface of mobile terminal
US9857959B2 (en) Supporting webpage design and revision irrespective of webpage framework
US20150286739A1 (en) Html5-protocol-based webpage presentation method and device
US20040133855A1 (en) Providing a presentation engine adapted for use by a constrained resource client device
CN107066618B (en) Method and device for displaying converted webpage
CN110955428A (en) Page display method and device, electronic equipment and medium
CN108710490B (en) Method and device for editing Web page
CN112632437A (en) Webpage generating method and device and computer readable storage medium
CN110457609A (en) A kind of method, apparatus, computer equipment and the storage medium of page processing
CN112256990B (en) Image processing method and device and computer readable storage medium
CN112269576A (en) Component display method and device, server and storage medium
CN108170409B (en) Development method and system of WEB front-end control
CN111241793A (en) Method, system, and medium for parsing rich text editor content for native client rendering
CN111221530A (en) Mobile terminal Web application interface construction method, Web application interface and operation method thereof
CN111506844B (en) Page processing method, device and computer storage medium
CN111723314B (en) Webpage display method and device, electronic equipment and computer readable storage medium
CN112632425A (en) Method, device, equipment and storage medium for generating offline resource file
CN112307385A (en) Webpage data loading and processing method and device, electronic equipment and storage medium
CN115659087B (en) Page rendering method, equipment and storage medium
CN117055987A (en) Webpage display method and device, electronic equipment and computer readable storage medium
CN116578795A (en) Webpage generation method and device, storage medium and electronic equipment
CN113127785A (en) Subtitle processing method, subtitle processing device, computer equipment and storage medium
CN115169292A (en) Document processing method and device, electronic equipment and computer readable storage medium
CN112738562B (en) Method, device and computer storage medium for transparent display of browser page
CN116820635A (en) Document block sharing method, device, system and storage medium

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20210716

RJ01 Rejection of invention patent application after publication