Method, device, equipment, storage medium and program product for switching subtitles

By determining and replacing old subtitles from the universal subtitle content buffer pool during video playback, the problem of low subtitle switching efficiency is solved, and more efficient subtitle updating and switching is achieved.

CN117440218BActive Publication Date: 2025-09-23BEIJING BAIDU NETCOM SCI & TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311490611.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-09
Publication Date
2025-09-23
Estimated Expiration
2043-11-09

AI Technical Summary

Technical Problem

In the existing technology, video subtitle switching has low efficiency and high resource allocation requirements, which cannot meet the user's demand for efficient subtitle switching.

Method used

By responding to a subtitle switching request, the target old subtitle is determined from the general subtitle content buffer pool, and a group of new subtitles are used to replace the target old subtitle and the subsequent old subtitles, thereby achieving subtitle update and switching.

Benefits of technology

It reduces the resource requirements for buffer pool configuration, improves the efficiency of subtitle switching, and makes subtitle switching smoother.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117440218B_ABST
    Figure CN117440218B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, apparatus, device, storage medium and program product for switching subtitles, and relates to technical fields such as media cloud, video processing, and subtitle loading. The method includes: in response to receiving a subtitle switching request for a target video, determining a set of new subtitles as a switching target according to the subtitle switching request; determining target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; in the universal subtitle content buffer pool, replacing the target old subtitles and the old subtitles located after the target old subtitles with at least part of a set of new subtitles. This embodiment provides a method for switching subtitles, which can switch subtitles by replacing old subtitles in the universal subtitle content buffer pool, thereby reducing the buffer pool configuration resource requirements while improving switching efficiency, so that subtitles can be switched more smoothly.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, specifically to technical fields such as media cloud, video processing, and subtitle loading, and in particular to a method, device, electronic device, computer-readable storage medium, and computer program product for switching subtitles. Background Art

[0002] With the development of internet technology, video platforms allow users to access and watch a variety of videos online. In practice, video content is diverse. To facilitate user viewing and understanding, subtitles are often added to videos to present key content. For example, if the video content is produced in a language other than the user's native language, subtitles can be used to provide dialogue information to aid user understanding.

[0003] Accordingly, to make videos more accessible and understandable to a wider audience, multiple subtitle tracks may be included. For example, subtitles written in different languages ​​and idiomatic styles can be selected based on user needs. Therefore, providing users with a better subtitle switching experience and more efficient subtitle switching services are worthy of attention and urgent needs. Summary of the Invention

[0004] Embodiments of the present disclosure provide a method, apparatus, electronic device, computer-readable storage medium, and computer program product for switching subtitles.

[0005] In a first aspect, an embodiment of the present disclosure provides a method for switching subtitles, comprising: in response to receiving a subtitle switching request for a target video, determining a set of new subtitles as a switching target according to the subtitle switching request; determining target old subtitles from a universal subtitle content buffer pool based at least on a current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; and replacing at least part of the target old subtitles and old subtitles located after the target old subtitles in the universal subtitle content buffer pool with a set of new subtitles.

[0006] In a second aspect, an embodiment of the present disclosure proposes a device for switching subtitles, comprising: a new subtitle determination unit, configured to, in response to receiving a subtitle switching request for a target video, determine a set of new subtitles as a switching target according to the subtitle switching request; a target old subtitle determination unit, configured to determine target old subtitles from a universal subtitle content buffer pool based at least on a current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; and a subtitle replacement unit, configured to replace at least part of the target old subtitles and old subtitles located after the target old subtitles in the universal subtitle content buffer pool with a set of new subtitles.

[0007] In a third aspect, an embodiment of the present disclosure provides an electronic device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can implement the method for switching subtitles as described in any implementation method in the first aspect when executing the instructions.

[0008] In a fourth aspect, an embodiment of the present disclosure provides a non-transitory computer-readable storage medium storing computer instructions, which are used to enable a computer to implement the method for switching subtitles as described in any implementation of the first aspect when executed.

[0009] In a fifth aspect, an embodiment of the present disclosure provides a computer program product comprising a computer program, which, when executed by a processor, can implement the method for switching subtitles as described in any implementation manner in the first aspect.

[0010] The method, apparatus, electronic device, computer-readable storage medium, and computer program product for switching subtitles provided by the embodiments of the present disclosure respond upon receiving a subtitle switching request for a target video and determine a set of new subtitles as a switching target based on the subtitle switching request. Then, based at least on the current playback position of the target video, target old subtitles are determined from a universal subtitle content buffer pool used to provide subtitles for the target video. Furthermore, in the universal subtitle content buffer pool, at least a portion of the target old subtitles and the old subtitles located after the target old subtitles can be replaced with a set of new subtitles to achieve the purpose of updating the old subtitles with the new subtitles and switching the subtitles.

[0011] The present disclosure can switch subtitles by replacing old subtitles in a general subtitle content buffer pool, thereby reducing the resource requirements for configuring the buffer pool and improving switching efficiency, so that subtitles can be switched more smoothly.

[0012] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present disclosure, nor are they intended to limit the scope of the present disclosure. Other features of the present disclosure will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0013] Other features, objects and advantages of the present disclosure will become more apparent from a reading of the detailed description of non-limiting embodiments made with reference to the following drawings:

[0014] Figure 1 is an exemplary system architecture in which the present disclosure may be applied;

[0015] Figure 2 A flowchart of a method for switching subtitles provided in an embodiment of the present disclosure;

[0016] Figure 3 A flowchart of a method for determining target old subtitles provided by an embodiment of the present disclosure;

[0017] Figure 4 A flowchart of another method for determining target old subtitles provided by an embodiment of the present disclosure;

[0018] Figure 5 A flowchart of a method for switching subtitles in an application scenario provided by an embodiment of the present disclosure;

[0019] Figure 6 A structural block diagram of a subtitle switching device provided by an embodiment of the present disclosure;

[0020] Figure 7 A schematic structural diagram of an electronic device suitable for executing a method for switching subtitles provided by an embodiment of the present disclosure. DETAILED DESCRIPTION

[0021] The following description of exemplary embodiments of the present disclosure is made in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those skilled in the art that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description. It should be noted that the embodiments in the present disclosure and the features in the embodiments can be combined with each other unless there is a conflict.

[0022] In addition, in the technical solutions involved in this disclosure, the acquisition (such as images containing facial objects involved in the subsequent disclosure), storage, use, processing, transportation, provision and disclosure of user personal information involved all comply with the provisions of relevant laws and regulations and do not violate public order and good morals.

[0023] Figure 1 An exemplary system architecture 100 is shown to which embodiments of the method, apparatus, electronic device, and computer-readable storage medium for switching subtitles disclosed herein can be applied.

[0024] like Figure 1 As shown, system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. Network 104 is a medium for providing communication links between terminal devices 101, 102, 103 and server 105. Network 104 may include various connection types, such as wired or wireless communication links or fiber optic cables.

[0025] Users can use terminal devices 101, 102, and 103 to interact with server 105 via network 104 to receive or send messages, etc. Various applications for enabling information communication between the terminal devices 101, 102, and 103 and server 105 can be installed, such as video applications and online conference applications with playback functions.

[0026] Terminal devices 101, 102, 103 and server 105 can be either hardware or software. When terminal devices 101, 102, 103 are hardware, they can be various electronic devices with display screens, including but not limited to smartphones, tablet computers, laptop computers, and desktop computers. When terminal devices 101, 102, 103 are software, they can be installed in the electronic devices listed above. They can be implemented as multiple software or software modules, or as a single software or software module, and are not specifically limited here. When server 105 is hardware, it can be implemented as a distributed server cluster consisting of multiple servers, or as a single server. When the server is software, it can be implemented as multiple software or software modules, or as a single software or software module, and are not specifically limited here.

[0027] Server 105 can provide various services through various built-in applications. For example, a video application that provides online video viewing (e.g., viewing videos including subtitles) can achieve the following effects when running this video application: First, it can provide videos to terminal devices 101, 102, and 103 via network 104 based on requests from terminal devices 101, 102, and 103. For example, a user can request to obtain and watch a target video through terminal devices 101, 102, and 103. Then, upon receiving a subtitle switching request for the target video, server 105 responds and determines a set of new subtitles to be switched to based on the subtitle switching request. Then, server 105 determines target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video, where the universal subtitle content buffer pool is used to provide subtitles for the target video. Finally, in the universal subtitle content buffer pool, the target old subtitles and the old subtitles located after the target old subtitles are replaced with at least a portion of the set of new subtitles. In some scenarios, the universal subtitle content buffer pool can also be referred to as a subtitle decoding buffer.

[0028] Considering the convenience of video playback and subtitle resource storage, as well as the fact that video storage and the like require a large amount of resources, for example, providing videos online can more conveniently provide video resources to users without excessively occupying the local storage of the terminal device used by the user. Alternatively, providing videos online allows users to obtain video content earlier and faster. Therefore, the method for switching subtitles provided in the subsequent embodiments of the present disclosure is generally performed by a server 105 having strong computing power and more storage and computing resources, so as to provide users with videos and corresponding subtitles in an online manner. Accordingly, the device for switching subtitles is generally also provided in the server 105. For example, the server 105 can provide a video including subtitles to the terminal device 101, 102, or 103 based on a request. For example, the server 105 can read subtitle content from a universal subtitle content buffer pool, render and generate subtitles in the video, and then send the subtitles and the video to the terminal device 101, 102, or 103.

[0029] However, it should also be noted that when terminal devices 101, 102, and 103 also have the required computing power and computing resources, terminal devices 101, 102, and 103 can also complete the various operations originally assigned to server 105 through the video application installed thereon, and thus output the same results as server 105. In particular, when there are multiple terminal devices with different computing capabilities, but the video application determines that the terminal device it is in has stronger computing power and more remaining computing resources, it can allow the terminal device to perform the above-mentioned operations, thereby appropriately reducing the computing pressure on server 105. Accordingly, the device for switching subtitles can also be set in terminal devices 101, 102, and 103. For example, terminal devices 101, 102, and 103 can be configured with a reading thread. The reading thread can, for example, communicate with server 105 via network 104, or based on locally stored data, to read and decapsulate video, audio, and subtitle data. Taking subtitles as an example, terminal devices 101, 102, and 103 can decapsulate data from a specific track based on the user's track selection, and then write the decapsulated data into the raw data buffer based on the type. Furthermore, terminal devices 101, 102, and 103 can read the data to be decoded from their respective raw data buffers, write the decoded data into a common subtitle content buffer, and then read the decoded data from the common subtitle content buffer for rendering and presentation.

[0030] Furthermore, when the terminal devices 101, 102, and 103 use the video applications installed thereon to perform the various operations previously assigned to the server 105 and thereby output the same results as the server 105, for example, when the video and subtitles can be locally acquired by the terminal devices 101, 102, and 103 and the subtitles can be presented and replaced locally, the terminal devices 101, 102, and 103 can locally perform the method of switching subtitles. Accordingly, the exemplary system architecture 100 may also not include the server 105 and the network 104.

[0031] It should be understood that Figure 1 The number of terminal devices, networks and servers in the example is only for reference. Any number of terminal devices, networks and servers may be used as required. Figure 1 For the same purpose, the method for switching subtitles is described using server 105 as the execution entity. It should be understood that using server 105 as the execution entity of the method for switching subtitles is merely exemplary. As described above, in some embodiments, terminal devices 101, 102, or 103 may be selected as the execution entity of the method for switching subtitles based on actual needs.

[0032] Please refer to Figure 2 , Figure 2 This is a flowchart of a method for switching subtitles provided by an embodiment of the present disclosure, wherein process 200 includes the following steps:

[0033] Step 201: In response to receiving a subtitle switching request for a target video, a group of new subtitles as switching targets is determined according to the subtitle switching request.

[0034] In the embodiment of the present disclosure, the execution subject of the method for switching subtitles (eg Figure 1The server 105 shown in the figure can provide the target video and the corresponding subtitles. For example, as described above, the server 105 can send the video content and subtitles of the target video to the terminal devices 101, 102, and 103 according to the request (for example, a request to provide the target video) issued by the user providing the terminal devices 101, 102, and 103, so that the user can use the terminal devices 101, 102, and 103 to watch the video and the corresponding subtitles. For example, the server 105 can add subtitles to the video of the target video, and then use the video frame with subtitles added (for example, adding the subtitles to a preset position in the video frame in a suspended manner) and the corresponding audio information to provide the user with video content including audio, subtitles, and images. Accordingly, when the user expects to switch subtitles, the user can similarly send a subtitle switching request for the target video to the server 105 through the terminal devices 101, 102, and 103, so as to instruct the server 105 to switch the currently issued and provided subtitles to other subtitles through the subtitle switching request. For example, when the subtitles currently provided by the server 105 for the target are subtitles of a first language type (e.g., English), the subtitle switching request can, for example, request that the subtitles of the first language type be switched to subtitles of a second language type (e.g., Chinese) to achieve the purpose of adjusting the subtitles from English to Chinese. This step is intended to be performed by the server 105 here, and respond when receiving the subtitle switching request for the target video to determine a set of new subtitles as the switching target according to the subtitle switching request. For example, in the above example, after receiving the subtitle switching request, the server 105 can determine a set of new subtitles based on the switching target indicated by the subtitle switching request.

[0035] Alternatively or additionally, subtitles can be configured differently based on language style, language type, source, etc. For example, for the same video, subtitle A may be Chinese, subtitle B may be English, and subtitle C may be French. For another example, subtitle D for the same video may be in the Northeastern dialect style, subtitle E may be in the Cantonese style, and so on. For another example, subtitle F for the same video may be provided by user A, and subtitle G may be provided by user B.

[0036] It should be noted that the subtitles can be obtained directly from a local storage device by the above execution subject, or from a non-local storage device (such as Figure 1 The local storage device can be a data storage module provided in the above-mentioned execution subject, such as a server hard disk. In this case, the subtitles can be quickly read locally. The non-local storage device can also be any other electronic device configured to store data, such as some user terminals. In this case, the above-mentioned execution subject can obtain the required video content, subtitles, etc. by sending a retrieval command to the electronic device.

[0037] It should be understood that subtitles can generally be configured for video frames, for example, corresponding subtitles can be determined for the playback position of the video frame. For example, in the playback track of the video frame, the position for adding subtitles is correspondingly determined based on the playback position of the first video frame, the second video frame, etc. For example, a group of subtitles can be composed of a first subgroup of subtitles corresponding to the first video frame and a second subgroup of subtitles corresponding to the second video frame. In practice, in order to facilitate the alignment of video frames and subtitles, timestamps can generally be used to mark video frames and subtitles, and then the video frames and subtitles are paired by aligning the timestamps. For example, video frames and subtitles have their own corresponding tracks, and the server 105 can align the two tracks by the timestamps recorded in the tracks to align the video frames and subtitles.

[0038] Step 202: Determine target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video.

[0039] This step is intended to involve, after obtaining a set of new subtitles based on step 201 above, the server 105 determining target old subtitles from the universal subtitle content buffer pool based at least on the current playback position of the target video. It should be understood that the current playback position should be the position of the video frame in the target video that will be presented to the user, i.e., the video frame corresponding to the current playback position will be viewed by the user. The universal subtitle content buffer pool can provide subtitles for the target video. For example, the server 105 can continuously load each subtitle from a set of subtitles into the universal subtitle content buffer pool so that when the target video is played, the subtitles can be added to the video frames by continuously decoding each subtitle in the universal subtitle content buffer pool. For ease of description, subtitles that have been added to the universal subtitle content buffer pool or that already exist in the universal subtitle content buffer pool can be described as "old subtitles." Accordingly, upon receiving a subtitle switch request for the target video, or upon determining that subtitles need to be switched, the server 105 can determine target old subtitles from the universal subtitle content buffer pool based at least on the current playback position of the target video. The target old subtitles are actually the old subtitles that have not been used for presentation. The server 105 can be based on the target old subtitles as the starting point for replacement to replace the target old subtitles in the universal subtitles content buffer pool and the old subtitles after the target old subtitles, so as to achieve the purpose of updating the subtitles to be used and played later. For example, the server 105 can determine the target old subtitles from the universal subtitles content buffer pool based on the current playback position of the target video. For example, such target old subtitles can at least provide the subtitles of (subtitles) content for the video frame of the current playback position of the target video. In this case, it is possible to achieve, for example, replacing the subtitles in the video frame to be played, so as to achieve the effect of updating the subtitles in the video content that the user is about to watch. In some embodiments, the server 105 can also determine a target playback position based on the current playback position according to a pre-configured strategy, and determine the old subtitles that provide (subtitles) content for the video frame of the target playback position as the target old subtitles. Thus, different strategies can be utilized to differentially determine the target old subtitles to meet different needs.

[0040] Step 203: In the universal subtitle content buffer pool, at least a portion of the target old subtitles and the old subtitles located after the target old subtitles are replaced with a group of new subtitles.

[0041] This step is intended to obtain a group of new subtitles, and then, in the universal subtitle content buffer pool, at least part of the target old subtitles and the old subtitles after the target old subtitles are replaced by a group of new subtitles to achieve the effect of updating. For example, after obtaining a group of new subtitles, the corresponding play position of each new subtitle in a group of new subtitles can be obtained (for example, the play position corresponding to the new subtitles can be obtained based on the timestamp corresponding to the new subtitles). Then, server 105 can replace the old subtitles belonging to the same play position with new subtitles based on the comparison of the play position (for example, the comparison of timestamps), to achieve the updating of the subtitles to the play position. Similarly, server 105 can continuously perform replacement to continuously update the old subtitles in the universal subtitle content buffer pool. In practice, replacement can usually be performed continuously based on the play order, or in other words, the timestamp order. For example, starting from the target old subtitles, the old subtitles in the universal subtitle content buffer pool are continuously replaced based on the play time order.

[0042] Accordingly, after the server 105 completes the replacement, the universal subtitle content buffer pool can continue to be used to provide subtitles for the target video. In this case, because the old subtitles in the universal subtitle content buffer pool have been replaced by the new subtitles, when the universal subtitle content buffer pool is used to provide subtitles for the target video, the old subtitles are replaced by the new subtitles, thereby achieving the purpose of switching subtitles.

[0043] The method for switching subtitles provided by an embodiment of the present disclosure includes, in response to receiving a subtitle switching request for a target video, determining a set of new subtitles as a switching target based on the subtitle switching request; determining target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; and replacing at least a portion of the target old subtitles and old subtitles located after the target old subtitles in the universal subtitle content buffer pool with a set of new subtitles. This embodiment provides a method for switching subtitles, which can perform subtitle switching by replacing old subtitles in the universal subtitle content buffer pool, thereby reducing the buffer pool configuration resource requirements while improving switching efficiency, allowing subtitles to be switched more smoothly.

[0044] In some optional implementations of this embodiment, the method further includes: loading a group of old subtitles into a universal subtitle content buffer pool to generate subtitles for a target video through decoding in the universal subtitle content buffer pool; and stopping loading the group of old subtitles into the universal subtitle content buffer pool in response to receiving a subtitle switching request for the target video.

[0045] Specifically, as described above, server 105 can continuously utilize the universal subtitle content buffer pool to provide subtitles for the target video. When providing old subtitles (for example, before executing the above step 201), server 105 can continuously load a group of old subtitles into the universal subtitle content buffer pool for decoding, and then utilize the universal subtitle content buffer pool to decode and generate subtitles for the target video. For example, continuously store at least a portion of a group of old subtitles in the universal subtitle content buffer pool so that the universal subtitle content buffer pool can continuously output subtitles for the target video based on the stored old subtitles. In this case, if server 105 receives a subtitle switching request for the target video (for example, when executing the above step 201), it can also stop loading a group of old subtitles into the universal subtitle content buffer pool based on the response thereto. Thus, it is possible to avoid mistakenly loading old subtitles that no longer need to be used into the universal subtitle content buffer pool and to avoid wasting computing resources.

[0046] Similarly, in some embodiments of the present disclosure, if in the above-mentioned step 204, only a part of a group of new subtitles is used to complete the replacement operation for the old subtitles. For example, the number of old subtitles included in the universal subtitle content buffer pool is less than the group of new subtitles used to replace them. For ease of understanding, a group of new subtitles can be exemplarily divided into a first part and a second part, the second part being located after the first part, and the second part being connected end to end with the first part. The server 105 can replace all the old subtitles included in the universal subtitle content buffer pool using only the first part. In this case, the server 105 can respond after completing the replacement of the old subtitles using the first part of the group of new subtitles, based on the method of loading the second part of the group of new subtitles into the universal subtitle content buffer pool, so that the universal subtitle content buffer pool can output a group of new subtitles continuously and continuously. As a result, a group of new subtitles can be smoothly switched and connected, or it can be presented continuously to ensure the viewing continuity of the user.

[0047] In some embodiments of the present disclosure, if there is a timestamp associated with the subtitles, or in other words, there is a timestamp associated with the subtitles. The server 105 can respond to this and use the timestamp to screen and filter a group of new subtitles. Specifically, the server 105 can determine whether a group of new subtitles includes overdue new subtitles whose timestamps are before the timestamps corresponding to the target old subtitles based on the comparison of the timestamps of the new subtitles and the timestamps corresponding to the target old subtitles. If there is at least one overdue new subtitle, the server 105 can respond to this and delete at least one overdue new subtitle from the group of new subtitles. In this way, the new subtitles corresponding to the played video part can be avoided from being used incorrectly, and the quality of the subtitles can be guaranteed. In addition, such an approach can also allow new subtitles to be configured in the form of a "complete subtitle file". For example, a group of new subtitles can be a "complete subtitle file" for the complete target video. The server 105 can determine the new subtitles that can actually be used by splitting the "complete subtitle file", or screening and filtering.

[0048] As explained above, if there is a timestamp associated with the subtitles, the new and old subtitles can be aligned for replacement by means of a timestamp sequence. In some optional implementations of this embodiment, the timestamp sequence can be determined with the timestamp corresponding to the target old subtitle as the starting point and the timestamp corresponding to the last old subtitle in the universal subtitle content buffer pool as the end point. In the timestamp sequence, each timestamp corresponds to the old subtitle continuously. In other words, the first timestamp in the timestamp sequence corresponds to the target old subtitle, and the second timestamp corresponds to the first old subtitle after the target old subtitle. Thus, the timestamp sequence can be used to completely record the timestamps of the old subtitles that need to be replaced, so as to use the timestamp sequence to match the timestamps of the new barrage in batches to improve the replacement quality and replacement efficiency. For example, after obtaining the above-mentioned timestamp sequence, the server 105 can determine at least part of the old subtitles used to replace the target old subtitles and the old subtitles located after the target old subtitles from a group of new subtitles based on the timestamp sequence. For example, the timestamp sequence, starting with the timestamp of the target old subtitle, includes timestamps X1:Y1, X2:Y2, X3:Y3, and X4:Y4. Server 105 can determine new subtitles from the set of new subtitles to replace at least part of the old subtitles. For example, the timestamps corresponding to the determined at least part of the new subtitles may be X1:Y1, X2:Y2, X3:Y3, and X4:Y4.

[0049] The server 105 may also determine at least a portion of the above-mentioned set of new subtitles for replacing the old subtitles from the set of new subtitles in advance by comparing timestamps. In some optional implementations of this embodiment, determining at least a portion of the target old subtitles and the old subtitles located after the target old subtitles from the set of new subtitles based on the timestamp sequence includes: determining at least a portion based on comparing the timestamps of each new subtitle in the set of new subtitles with the timestamps of the target old subtitles and the timestamps of the old subtitles located after the target old subtitles, wherein each new subtitle in the at least portion has the same timestamp as the corresponding target old subtitle or the old subtitle located after the target old subtitle. Specifically, for example, in the above example, if the timestamp sequence includes timestamps X1:Y1, X2:Y2, X3:Y3, and X4:Y4, the server 105 may extract the corresponding at least a portion of the new subtitles from the set of new subtitles based on timestamps X1:Y1, X2:Y2, X3:Y3, and X4:Y4. Therefore, after obtaining a timestamp sequence, or in other words, the timestamps expected to be replaced, the corresponding new subtitles are determined based on this streamlined approach, improving efficiency while retaining only the new subtitles that can be correctly used for replacement. This avoids storing too many new subtitles and wasting storage resources, while also preventing incorrect replacements caused by incorrect storage.

[0050] Furthermore, the server 105 may continuously replace the target old subtitles and the old subtitles located after the target old subtitles with at least part of the new subtitles. For example, the target old subtitles may be replaced with new subtitles having the same timestamp as X1:Y1. After this, the old subtitles having the same timestamp as X2:Y2 may be replaced with new subtitles having the same timestamp as X2:Y2, and so on.

[0051] As described above, based on some strategies, the old subtitles corresponding to the target playback position other than the current playback position can be determined as the target old subtitles to meet different needs. Figure 3 . Figure 3 A flowchart of a method for determining target old subtitles according to one embodiment of the present disclosure includes process 300. For example, process 300 may be an alternative to step 202 described above, and is used to determine target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video. Specifically, process 300 includes the following steps:

[0052] Step 301: Determine the necessary duration based on performance information of a device used to play a target video.

[0053] Specifically, for example, when a user utilizes terminal devices 101, 102, and 103 to obtain and play a target video, there may be differences in the devices used by the users (e.g., terminal devices 101, 102, and 103), resulting in differences in the processing capabilities of the target video and subtitles on the user side. For example, the processing capabilities and processing speed of a device with better performance may be higher. In this regard, in order to ensure that subtitles can be continuously obtained on the user side, or in other words, there will be no subtitle blanks due to the switching of old and new subtitles, the server 105 can select the actual replacement adjustment position so that the subtitles are replaced when the video is actually played to that position. Thus, subtitle replacement can be completed safely and reliably, avoiding the subtitle freeze and blanks caused by the direct subtitle replacement at the current playback position due to insufficient device processing power. Accordingly, the performance information of the device can be provided by the terminal devices 101, 102, and 103 used by the user, for example, including the processing capabilities for images and subtitles, etc. Accordingly, the server 105 can determine the necessary duration based on the performance information of the device. Typically, the necessary duration may include the minimum duration required to load the target number of new subtitles. In other words, the device can safely and reliably complete the subtitle replacement without subtitle freezes or blanks, and can play old and new subtitles smoothly and continuously. In some optional implementations of this embodiment, the target number includes the minimum number of loading items required to keep a group of new subtitles continuously provided. Specifically, the server 105 can determine, for example, the device's loading capacity for new bullet comments based on the performance of the device, and then determine, based on the loading capacity, the number of subtitles (e.g., new subtitles) required for the device to continuously load and present new subtitles. For example, the server 105 can determine, based on the performance of the device, that for the device, if three subtitles are pre-loaded (or cached), then the subsequent loading and reading of new subtitles is sufficient to meet the requirements for continuously presenting new subtitles, and the server 105 can determine "3" as the target number. Thus, the server 105 can determine the target number based on the minimum number of loading items required for a group of new subtitles to be continuously provided, and then calculate the necessary duration. Thus, it is ensured that the subtitles can be switched smoothly and presented smoothly and continuously.

[0054] Step 302: Determine a target playback position based on the current playback position and necessary duration of the target video.

[0055] Specifically, after determining the necessary duration, the server 105 can determine the target playback position based on the current playback position and the necessary duration. For the device, performing barrage replacement at the target playback position is generally considered to be safe and reliable, that is, after the target playback position, the new and old barrages can be presented successively without the situation of blank barrages and freezes. Usually, the target playback position can be determined based on the sum of the time indicated by the current playback position and the necessary duration. The target playback position can be the playback time, or it can be determined based on the specific video frame after calculating the number of video frames based on the necessary duration. For example, the server 105 can determine that it is necessary to reserve time and space for 3 video frames for the device based on the performance information of the device to ensure smooth presentation of subtitles. The server 105 can choose to instruct the device to load the required information (for example, subtitles) and then perform subtitle replacement in the third video frame after the current playback position (that is, the target playback position).

[0056] Step 303: Determine the old subtitles corresponding to the target playback position in the universal subtitle content buffer pool as target old subtitles.

[0057] Specifically, the server 105 may select the old subtitles corresponding to the target playback position in the universal subtitle content buffer pool as the target old subtitles, so as to perform switching between the new and old subtitles starting from the target playback position.

[0058] In addition, you can also refer to Figure 4 . Figure 4 Another embodiment of the present disclosure provides a flowchart of a method for determining target old subtitles, including process 400. Similarly, process 400 can also be an alternative to step 202 described above, for determining target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video. Specifically, process 400 includes the following steps:

[0059] Step 401: Detect whether there is a key video frame of the target video within a preset time range from the current playback position.

[0060] Specifically, server 105 can detect whether a key video frame of the target video exists within a preset duration range from the current playback position. Typically, this preset duration range can be configured based on requirements, such as the allowable switching response time, to ensure that subtitles are switched within the preset duration range. Keyframes, also known as I-frames (Intra Frames) or index frames, are important concepts in video coding. Keyframes are complete, self-contained frames in a video sequence that do not rely on other frames for decoding. In contrast to keyframes, other frames are encoded and decoded based on differences between keyframes to achieve video compression. Keyframes are typically key points in a video sequence; they serve as the starting point for video decoders to begin decoding. Each keyframe is a complete, lossless image frame that contains all the information in the video sequence, including color, texture, shape, and more. Therefore, keyframes can be decoded and displayed independently without relying on other frames. Therefore, when a keyframe exists, server 105 can choose to switch subtitles at the keyframe position to ensure seamless subtitle continuity and video and audio synchronization.

[0061] Furthermore, if the server 105 detects that there are key video frames of the target video within a preset time range from the current playback position, it may respond to this and execute step 402 .

[0062] Step 402: Determine the old subtitle corresponding to the key frame in the universal subtitle content buffer pool as the target old subtitle.

[0063] Specifically, the server 105 may determine the old subtitles corresponding to the key frame in the universal subtitle content buffer pool as the target old subtitles, and instruct to perform subtitle switching at the key frame position, thereby ensuring seamless connection of subtitles and synchronization of video and audio.

[0064] In some optional implementations of this embodiment, if the server 105 detects that there is no key video frame of the target video within a preset time range from the current playback position, it may respond to this and execute step 403.

[0065] Step 403: Determine the old subtitles corresponding to the current playback position in the universal subtitle content buffer pool as target old subtitles.

[0066] Specifically, if there is no key frame within the preset time range, the server 105 can select the old subtitles corresponding to the current playback position in the universal subtitle content buffer pool as the target old subtitles to indicate that subtitle switching is performed at the current playback position, so as to ensure that the subtitles can be switched at the current position that has not been played, thereby improving the robustness of the switching system. Figure 2In the embodiment shown, the target old subtitles are determined in step 202. For related details, please refer to the above discussion and will not be repeated here.

[0067] To deepen understanding, this disclosure also provides a specific implementation solution in combination with a specific application scenario, see Figure 5 Flow 500 is shown.

[0068] In this application scenario, server 105 utilizes universal subtitle content buffer pool 520 to provide subtitles for the target video. If server 105 receives a subtitle switch request for the target video at playback position 511, it can respond to it by determining a set of new subtitles (e.g., subtitles 541 to 546). It should be understood that at playback position 511, old subtitles 531 and 532 may be old subtitles that have already been used and presented. At playback position 511, old subtitles 533 are about to be used and presented.

[0069] Further, the server 105 can determine the target playback position 512 based on the current playback position (e.g., playback position 511) and the necessary duration (e.g., the length corresponding to 1 subtitle), and determine the old subtitles 534 corresponding to the target playback position 512 as the target old subtitles. Then, the server 105 can determine that the old subtitles that need to be replaced in the universal subtitle content buffer pool 520 are old subtitles 534 and old subtitles 535. Accordingly, the server 105 can also determine that new subtitles 541 to 543 are overdue new subtitles based on the timestamp corresponding to the target old subtitles (i.e., old subtitles 534), and delete and refuse to use the overdue new subtitles. Thus, it is possible to avoid using new subtitles that have lost their value (e.g., new subtitles that the corresponding video has been played) to correctly use the new subtitles.

[0070] Furthermore, the server 105 can replace the old subtitles 534 with the new subtitles 544 and the old subtitles 535 with the new subtitles 545 in the universal subtitle content buffer pool 520. In addition, the server 105 can also continuously write the new subtitles 546 after the new subtitles 545 into the universal subtitle content buffer pool 520 to achieve continuous playback of the new subtitles.

[0071] Thus, after the target video is played to the play position 512 , new subtitles 544 may be provided for the target video to replace the old subtitles 534 , thereby achieving seamless switching between the new and old subtitles.

[0072] Further references Figure 6 As an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of a device for switching subtitles. Figure 2 Corresponding to the method embodiment shown, the device can be specifically applied to various electronic devices.

[0073] like Figure 6 As shown, the apparatus 600 for switching subtitles in this embodiment may include: a new subtitle determining unit 601, a target old subtitle determining unit 602, and a subtitle replacing unit 603. The new subtitle determining unit 601 is configured to, in response to receiving a subtitle switching request for a target video, determine a set of new subtitles as switching targets according to the subtitle switching request; the target old subtitle determining unit 602 is configured to determine target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; and the subtitle replacing unit 603 is configured to replace at least part of the target old subtitles and old subtitles located after the target old subtitles in the universal subtitle content buffer pool with a set of new subtitles.

[0074] In this embodiment, in the apparatus for switching subtitles 600, the specific processing of the new subtitle determination unit 601, the target old subtitle determination unit 602 and the subtitle replacement unit 603 and the technical effects thereof can be referred to in the respective Figure 2 The relevant descriptions of steps 201-203 in the corresponding embodiment are not repeated here.

[0075] In some optional implementations of this embodiment, the target old subtitle determination unit 602 includes: a duration determination subunit, configured to determine the necessary duration based on performance information of the device used to play the target video, wherein the necessary duration includes: the minimum duration required to load the target number of new subtitles; a target position determination subunit, configured to determine the target playback position based on the current playback position of the target video and the necessary duration; and a first target subtitle determination subunit, configured to determine the old subtitles corresponding to the target playback position in the universal subtitle content buffer pool as the target old subtitles.

[0076] In some optional implementations of this embodiment, the target number of bars includes a minimum number of loading bars required to keep a group of new subtitles continuously provided.

[0077] In some optional implementations of this embodiment, the target old subtitle determination unit 602 includes: a detection subunit configured to detect whether there is a key video frame of the target video within a preset time range from the current playback position; and a second target subtitle determination subunit configured to, in response to the presence of the key video frame, determine the old subtitles corresponding to the key frame in the universal subtitle content buffer pool as the target old subtitles.

[0078] In some optional implementations of this embodiment, the apparatus 600 further includes: a third target subtitle determination subunit configured to, in response to the absence of a key video frame, determine an old subtitle corresponding to the current playback position in the universal subtitle content buffer pool as a target old subtitle.

[0079] In some optional implementations of this embodiment, the subtitle replacement unit 603 includes: a timestamp sequence determination subunit, configured to determine a timestamp sequence with the timestamp corresponding to the target old subtitle as a starting point and the timestamp corresponding to the last old subtitle in the universal subtitle content buffer pool as an end point, wherein each timestamp in the timestamp sequence corresponds continuously to the old subtitle; a new subtitle screening subunit, configured to determine, based on the timestamp sequence, from a group of new subtitles to replace at least a portion of the target old subtitle and the old subtitles located after the target old subtitle; and a subtitle replacement subunit, configured to continuously replace the target old subtitle and the old subtitles located after the target old subtitle with at least a portion of the new subtitle.

[0080] In some optional implementations of this embodiment, the new subtitle screening subunit is further configured to: determine at least a portion based on a comparison of the timestamp of each new subtitle in a group of new subtitles with the timestamp of the target old subtitle and the timestamp of the old subtitle located after the target old subtitle, wherein each new subtitle in at least the portion has the same timestamp as the corresponding target old subtitle or the old subtitle located after the target old subtitle.

[0081] In some optional implementations of this embodiment, in response to the existence of a timestamp associated with a subtitle, the present invention further includes: an overdue new subtitle determination unit, configured to respond to the fact that a group of new subtitles includes at least one overdue new subtitle, wherein the timestamp of the overdue new subtitle is before the timestamp corresponding to the target old subtitle; and an overdue new subtitle deletion unit, configured to delete at least one overdue new subtitle from the group of new subtitles.

[0082] In some optional implementations of this embodiment, the device 600 further includes: an old subtitle loading unit, configured to load a group of old subtitles into the universal subtitle content buffer pool, so as to generate subtitles for the target video through decoding in the universal subtitle content buffer pool; and a subtitle loading control unit, configured to stop loading the group of old subtitles into the universal subtitle content buffer pool in response to receiving a subtitle switching request for the target video.

[0083] In some optional implementations of this embodiment, the device 600 further includes: a subtitle continuous loading unit, configured to, in response to completing the replacement using the first part of a group of new subtitles, continue to load the second part of a group of new subtitles into the universal subtitle content buffer pool, wherein the second part is located after the first part and is connected to the first part end to end.

[0084] This embodiment exists as an apparatus embodiment corresponding to the above-mentioned method embodiment. The apparatus for switching subtitles provided in this embodiment, in response to receiving a subtitle switching request for a target video, determines a set of new subtitles as a switching target based on the subtitle switching request; determines target old subtitles from a universal subtitle content buffer pool based at least on the current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; and replaces at least a portion of the target old subtitles and old subtitles located after the target old subtitles in the universal subtitle content buffer pool with a set of new subtitles. This embodiment provides a method for switching subtitles, which can perform subtitle switching by replacing old subtitles in the universal subtitle content buffer pool, thereby reducing the buffer pool configuration resource requirements while improving switching efficiency, allowing subtitles to be switched more smoothly.

[0085] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium, and a computer program product.

[0086] Figure 7 A schematic block diagram of an example electronic device 700 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or claimed herein.

[0087] like Figure 7 As shown, the device 700 includes a computing unit 701, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 702 or a computer program loaded from a storage unit 708 into a random access memory (RAM) 703. Various programs and data required for the operation of the device 700 can also be stored in the RAM 703. The computing unit 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0088] Various components in device 700 are connected to I / O interface 705, including an input unit 706, such as a keyboard, mouse, etc.; an output unit 707, such as various types of displays, speakers, etc.; a storage unit 708, such as a magnetic disk, optical disk, etc.; and a communication unit 709, such as a network card, modem, wireless communication transceiver, etc. The communication unit 709 allows device 700 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0089] The computing unit 701 can be a variety of general-purpose and / or specialized processing components with processing and computing capabilities. Some examples of the computing unit 701 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The computing unit 701 performs the various methods and processes described above, such as the method for switching subtitles. For example, in some embodiments, the method for switching subtitles can be implemented as a computer software program that is tangibly contained in a machine-readable medium, such as the storage unit 708. In some embodiments, part or all of the computer program can be loaded and / or installed on the device 700 via the ROM 702 and / or the communication unit 709. When the computer program is loaded into the RAM 703 and executed by the computing unit 701, one or more steps of the method for switching subtitles described above can be performed. Alternatively, in other embodiments, the computing unit 701 can be configured to perform the method for switching subtitles by any other appropriate means (e.g., by means of firmware).

[0090] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0091] The program code for implementing the method of the present disclosure can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device so that when the program code is executed by the processor or controller, the functions / operations specified in the flow chart and / or block diagram are implemented. The program code can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0092] In the context of the present disclosure, a machine-readable medium can be a tangible medium that can contain or store a program for use by or in conjunction with an instruction execution system, device or equipment. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium can include an electrical connection based on one or more lines, 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 foregoing.

[0093] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0094] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.

[0095] A computer system may include a client and a server. The client and server are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host, a host product within a cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosts and virtual private server (VPS) services. Servers may also be classified as distributed system servers or servers integrated with blockchain.

[0096] According to the technical solution of the embodiment of the present disclosure, in response to receiving a subtitle switching request for a target video, a set of new subtitles is determined as a switching target based on the subtitle switching request; based at least on the current playback position of the target video, target old subtitles are determined from a universal subtitle content buffer pool, where the universal subtitle content buffer pool is used to provide subtitles for the target video; and in the universal subtitle content buffer pool, at least a portion of the target old subtitles and old subtitles located after the target old subtitles are replaced with a set of new subtitles. This embodiment provides a method for switching subtitles, which can perform subtitle switching by replacing old subtitles in the universal subtitle content buffer pool, reducing the buffer pool configuration resource requirements while improving switching efficiency, allowing subtitles to be switched more smoothly.

[0097] It should be understood that the various forms of processes shown above can be used to reorder, add, or delete steps. For example, the steps described in this disclosure can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solutions provided by this disclosure can be achieved. This is not limited herein.

[0098] The above specific embodiments do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure shall be included within the scope of protection of this disclosure.

Claims

1. A method for switching subtitles, comprising: In response to receiving a subtitle switching request for a target video, determining a set of new subtitles as a switching target according to the subtitle switching request; Determining target old subtitles from a universal subtitle content buffer pool based at least on a current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; Determine a timestamp sequence with the timestamp corresponding to the target old subtitle as a starting point and the timestamp corresponding to the last old subtitle in the universal subtitle content buffer pool as an end point, wherein each timestamp in the timestamp sequence corresponds to the old subtitle continuously; determining, from the set of new subtitles, based on the time stamp sequence, for replacing at least a portion of the target old subtitles and old subtitles located after the target old subtitles; continuously replacing the target old subtitle and the old subtitle located after the target old subtitle with the at least part of the subtitle; In response to completing the replacement using the first part of the set of new subtitles, continue loading the second part of the set of new subtitles into the universal subtitle content buffer pool, wherein the second part is located after the first part and the second part is connected to the first part end to end.

2. The method according to claim 1, wherein determining the target old subtitles from the universal subtitle content buffer pool based at least on the current playback position of the target video comprises: Determining a necessary duration based on performance information of a device used to play the target video, wherein the necessary duration includes: a minimum duration required to load a target number of new subtitles; Determining a target playback position based on the current playback position of the target video and the necessary duration; The old subtitles corresponding to the target playback position in the universal subtitle content buffer pool are determined as the target old subtitles.

3. The method according to claim 2, wherein the target number of bars comprises a minimum number of loading bars required to keep the set of new subtitles continuously provided.

4. The method according to claim 1, wherein determining the target old subtitles from the universal subtitle content buffer pool based at least on the current playback position of the target video comprises: Detecting whether there is a key video frame of the target video within a preset time range from the current playback position; In response to the existence of the key video frame, the old subtitle corresponding to the key video frame in the universal subtitle content buffer pool is determined as the target old subtitle.

5. The method according to claim 4, further comprising: In response to the absence of the key video frame, an old subtitle corresponding to the current playback position in the universal subtitle content buffer pool is determined as the target old subtitle.

6. The method according to claim 1 , wherein determining, based on the timestamp sequence, from the set of new subtitles to replace at least a portion of the target old subtitles and old subtitles located after the target old subtitles comprises: The at least part is determined based on a comparison of a timestamp of each new subtitle in the set of new subtitles with a timestamp of the target old subtitle and a timestamp of an old subtitle located after the target old subtitle, wherein each new subtitle in the at least part has the same timestamp as the corresponding target old subtitle or the old subtitle located after the target old subtitle.

7. The method of claim 1 , further comprising, in response to the presence of a timestamp associated with the subtitles: In response to the group of new subtitles including at least one overdue new subtitle, wherein the timestamp of the overdue new subtitle is before the timestamp corresponding to the target old subtitle; The at least one expired new subtitle is deleted from the group of new subtitles.

8. The method according to claim 1, further comprising: Loading a group of old subtitles into the universal subtitle content buffer pool, so as to generate subtitles for the target video by decoding the old subtitles through the universal subtitle content buffer pool; In response to receiving a subtitle switching request for a target video, stopping loading the set of old subtitles into the universal subtitle content buffer pool.

9. A device for switching subtitles, comprising: a new subtitle determining unit configured to, in response to receiving a subtitle switching request for a target video, determine a set of new subtitles as switching targets according to the subtitle switching request; a target old subtitle determining unit, configured to determine target old subtitles from a universal subtitle content buffer pool based at least on a current playback position of the target video, wherein the universal subtitle content buffer pool is used to provide subtitles for the target video; The subtitle replacement unit includes: a timestamp sequence determining subunit configured to determine a timestamp sequence starting from a timestamp corresponding to the target old subtitle and ending at a timestamp corresponding to the last old subtitle in the universal subtitle content buffer pool, wherein each timestamp in the timestamp sequence corresponds to the old subtitle continuously; a new subtitle screening subunit configured to determine, based on the timestamp sequence, from the group of new subtitles for replacing at least a portion of the target old subtitle and the old subtitles located after the target old subtitle; and a subtitle replacement subunit configured to continuously replace the target old subtitle and the old subtitles located after the target old subtitle with the at least a portion; The subtitle continuous loading unit is configured to, in response to completing the replacement using the first part of the group of new subtitles, continue to load the second part of the group of new subtitles into the universal subtitle content buffer pool, wherein the second part is located after the first part and is connected to the first part end to end.

10. The device according to claim 9, wherein The target old subtitle determination unit includes: The duration determination subunit is configured to determine a necessary duration based on performance information of a device used to play the target video, wherein the necessary duration includes: a minimum duration required to load a target number of new subtitles; a target position determination subunit, configured to determine a target playback position based on a current playback position of the target video and the necessary duration; The first target subtitle determination subunit is configured to determine the old subtitle corresponding to the target playback position in the universal subtitle content buffer pool as the target old subtitle.

11. The device according to claim 10, wherein The target number of bars includes the minimum number of loaded bars required to keep the set of new subtitles continuously provided.

12. The device according to claim 9, wherein The target old subtitle determination unit includes: A detection subunit is configured to detect whether there is a key video frame of the target video within a preset time range from the current playback position; The second target subtitle determination subunit is configured to, in response to the existence of the key video frame, determine the old subtitle corresponding to the key video frame in the universal subtitle content buffer pool as the target old subtitle.

13. The apparatus according to claim 12, further comprising: The third target subtitle determination subunit is configured to, in response to the absence of the key video frame, determine the old subtitle corresponding to the current playback position in the universal subtitle content buffer pool as the target old subtitle.

14. The apparatus according to claim 9, wherein the new subtitle screening subunit is further configured to: determine the at least part based on a comparison of the timestamp of each new subtitle in the group of new subtitles with the timestamp of the target old subtitle and the timestamp of the old subtitle located after the target old subtitle, wherein: Each new subtitle in the at least part has the same timestamp as the corresponding target old subtitle or an old subtitle located after the target old subtitle.

15. The apparatus of claim 9, further comprising, in response to the presence of a timestamp associated with the subtitles: an overdue new subtitle determining unit, configured to respond to the group of new subtitles including at least one overdue new subtitle, wherein the timestamp of the overdue new subtitle is before the timestamp corresponding to the target old subtitle; The overdue new subtitle deleting unit deletes the at least one overdue new subtitle from the group of new subtitles.

16. The apparatus according to claim 9, further comprising: an old subtitle loading unit, configured to load a group of old subtitles into the universal subtitle content buffer pool, so as to generate subtitles for the target video by decoding the old subtitles through the universal subtitle content buffer pool; The subtitle loading control unit is configured to stop loading the set of old subtitles into the universal subtitle content buffer pool in response to receiving a subtitle switching request for a target video.

17. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor. The instructions are executed by the at least one processor to enable the at least one processor to perform the method for switching subtitles according to any one of claims 1 to 8.

18. A non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to cause the computer to execute the method for switching subtitles according to any one of claims 1 to 8.

19. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the method for switching subtitles according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Playing method and apparatus for switching audio tracks and caption tracks

    CN107426600A

  • Subtitle switching method and device for multi-language subtitles obtained by decoding

    CN108040277A