Subtitle processing method, subtitle processing device and electronic equipment

By deduplication and mapping the attribute data of subtitle entries, batch processing of subtitle entries is realized, solving the problem of repeated redundant data in subtitle template storage, reducing memory consumption and improving processing speed.

CN119697451APending Publication Date: 2025-03-25WONDERSHARE TECH (HUNAN) CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411745677.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-29
Publication Date
2025-03-25

AI Technical Summary

Technical Problem

In the prior art, there is a large amount of duplicate redundant data for template storage of subtitles, resulting in memory waste and maintenance consumption of performance.

Method used

By obtaining the attribute data of the subtitle entries, deduplication and mapping, batch processing of subtitle entries with the same attribute data is realized.

Benefits of technology

Reduces memory consumption, improves subtitles processing speed, and reduces duplicate operations for template maintenance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119697451A_ABST
    Figure CN119697451A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a subtitle processing method. The subtitle processing method comprises the following steps: acquiring attribute data of subtitle entries; performing duplicate removal processing on the attribute data of the subtitle entry, and mapping the attribute data with the subtitle entry; and performing batch processing on the subtitle entries according to the attribute data subjected to the duplicate removal processing and the subtitle entries mapped by the attribute data. According to the subtitle processing method provided by the embodiment of the invention, the batch processing of the subtitles can be realized, the consumption of a memory is reduced, and the subtitle processing speed is improved. The embodiment of the invention further provides a subtitle processing device and electronic equipment.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of video processing technology, and more specifically, to a subtitle processing method, device, and electronic device. Background Art

[0002] With the rapid development of multimedia technology, subtitles are increasingly used in video content. As an indispensable part of video production, subtitles are an indispensable requirement for semi-professional and professional groups when editing medium (such as movies) or large (such as TV series) videos. Subtitles can better maintain the consistency and coherence of video content, improve the adaptability of videos, play a key role in promoting information accessibility and enhancing audience experience, and enhance the dissemination effect and globalization potential of video content.

[0003] Subtitles are short and frequently switched elements in videos, and in most stages, the basic properties and animation effects of subtitles do not change. Therefore, saving a template for each subtitle will result in a large amount of duplicate redundant data, a waste of memory, and repeated operations for template maintenance, which consumes performance. Summary of the invention

[0004] In view of the problems existing in the above-mentioned prior art, the embodiments of the present application provide a subtitle processing method, device, and electronic device, which can realize batch processing of subtitles, reduce memory consumption, and improve the processing speed of subtitles.

[0005] In a first aspect, an embodiment of the present application provides a subtitle processing method, comprising the following steps:

[0006] Get the attribute data of the subtitle entry;

[0007] Deduplication processing is performed on the attribute data of the subtitle entry, and mapping is performed with the subtitle entry; and

[0008] The subtitle entries are batch processed according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0009] Furthermore, the batch processing of the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto includes:

[0010] Obtaining index data of the subtitle entry corresponding to the attribute data; and

[0011] The subtitle entries are batch processed according to the index data and the modification attributes of the subtitle entries.

[0012] Furthermore, after batch processing the subtitle entries according to the index data and modification attributes of the subtitle entries, the method further includes:

[0013] The attribute data of the subtitle entry is refreshed and mapped with the subtitle entry.

[0014] Furthermore, the refreshing of the attribute data of the subtitle entry and mapping with the subtitle entry includes:

[0015] Writing back the attribute data of the subtitle entry; and

[0016] The attribute data is deduplicated and hash-mapped with the subtitle entry.

[0017] Furthermore, the attribute data of the subtitle entry includes an attribute template and an animation template, and the subtitle entry is batch processed according to the attribute data after deduplication processing and the subtitle entry mapped thereto, including:

[0018] Obtaining an all-inclusive template and / or a non-all-inclusive template of the subtitle entry;

[0019] For the all-inclusive template, modifying the template attributes; and

[0020] For the non-fully inclusive template, the template attributes are modified after cloning.

[0021] Furthermore, before obtaining the attribute data of the subtitle entry, the method further includes:

[0022] Traverse the subtitle entries.

[0023] Furthermore, before traversing the subtitle entries, the method further includes:

[0024] The index data of the subtitle entry is divided by time slices.

[0025] In a second aspect, the embodiment of the present application further provides a subtitle processing device, including:

[0026] An attribute acquisition module, used to acquire attribute data of a subtitle entry;

[0027] a subtitle mapping module, configured to perform deduplication processing on the attribute data of the subtitle entry and map it with the subtitle entry; and

[0028] The batch processing module is used to batch process the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0029] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor is configured to implement the subtitle processing method according to the first aspect when executing the program.

[0030] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium on which a computer program is stored, wherein the computer program is used to implement the subtitle processing method according to the first aspect above.

[0031] The embodiments of the present application bring the following beneficial effects:

[0032] In the subtitle processing method provided in the embodiment of the present application, the attribute data of the subtitle entry is first obtained, and then the attribute data of the subtitle entry is deduplicated and mapped with the subtitle entry, and finally the subtitle entries are batch processed according to the deduplicated attribute data and the subtitle entry mapped with it. The subtitle processing method provided in the embodiment of the present application, after deduplicating the attribute data of the subtitle entry and mapping it with the subtitle entry, if the attribute data corresponding to the subtitle entry is modified, and then the modified attribute data is passed to the subtitle entry, it is possible to realize batch processing of subtitle entries with the same attribute data, which can reduce memory consumption and improve the processing speed of subtitles. BRIEF DESCRIPTION OF THE DRAWINGS

[0033] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying any creative work.

[0034] Figure 1 A flowchart of a subtitle processing method provided in an embodiment of the present application;

[0035] Figure 2 for Figure 1 A flowchart of specific steps in a subtitle processing method;

[0036] Figure 3 for Figure 1 A flowchart of another specific step in the subtitle processing method;

[0037] Figure 4 A structural block diagram of a subtitle processing device provided in an embodiment of the present application;

[0038] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.

[0039] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

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

[0041] In the specification and claims of this application and the above-mentioned drawings, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of this application, unless otherwise specified, "multiple" means two or more. For ordinary technicians in this field, the specific meanings of the above terms in this application can be understood according to the specific circumstances.

[0042] Figure 1 FIG. 1 is a flowchart of a subtitle processing method according to an embodiment of the present application. Figure 1 As shown, the subtitle processing method of the embodiment of the present application includes the following steps:

[0043] S101: Acquire attribute data of a subtitle entry;

[0044] Existing non-linear editing systems usually use a template-based subtitle usage method, which encapsulates the basic attributes and animation effects of subtitles into a template and applies them to subtitles. Each subtitle has a corresponding attribute template and animation template. When rendering subtitles, the corresponding template can be directly read to generate the effect.

[0045] Subtitles are short and frequently switched elements in videos, and the basic properties and animation effects of subtitles do not change in most stages. Therefore, saving a template for each subtitle will result in a large amount of duplicate redundant data, a waste of memory, and repeated operations for template maintenance, which consumes performance.

[0046] In the subtitle file stored, there are different subtitle item entities, each of which stores a subtitle, and the order is expressed in the form of subscripts and levels, and corresponds to the start time and end time of the subtitle. Each item entity corresponds to its attribute data.

[0047] Therefore, in the subtitle processing method provided in the embodiment of the present application, it is first necessary to obtain the attribute data of the subtitle entry. Specifically, it is first necessary to import a subtitle file in the srt format and store the subtitle file as a subtitle entity. Then, the subtitle entry is obtained in the stored subtitle entity, and the attribute data of the subtitle entry is obtained.

[0048] S102: performing deduplication processing on the attribute data of the subtitle entry and mapping the attribute data with the subtitle entry; and

[0049] As mentioned above, each entry entity of the subtitle file has its attribute data. Therefore, after obtaining the attribute data of the subtitle entry, it is necessary to deduplicate the attribute data and map it with the corresponding subtitle entry to avoid storing duplicate redundant data and reduce memory waste.

[0050] S103: batch processing the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0051] Specifically, after the attribute data of the subtitle entry is deduplicated and mapped with the subtitle entry, if the attribute data corresponding to the subtitle entry is modified and then the modified attribute data is transferred to the subtitle entry, the subtitle entries with the same attribute data can be batch processed.

[0052] Therefore, in the subtitle processing method provided in the embodiment of the present application, the attribute data of the subtitle entry is first obtained, and then the attribute data of the subtitle entry is deduplicated and mapped with the subtitle entry, and finally the subtitle entries are batch processed according to the deduplicated attribute data and the subtitle entry mapped with it. The subtitle processing method provided in the embodiment of the present application, after deduplicating the attribute data of the subtitle entry and mapping it with the subtitle entry, if the attribute data corresponding to the subtitle entry is modified, and then the modified attribute data is passed to the subtitle entry, it is possible to realize batch processing of subtitle entries with the same attribute data, which can reduce memory consumption and improve the processing speed of subtitles.

[0053] Furthermore, in some embodiments of the present application, further, batch processing the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto includes:

[0054] Obtaining index data of the subtitle entry corresponding to the attribute data; and

[0055] The subtitle entries are batch processed according to the index data and the modification attributes of the subtitle entries.

[0056] Specifically, each subtitle entry entity contains a subtitle and its corresponding start time, end time, subscript and level information. The subscript here is the index data or index array of the subtitle entry. When the subtitle entries are batch processed according to the deduplicated attribute data and the subtitle entries mapped thereto, it is first necessary to obtain the index data of the subtitle entries corresponding to the attribute data, and batch process the subtitle entries according to the index data and modified attributes of the subtitle entries, thereby realizing fast batch processing of subtitles.

[0057] Furthermore, after batch processing the subtitle entries according to the index data and modification attributes of the subtitle entries, the method further includes:

[0058] The attribute data of the subtitle entry is refreshed and mapped with the subtitle entry.

[0059] Specifically, after batch processing the subtitle entries according to the index data and modification attributes of the subtitle entries, it is necessary to provide the index array and modification attributes of the corresponding subtitle entries to the data layer through the data layer interface at the business level, and at the data layer, perform batch settings and template refresh according to the index array and attributes of the subtitle entries, and map them with the corresponding subtitle entries, so as to ensure that the attribute data of the subtitle entries can correspond to the subtitle entries for subsequent processing.

[0060] Furthermore, the refreshing of the attribute data of the subtitle entry and mapping with the subtitle entry includes:

[0061] Writing back the attribute data of the subtitle entry; and

[0062] The attribute data is deduplicated and hash-mapped with the subtitle entry.

[0063] Specifically, as described above, after batch processing the subtitle entries according to the index data and modification attributes of the subtitle entries, Figure 2 As shown, the attribute data of the subtitle entry needs to be refreshed and mapped with the subtitle entry, that is, the attribute data of the subtitle entry needs to be written back, deduplicated, and hash mapped with the subtitle entry, so that the corresponding subtitle entry can be quickly retrieved through the attribute data of the subtitle entry.

[0064] Hash map is a data structure implemented using hash table, which stores data in key-value pairs and allows fast retrieval of corresponding values ​​by key. The basic working principle of hash map is to map a key to an index position through hash function, so as to achieve fast data access. Unlike linear table structures such as arrays, hash map directly locates the data by calculating the hash value of the key, which greatly improves the efficiency of data retrieval.

[0065] Further, refer to Figure 3 The attribute data of the subtitle entry includes an attribute template and an animation template, and the subtitle entry is batch processed according to the attribute data after deduplication processing and the subtitle entry mapped thereto, including:

[0066] Obtaining an all-inclusive template and / or a non-all-inclusive template of the subtitle entry;

[0067] For the all-inclusive template, modifying the template attributes; and

[0068] For the non-fully inclusive template, the template attributes are modified after cloning.

[0069] Specifically, the fully inclusive template means that the subscripts of all subtitle entries using the template are included in the passed index array, while non-fully inclusive means incomplete inclusion. For the fully inclusive module, its template properties can be directly modified, while the non-fully inclusive template clones the template to modify the properties, thereby enabling batch processing of subtitle entries with the same attribute data, reducing memory consumption, and increasing the processing speed of subtitles.

[0070] Furthermore, before acquiring the attribute data of the subtitle entry, the method further includes: traversing the subtitle entry to ensure that each subtitle entry can be retrieved to improve the accuracy of subtitle processing.

[0071] Furthermore, before traversing the subtitle entries, the method further includes:

[0072] The index data of the subtitle entry is divided by time slices.

[0073] That is, in order to improve the traversal speed of subtitle entries, a subtitle entry cache is added. The subtitle processing method provided by the embodiment of the present application implements fast access to subtitle entries by dividing the index of the subtitle entry by time slices, for example, dividing the start time of the subtitle entry by 10 seconds to obtain the segment start value of the subtitle entry.

[0074] Figure 4 2 is a block diagram of a subtitle processing device 200 provided in an embodiment of the present application. Figure 4As shown, the subtitle processing device 200 of the embodiment of the present application includes: an attribute acquisition module 210, a subtitle mapping module 220 and a batch processing module 230, wherein:

[0075] The attribute acquisition module 210 is used to acquire attribute data of a subtitle entry;

[0076] A subtitle mapping module 220, configured to perform deduplication processing on the attribute data of the subtitle entry and map it with the subtitle entry; and

[0077] The batch processing module 230 is used to batch process the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0078] In the subtitle processing device provided in the embodiment of the present application, the attribute data of the subtitle entry is first obtained, and then the attribute data of the subtitle entry is deduplicated and mapped with the subtitle entry, and finally the subtitle entries are batch processed according to the deduplicated attribute data and the subtitle entry mapped with it. The subtitle processing method provided in the embodiment of the present application deduplicates the attribute data of the subtitle entry and maps it with the subtitle entry, and then, if the attribute data corresponding to the subtitle entry is modified, and then the modified attribute data is passed to the subtitle entry, it is possible to realize batch processing of subtitle entries with the same attribute data, reduce memory consumption, and improve the processing speed of subtitles.

[0079] It should be noted that the specific implementation of the subtitle processing device of the embodiment of the present application is similar to the specific implementation of the subtitle processing method of the embodiment of the present application. Please refer to the description of the method part for details, which will not be repeated here.

[0080] Figure 5 Schematic diagram of the structure of an electronic device 300 according to an embodiment of the present application.

[0081] like Figure 5 As shown, the electronic device 300 includes a central processing unit (CPU) 301, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 302 or a program loaded from the storage part 302 to a random access memory (RAM) 303. In the RAM 303, various programs and data required for the operation of the electronic device 300 are also stored. The CPU 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input / output (I / O) interface 305 is also connected to the bus 304.

[0082] The following components are connected to the I / O interface 305: an input section 306 including a keyboard, a mouse, etc.; an output section 307 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 308 including a hard disk, etc.; and a communication section 309 including a network interface card such as a LAN card, a modem, etc. The communication section 309 performs communication processing via a network such as the Internet. A drive 310 is also connected to the I / O interface 305 as needed. A removable medium 311, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 310 as needed, so that a computer program read therefrom is installed into the storage section 308 as needed.

[0083] In particular, according to an embodiment of the present application, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a machine-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 309, and / or installed from a removable medium 311. When the computer program is executed by a central processing unit (CPU) 301, the above-mentioned functions defined in the electronic device of the present application are executed.

[0084] It should be noted that the computer-readable medium shown in the present application may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electronic device, device or device of electricity, magnetism, light, electromagnetic, infrared, or semiconductor, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0085] In the present application, a computer-readable storage medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction-executing electronic device, apparatus, or device. In the present application, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. A computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in combination with an instruction-executing electronic device, apparatus, or device. The program code contained on the computer-readable medium may be transmitted using any suitable medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0086] The flowchart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the processing receiving device, method and computer program product according to various embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment, or a part of the code, and the aforementioned module, program segment, or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of the boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based electronic device that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0087] The units or modules involved in the embodiments of the present application may be implemented by software or hardware. The units or modules described may also be set in a processor, and the processor is used to implement the subtitle processing method when executing the program:

[0088] Get the attribute data of the subtitle entry;

[0089] Deduplication processing is performed on the attribute data of the subtitle entry, and mapping is performed with the subtitle entry; and

[0090] The subtitle entries are batch processed according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0091] As another aspect, the present application further provides a computer-readable storage medium, which may be included in the electronic device described in the above embodiment; or may exist independently and not be installed in the electronic device. The above computer-readable storage medium stores one or more programs, and when the above programs are used by one or more processors to execute the subtitle processing method described in the present application:

[0092] Get the attribute data of the subtitle entry;

[0093] Deduplication processing is performed on the attribute data of the subtitle entry, and mapping is performed with the subtitle entry; and

[0094] The subtitle entries are batch processed according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0095] As another aspect, the present application further provides a computer program product, which may be included in the electronic device described in the above embodiment; or may exist independently without being installed in the electronic device. The above computer program product stores one or more programs, and when the above programs are used by one or more processors to execute the subtitle processing method described in the present application:

[0096] Get the attribute data of the subtitle entry;

[0097] Deduplication processing is performed on the attribute data of the subtitle entry, and mapping is performed with the subtitle entry; and

[0098] The subtitle entries are batch processed according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

[0099] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. All equivalent structural changes made by using the contents of the present application specification and drawings under the application concept of the present application, or directly / indirectly used in other related technical fields are included in the patent protection scope of the present application.

Claims

1. A subtitle processing method, characterized in that: The following steps are involved: Get the attribute data of the subtitle entry; Deduplication processing is performed on the attribute data of the subtitle entry, and mapping is performed with the subtitle entry; and The subtitle entries are batch processed according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

2. The subtitle processing method according to claim 1, characterized in that: The batch processing of the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto comprises: Obtaining index data of the subtitle entry corresponding to the attribute data; and The subtitle entries are batch processed according to the index data and the modification attributes of the subtitle entries.

3. The subtitle processing method according to claim 2, characterized in that: After batch processing the subtitle entries according to the index data and the modified attributes of the subtitle entries, the method further includes: The attribute data of the subtitle entry is refreshed and mapped with the subtitle entry.

4. The subtitle processing method according to claim 1, characterized in that: The refreshing of the attribute data of the subtitle entry and mapping with the subtitle entry includes: Writing back the attribute data of the subtitle entry; and The attribute data is deduplicated and hash-mapped with the subtitle entry.

5. The subtitle processing method according to claim 4, characterized in that: The attribute data of the subtitle entry includes an attribute template and an animation template, and the subtitle entry is batch processed according to the attribute data after deduplication processing and the subtitle entry mapped thereto, including: Obtaining an all-inclusive template and / or a non-all-inclusive template of the subtitle entry; For the all-inclusive template, modifying the template attributes; and For the non-fully inclusive template, the template attributes are modified after cloning.

6. The subtitle processing method according to claim 1, characterized in that: Before obtaining the attribute data of the subtitle entry, the method further includes: Traverse the subtitle entries.

7. The subtitle processing method according to claim 4, characterized in that: Before traversing the subtitle entries, the method further includes: The index data of the subtitle entry is divided by time slices.

8. A subtitle processing device, characterized in that: include: An attribute acquisition module, used to acquire attribute data of a subtitle entry; A subtitle mapping module, used for deduplicating the attribute data of the subtitle entry and mapping it with the subtitle entry; and The batch processing module is used to batch process the subtitle entries according to the attribute data after deduplication processing and the subtitle entries mapped thereto.

9. An electronic device, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor is used to implement the subtitle processing method according to any one of claims 1 to 7 when executing the program.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to implement the subtitle processing method according to any one of claims 1-7.

Citation Information

Cited By

  • Video subtitle editing processing method and device, electronic equipment and storage medium

    CN120281991A