Video transcoding method, transcoding system, computer equipment, storage medium and computer program product

Through the coordinated work of slice, parallel transcoding and merge nodes, the video transcoding process is monitored and converted to serial transcoding when the merge fails, which solves the problem of inefficient video transcoding in the existing technology and realizes efficient video transcoding Code processing.

CN118972608AActive Publication Date: 2024-11-15XIAOHONGSHU TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411122207.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-15
Publication Date
2024-11-15
Estimated Expiration
2044-08-15

AI Technical Summary

Technical Problem

During parallel transcoding, due to the diversity of video packaging formats and encoding formats, some videos cannot be transcoding in parallel or fail in parallel transcoding, resulting in inefficient transcoding, and the transcoding service may be repeatedly tried multiple times. Resource waste.

Method used

Provide a video transcoding method, which slices the video through the slice node, transcoding the parallel transcoding node in parallel, merges the result merging, controls the node to monitor the transcoding process, and converts it to serial transcoding if the merge fails. Ensure that video transcoding is successful and avoid repeated invalid parallel transcoding attempts.

Benefits of technology

It improves the efficiency of video transcoding, ensures the successful video transcoding, avoids resource waste, and is suitable for parallel transcoding and serial transcoding processing in diverse video formats.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118972608A_ABST
    Figure CN118972608A_ABST
Patent Text Reader

Abstract

The invention relates to a video transcoding method, a transcoding system, computer equipment, a storage medium and a computer program product. The method comprises the following steps: performing video slicing processing on a video to be transcoded by a slicing node to obtain a plurality of sub-videos of the video to be transcoded; any parallel transcoding node executes a transcoding task corresponding to any sub-video; after the control node determines that all the transcoding tasks corresponding to the video to be transcoded are completed, a merging instruction is issued to a merging node based on the transcoding result of the transcoding tasks; the merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the to-be-transcoded video, and reports a merging result to the control node; the control node issues a transcoding instruction for the to-be-transcoded video to a serial transcoding node under the condition that the merging result represents that merging fails; and the serial transcoding node performs serial transcoding processing on the to-be-transcoded video to obtain a first target transcoded video. By adopting the method, the video transcoding efficiency can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of video processing, and in particular to a video transcoding method, a transcoding system, a computer device, a storage medium, and a computer program product. Background Art

[0002] With the continuous increase of digital media content, the content transmitted on the Internet has gradually changed from text and images to audio and video. In order to save network costs and ensure the user's playback experience, video transcoding has become an indispensable part of digital media processing.

[0003] At present, in order to save transcoding time, the video transcoding solution usually cuts a video file into multiple small videos, distributes these small videos in parallel to different transcoding nodes for transcoding, and finally aggregates them to one node for transpackaging and splicing. However, the packaging format and encoding format of the videos uploaded to the transcoding nodes are diverse, and some videos cannot be transcoded in parallel or parallel transcoding will fail. Since the transcoding service does not know the reason for the failure of parallel transcoding is that the video itself is not suitable for parallel transcoding, the transcoding service may repeat multiple parallel transcoding attempts for these videos, resulting in low video transcoding efficiency. Summary of the invention

[0004] Based on this, it is necessary to provide a video transcoding method, transcoding system, computer device, storage medium and computer program product to address the above technical problems.

[0005] In a first aspect, the present application provides a video transcoding method, which is applied to a transcoding system, wherein the transcoding system includes a slicing node, multiple parallel transcoding nodes, a serial transcoding node, a merging node, and a control node, and the method includes:

[0006] The slicing node performs video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded;

[0007] Any of the parallel transcoding nodes executes a transcoding task corresponding to any of the sub-videos;

[0008] After determining that all transcoding tasks corresponding to the to-be-transcoded videos are completed, the control node sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks;

[0009] The merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded in response to the merging instruction, and reports the merging result to the control node;

[0010] When the merging result indicates that the merging fails, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node;

[0011] The serial transcoding node performs serial transcoding processing on the video to be transcoded in response to the transcoding instruction to obtain a first target transcoded video.

[0012] In one embodiment, the method further comprises:

[0013] The slicing node reports the number of slices of the video to be transcoded to the control node;

[0014] After completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result;

[0015] When the number of merged tasks for the video to be transcoded in the merged task list is the number of slices, the control node determines that all transcoding tasks corresponding to the video to be transcoded are completed.

[0016] In one embodiment, after completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result, including:

[0017] After the parallel transcoding node successfully executes the transcoding task, the parallel transcoding node generates a first merge task in the merge task list, wherein the first merge task at least includes the node identifier of the parallel transcoding node, the video identifier of the video to be transcoded, and the transcoding result data; or

[0018] After the transcoding task fails to execute, the parallel transcoding node generates a second merged task in the merged task list, where the second merged task at least includes the node identifier, the video identifier, and a transcoding failure identifier.

[0019] In one embodiment, the method further comprises:

[0020] When executing the transcoding task, the parallel transcoding node reports the node identifier of the parallel transcoding node and the video identifier of the video to be transcoded to the control node;

[0021] When the second merge task exists in the merge task list, the control node determines a target node identifier from each of the node identifiers corresponding to the video identifier of the second merge task, and issues a termination transcoding instruction to the parallel transcoding nodes corresponding to each of the target node identifiers;

[0022] The parallel transcoding node terminates the execution of the transcoding task in response to the termination transcoding instruction, and generates the second merged task in the merged task list.

[0023] In one embodiment, determining the target node identifier from the node identifiers corresponding to the video identifiers of the second merging task includes:

[0024] Determine a target merge task from the merge task list according to the video identifier of the second merge task, and determine a first node identifier corresponding to each target merge task;

[0025] Among the node identifiers corresponding to the video identifiers of the second merging task, the node identifiers other than the first node identifiers are used as target node identifiers.

[0026] In one embodiment, the merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded in response to the merging instruction, and reports the merging result to the control node, including:

[0027] In response to the merge instruction, the merge node obtains the merge task corresponding to the video to be transcoded from the merge task list, and when the transcoding tasks corresponding to the video to be transcoded are all the first merge tasks, merges the transcoding result data corresponding to each of the first merge tasks to obtain a second target transcoded video, and reports a merge result indicating a successful merge to the control node, wherein the merge result includes the second target transcoded video; or when the transcoding tasks corresponding to the video to be transcoded include the second merge task, reports a merge result indicating a failed merge to the control node.

[0028] In one embodiment, the method further comprises:

[0029] When the second merge task exists in the merge task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merge task, and sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0030] In one embodiment, the transcoding task includes a first transcoding task and a second transcoding task, and the method further includes:

[0031] The slicing node generates a first transcoding task for each of the sub-videos in the transcoding task list, wherein the first transcoding task at least includes a video identifier of the video to be transcoded and video data of the sub-video; or

[0032] When slicing fails, the slicing node generates a second transcoding task in the transcoding task list, and the second transcoding task at least includes the video identifier and a slicing failure identifier.

[0033] In one embodiment, the method further comprises:

[0034] Any of the parallel transcoding nodes obtains a transcoding task from the transcoding task list, and generates the second merged task in the merged task list when the transcoding task is the second transcoding task.

[0035] In one embodiment, the method further comprises:

[0036] The slicing node generates a first transcoding task for each of the sub-videos in the transcoding task list, wherein the first transcoding task includes a video identifier of the video to be transcoded and an identifier of the sub-video; or

[0037] When slicing fails, the slicing node reports a slicing result indicating the slicing failure to the control node, wherein the slicing result includes at least a video identifier of the video to be transcoded and a slicing failure identifier;

[0038] When receiving the slicing result indicating slicing failure, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0039] In one embodiment, the transcoding system further includes an analysis node, and the method further includes:

[0040] The analysis node reports a first analysis result to the control node when the video to be transcoded meets the parallel transcoding condition, wherein the first analysis result includes at least a video identifier and a parallel transcoding identifier of the video to be transcoded; or reports a second analysis result to the control node when the video to be transcoded does not meet the parallel transcoding condition, wherein the second analysis result includes at least the video identifier and the serial transcoding identifier;

[0041] Upon receiving the first analysis result, the control node sends a video slicing instruction for the video to be transcoded to the slicing node, or upon receiving the second analysis result, sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0042] In one of the embodiments, the parallel transcoding condition includes at least one of a video frame rate condition, a video format condition, and a video duration condition.

[0043] In one embodiment, the slicing node performs video slicing processing on the video to be transcoded, including:

[0044] When the video length of the video to be transcoded is less than or equal to the length threshold, the slicing node determines the number of video slices according to the video length, and performs video slicing processing on the video to be transcoded according to the number of video slices; or when the video length is greater than the length threshold, the slicing node performs video slicing processing on the video to be transcoded according to a preset number of video slices.

[0045] In a second aspect, the present application further provides a transcoding system, the transcoding system comprising a slicing node, a plurality of parallel transcoding nodes, a serial transcoding node, a merging node and a control node, wherein:

[0046] The slicing node is used to perform video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded;

[0047] The parallel transcoding node is used to execute the transcoding task corresponding to any of the sub-videos;

[0048] The control node is used to send a merging instruction to the merging node based on the transcoding results of the transcoding tasks after determining that all transcoding tasks corresponding to the to-be-transcoded videos are completed;

[0049] The merging node is used to respond to the merging instruction, perform merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded, and report the merging result to the control node;

[0050] The control node is used to send a transcoding instruction for the video to be transcoded to the serial transcoding node when the merging result indicates that the merging fails;

[0051] The serial transcoding node is used to perform serial transcoding processing on the video to be transcoded in response to the transcoding instruction to obtain a first target transcoded video.

[0052] In a third aspect, the present application further provides a computer device, wherein the computer device comprises a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, any one of the above methods is implemented.

[0053] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, any of the above methods is implemented.

[0054] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, any of the above methods is implemented.

[0055] The above-mentioned video transcoding method, transcoding system, computer device, storage medium and computer program product attempt to perform parallel transcoding on the transcoded video. When merging the transcoding results obtained after the parallel transcoding, if the merging node cannot successfully merge, it falls back to serial transcoding to process the video. Since there are more videos that can be serially transcoded, the embodiments of the present application can perform parallel transcoding on all videos that can be parallel transcoded, and can also convert the video to serial transcoding when the merger fails, to ensure successful video transcoding. Since the videos that failed to be merged may include videos that are not suitable for parallel transcoding, the video is processed to serial after the merger fails, which can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] Figure 1 is a schematic diagram of a transcoding system in one embodiment;

[0057] Figure 2 A schematic diagram of a process of video transcoding in one embodiment;

[0058] Figure 3 A schematic diagram of a flow chart for determining whether the transcoding task of a video to be transcoded is completely completed in one embodiment;

[0059] Figure 4 A schematic diagram of a process of generating a merge task for a parallel transcoding node in one embodiment;

[0060] Figure 5 A schematic diagram of a process of controlling a node to terminate other transcoding tasks after transcoding fails in an embodiment;

[0061] Figure 6 A schematic diagram of a process in which a control node sends a transcoding instruction to a serial transcoding node after transcoding fails in an embodiment;

[0062] Figure 7 A schematic diagram of a process for generating a second merge task by a parallel transcoding node after a slicing failure in one embodiment;

[0063] Figure 8 A schematic diagram of a process in which a control node sends a transcoding instruction to a serial transcoding node after a slicing failure in an embodiment;

[0064] Fig. 9 A schematic diagram of a process in which an analysis node determines whether a video to be transcoded is suitable for parallel transcoding in one embodiment;

[0065] Fig.10 A schematic diagram of a process of processing a transcoded video by a transcoding system in one embodiment;

[0066] Fig.11FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0067] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.

[0068] In one embodiment, Figure 1 As shown, a transcoding system is provided. The transcoding system includes a slicing node 101, multiple parallel transcoding nodes 102, a serial transcoding node 103, a merging node 104 and a control node 105. Each node can be a different program module on the same device, or can be deployed on multiple devices respectively. These devices can be implemented by an independent server or a server cluster composed of multiple servers. Each node is decoupled from each other and interacts through the rpc protocol (Remote Procedure Call Protocol) or the http protocol (HyperText Transfer Protocol). The slicing node 101 is used to perform video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded; the parallel transcoding node 102 is used to execute the transcoding task corresponding to any sub-video; the control node 105 is used to send a merging instruction to the merging node 104 based on the transcoding result of the transcoding task after determining that all the transcoding tasks corresponding to the video to be transcoded are completed; the merging node 104 is used to respond to the merging instruction, merge the transcoding results of the transcoding tasks corresponding to the video to be transcoded, and report the merging result to the control node 105; the control node 105 is used to send a transcoding instruction for the video to be transcoded to the serial transcoding node 103 when the merging result indicates that the merging fails; the serial transcoding node 103 is used to respond to the transcoding instruction to perform serial transcoding processing on the video to be transcoded to obtain the first target transcoded video. The specific implementation of each step can be found in the following method embodiment, and the embodiment of this application will not be repeated here.

[0069] The transcoding system provided in the embodiment of the present application attempts to perform parallel transcoding on the transcoded video. When merging the transcoding results obtained after the parallel transcoding, if the merging node cannot successfully merge, it falls back to serial transcoding to process the video. Since there are more videos that can be serially transcoded, the embodiment of the present application can perform parallel transcoding on all videos that can be parallel transcoded, and can also convert the video to serial transcoding when the merger fails, to ensure successful video transcoding. Since the videos that failed to merge may include videos that are not suitable for parallel transcoding, the video is processed to serial after the merger fails, which can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding.

[0070] In one embodiment, Figure 2 As shown, a video transcoding method is provided. The method is applied to Figure 1 The transcoding system shown includes the following steps:

[0071] Step 201: The slicing node performs video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded.

[0072] In the embodiment of the present application, the video to be transcoded is a video uploaded by a user and needs to be transcoded. After receiving the video to be transcoded, the slicing node slices the video to be transcoded into multiple sub-videos so that each sub-video can be transcoded in each parallel transcoding node. The embodiment of the present application does not specifically limit the strategy of video slicing. The video to be transcoded can be sliced ​​according to a fixed duration so that the length of each sub-video is a fixed duration, or the video to be transcoded can be sliced ​​according to a fixed number of sub-videos so that the number of sub-videos sliced ​​from each video to be transcoded is a fixed number of sub-videos, and so on.

[0073] After slicing is completed, the slicing node can send transcoding tasks to the parallel transcoding nodes through the control node or not. The control node or slicing node can select some parallel transcoding nodes from all parallel transcoding nodes to perform transcoding tasks according to certain rules, or add transcoding tasks to the transcoding task list, and the parallel transcoding nodes can pull transcoding tasks from the transcoding task list by themselves.

[0074] The following first describes the information that may be included in the transcoding task. The transcoding task may include the sub-video obtained by slicing. If the slicing node stores the sub-video in another node (such as a storage node) after slicing, the transcoding task may include the storage address of the sub-video in the storage node. The transcoding task may also include the encoding information (such as format, frame rate, etc.) of the sub-video required for transcoding.

[0075] The following describes the situation where the control node or the slicing node selects a parallel transcoding node. A target parallel transcoding node responsible for transcoding the sub-video can be selected for each sub-video. Taking the control node responsible for issuing the transcoding task as an example, the task issuing process is described (the process of the slicing node issuing the task can refer to this process). The slicing node can transmit the obtained sub-video to the control node, and the control node generates a transcoding task containing the sub-video and issues the task to each target parallel transcoding node. Alternatively, the slicing node can also report a notification message of slicing completion to the control node. After receiving the notification message, the control node generates a transcoding task containing a communication indication, so that each target parallel transcoding node communicates with the slicing node after receiving the transcoding task to obtain the sub-video and transcode it. Alternatively, the slicing node can also store the sub-video in another node (such as a storage node) after completing the slicing, and report the storage address of the sub-video to the control node. The control node generates a transcoding task containing the storage address, so that after each target parallel transcoding node receives the transcoding task, it obtains the sub-video from the storage node according to the storage address and transcodes it.

[0076] It should be noted that the ability of each parallel transcoding node to transcode a video may be different. For example, when each node is deployed on a different server, due to the limitation of server computing power or network communication quality, some parallel transcoding nodes can process sub-videos with shorter lengths or fewer frames, while other parallel transcoding nodes can process sub-videos with longer lengths or more frames. When selecting a target parallel transcoding node, a parallel transcoding node that can process the sub-video can be selected as a target parallel transcoding node for each sub-video according to the sub-video features of each sub-video, such as different lengths, frames, file sizes, video formats, etc. The above process is described by taking the control node selecting the target parallel transcoding node as an example (the process of the slice node selecting the target parallel transcoding node can also refer to the following process): the control node obtains the sub-video features of each sub-video (which can be reported by the slice node). When the control node stores the video transcoding capabilities of each parallel transcoding node (for example, what format of sub-video the node can process, the estimated maximum length and maximum size of sub-video that can be processed, etc.), the control node matches the target parallel transcoding node for each sub-video according to its own stored video transcoding capabilities. In this case, the control node may periodically send video transcoding capability update messages to each parallel transcoding node, and each parallel transcoding node reports its latest video transcoding capability to the control node in response to the video transcoding capability update message. In the case where the control node does not store the video transcoding capability, the control node may send a video transcoding capability reporting instruction to each parallel transcoding node according to the sub-video features of each sub-video, and each parallel transcoding node reports to the control node which sub-video it can process according to which sub-video its own video transcoding capability matches. The control node selects a target parallel transcoding node for each sub-video based on the information reported by each parallel transcoding node.

[0077] It should be noted that, since there may be multiple different videos to be transcoded being transcoded at the same time, some sub-videos may temporarily have no corresponding target parallel transcoding nodes. If it is necessary to ensure that all sub-videos are transcoded in parallel at the same time, the above process of determining the target parallel transcoding node can be repeated at intervals until each sub-video has a target parallel transcoding node. If sub-videos are allowed to be transcoded in batches, transcoding tasks can be first issued to the parallel transcoding nodes based on the sub-videos with target parallel transcoding nodes, and the above process of determining the target parallel transcoding nodes can be repeated at intervals for the remaining sub-videos, so that some sub-videos are transcoded in parallel first, and some sub-videos are transcoded in parallel later. The above two strategies can be selected by those skilled in the art according to actual needs, and the embodiments of the present application do not specifically limit this.

[0078] The following describes the situation where a parallel transcoding node pulls tasks by itself. After the control node or slice node generates a transcoding task with reference to the aforementioned process, it adds the transcoding task to the transcoding task list of the control node or slice node. The control node or slice node can send a pull task notification to all parallel transcoding nodes, indicating that there is a new task in the transcoding task list of each parallel transcoding node. Upon receiving a pull task notification, an idle parallel transcoding node can pull a transcoding task from the transcoding task list. Alternatively, the parallel transcoding node can periodically query whether there is a new task in the transcoding task list when it enters an idle state.

[0079] The parallel transcoding node can determine the sub-video features of the sub-videos corresponding to each transcoding task in the transcoding task list (the sub-video features can be included in the transcoding task, or the parallel transcoding node can communicate with the slicing node or the control node according to the identifier of the transcoding task, and the slicing node or the control node informs the parallel transcoding node of the sub-video features corresponding to the transcoding task), and determine which transcoding task it can handle. If there is a transcoding task in the transcoding task list that the parallel transcoding node can handle, the parallel transcoding node pulls the transcoding task from the transcoding task list. The parallel transcoding node can also report to the control node which transcoding task it has pulled and processed, so that the control node can record the target parallel transcoding node corresponding to each sub-video. If it does not exist, the parallel transcoding node does not pull the transcoding task.

[0080] In this case, if it is necessary to ensure that all sub-videos are transcoded in parallel at the same time, the parallel transcoding node can report a request message to the node (control node or slice node) where the transcoding task list is located before pulling the task, and temporarily enter a waiting state before receiving a response. The control node or slice node will lock the transcoding task accordingly to prevent other parallel transcoding nodes from pulling the transcoding task again. After the control node or slice node receives a request message for all transcoding tasks under a video to be transcoded, it replies with a response message to the parallel transcoding nodes corresponding to each request message, instructing each parallel transcoding node to pull the transcoding task and start transcoding. If sub-videos are allowed to be transcoded in batches, the parallel transcoding node can be allowed to start processing the transcoding task on its own after pulling the transcoding task.

[0081] Step 202: Any parallel transcoding node executes a transcoding task corresponding to any sub-video.

[0082] In the embodiment of the present application, after multiple parallel transcoding nodes obtain sub-videos, they transcode each sub-video in parallel. After completing the transcoding, the parallel transcoding nodes report the transcoding result of the transcoding task to the control node. If the sub-video is successfully transcoded, the transcoding result of the transcoding task contains the transcoded sub-video, or the storage address of the transcoded sub-video in the storage node. If the sub-video fails to be transcoded, the transcoding result of the transcoding task contains any content that can represent the transcoding failure, such as a failure indication mark, or does not contain any data.

[0083] Step 203: After determining that all transcoding tasks corresponding to the to-be-transcoded videos are completed, the control node sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks.

[0084] In an embodiment of the present application, after collecting the transcoding results of the transcoding tasks of all sub-videos of the video to be transcoded, the control node determines that all transcoding tasks are completed, and instructs the merging node to start merging the transcoding results of the transcoding tasks through a merge instruction. The embodiment of the present application does not specifically limit how the control node determines that all transcoding tasks corresponding to the video to be transcoded are completed. For example, in the case where the control node can determine the target parallel transcoding node for processing each sub-video (for example, the target parallel transcoding node is selected by the control node, or the control node can determine which transcoding tasks correspond to the video to be transcoded, and the parallel transcoding node will report to the control node when pulling the transcoding task), the control node can determine which parallel transcoding node uploaded the transcoding result of the transcoding task after receiving the transcoding result of the transcoding task, and after receiving the transcoding results of the transcoding tasks uploaded by all target parallel transcoding nodes, it is determined that all transcoding tasks corresponding to the video to be transcoded are completed. In the case where the control node cannot determine the target parallel transcoding node for processing each sub-video (for example, the control node cannot determine which transcoding tasks correspond to the video to be transcoded), the control node can obtain the number of transcoding tasks corresponding to the video to be transcoded, and after receiving the transcoding results of the number of transcoding tasks corresponding to the video to be transcoded, determine that all the transcoding tasks corresponding to the video to be transcoded are completed. Alternatively, the control node can also obtain the duration of the video to be transcoded, and after receiving the transcoding results of multiple transcoding tasks corresponding to the video to be transcoded, and the total duration of the sub-videos corresponding to the transcoding results of the multiple transcoding tasks is equal to the duration of the video to be transcoded, determine that all the transcoding tasks corresponding to the video to be transcoded are completed.

[0085] Step 204 : The merging node responds to the merging instruction, performs merging processing based on the transcoding results of the transcoding tasks corresponding to the to-be-transcoded videos, and reports the merging result to the control node.

[0086] In an embodiment of the present application, after the control node sends a merge instruction to the merging node, the merging node obtains each transcoding result and merges each transcoding result. If the transcoding result contains a transcoded sub-video, the merging node can obtain the transcoded sub-video from the transcoding result. If the transcoding result contains the storage address of the transcoded sub-video, the merging node needs to obtain the transcoded sub-video according to the storage address. If the merging node successfully obtains the transcoded sub-video according to each transcoding result, the merging node merges each transcoded sub-video. When the merge is successful, the merging node reports the transcoded video of the video to be transcoded obtained after the merge, or the storage address of the video. When the merge fails, the merging node reports any content that can characterize the merge failure, such as a failure indication mark or does not contain any data.

[0087] If the transcoding result includes content indicating a transcoding failure, the merging node may stop merging the transcoding results and report any content indicating a merging failure, such as a failure indication mark or no data.

[0088] It should be noted that in order to ensure the quality of audio transcoding in the video, the audio can be transcoded separately. After the video to be transcoded enters the transcoding system, a certain node (such as a slicing node or other node responsible for processing the video) can separate the video and audio and store the audio. When the merging node performs the merging task, if the merging is successful, the merging node obtains the audio corresponding to the video to be transcoded through the control node according to the video to be transcoded corresponding to the merging task, or communicates with the node storing the audio to obtain the audio corresponding to the video to be transcoded. The merging node then transcodes the audio separately, merges the transcoded audio with the merged video, and obtains the transcoded video of the video to be transcoded. If the merging fails, the merging node may not perform the above-mentioned operations of obtaining and transcoding the audio, saving the resources of the merging node.

[0089] Step 205 : When the merging result indicates that the merging fails, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0090] In an embodiment of the present application, if the control node obtains a merging result that characterizes a merging failure, the video to be transcoded is converted to a serial state. The control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node, and the transcoding instruction may include the video to be transcoded or the storage address of the video to be transcoded, so that the serial transcoding node performs serial transcoding on the video to be transcoded. In an embodiment of the present application, the merging result that characterizes a merging failure may be caused by the fact that the video to be transcoded itself is not suitable for parallel transcoding, resulting in a sub-video transcoding failure, the video to be transcoded can be transcoded in parallel, but the parallel transcoding node fails to transcode the sub-video for other reasons, or the sub-video transcoding is successful, but the merging node fails to merge the transcoded sub-video for other reasons. Considering that it is inefficient to verify which specific situation causes the merging failure, and then take corresponding operations for specific situations, the embodiment of the present application rolls back the video to be transcoded to serial transcoding for the above three situations, which can ensure the transcoding efficiency of the video to be transcoded.

[0091] Step 206: The serial transcoding node performs serial transcoding processing on the video to be transcoded in response to the transcoding instruction to obtain a first target transcoded video.

[0092] In the embodiment of the present application, the serial transcoding node obtains the video to be transcoded according to the transcoding instruction, and performs video transcoding on the video to be transcoded in serial mode to obtain the first target transcoded video after the video to be transcoded is transcoded. The serial transcoding node can then report the first target transcoded video to the control node, and the control node feeds back the first target transcoded video to the user.

[0093] The video transcoding method provided in the embodiment of the present application attempts to perform parallel transcoding on the transcoded video. When the transcoding results obtained after the parallel transcoding are merged, if the merging node cannot successfully merge, it falls back to serial transcoding to process the video. Since there are more videos that can be serially transcoded, the embodiment of the present application can perform parallel transcoding on all videos that can be parallel transcoded, and can also convert the video to serial transcoding when the merger fails, to ensure successful video transcoding. Since the videos that failed to merge may include videos that are not suitable for parallel transcoding, the video is processed to serial after the merger fails, which can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding.

[0094] In one embodiment, Figure 3 As shown, the above method also includes:

[0095] Step 301, the slicing node reports the number of slices of the video to be transcoded to the control node;

[0096] Step 302: After completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result;

[0097] Step 303: When the number of merged tasks for the video to be transcoded in the merged task list is the number of slices, the control node determines that all transcoding tasks corresponding to the video to be transcoded are completed.

[0098] In the embodiment of the present application, after slicing is completed, the slicing node can report the number of slices of the video to be transcoded, that is, the number of sub-videos obtained by slicing, to the control node. After completing the transcoding of the sub-videos, the parallel transcoding node generates a merge task in the merge task list. The control node determines whether all transcoding tasks corresponding to the video to be transcoded are completed by monitoring whether the number of merge tasks for the video to be transcoded in the merge task list reaches the number of slices.

[0099] The merge task may carry an identifier for indicating which video to be transcoded corresponds to the merge task, such as the video identifier of the video to be transcoded. The control node may traverse the merge task list at regular intervals, obtain the video identifiers of each merge task in the merge task list, and count the number of merge tasks corresponding to each video identifier, and compare the number of merge tasks with the number of slices of the video to be transcoded corresponding to the video identifier. If the number of merge tasks is less than the number of slices, the control node determines that the transcoding task of the video to be transcoded corresponding to the video identifier has not been completed, and continues to wait for the new merge task corresponding to the video identifier to be written into the merge task list. If the number of merge tasks is equal to the number of slices, the control node determines that the transcoding task of the video to be transcoded corresponding to the video identifier has been completed, and sends a merge instruction to the merge node.

[0100] The video transcoding method provided in the embodiment of the present application records the number of slices of the video to be transcoded in the control node, and determines that all transcoding tasks corresponding to the video to be transcoded are completed when the number of merged tasks corresponding to the video to be transcoded in the merged task list is the number of slices. This can simplify the process of the control node tracking whether each sub-video of the video to be transcoded has completed transcoding, thereby improving the overall efficiency of video transcoding.

[0101] In one embodiment, Figure 4 As shown, in step 302, after completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result, including:

[0102] Step 401: after the parallel transcoding node successfully executes the transcoding task, the parallel transcoding node generates a first merge task in the merge task list, and the first merge task at least includes the node identifier of the parallel transcoding node, the video identifier of the video to be transcoded, and the transcoding result data; or

[0103] Step 402: After the transcoding task fails to execute, the parallel transcoding node generates a second merge task in the merge task list. The second merge task includes at least a node identifier, a video identifier, and a transcoding failure identifier.

[0104] In an embodiment of the present application, the parallel transcoding node may generate different merge tasks in the merge task list based on whether the transcoding task is successful, so that after the merge node reads the merge task, it can determine whether the parallel transcoding node has successfully completed the transcoding of the sub-video based on the different contents in the merge task.

[0105] If the parallel transcoding node transcodes successfully, a first merge task can be generated. The first merge task may include the transcoding result data obtained after the transcoding is successful, and the transcoding result data may be the transcoded sub-video, or the storage address of the transcoded sub-video in other nodes. It may also include the node identifier of the parallel transcoding node itself, and the video identifier of the video to be transcoded corresponding to the transcoding task. The video identifier is used to let the control node know which video to be transcoded corresponds to the first merge task, and the node identifier is used to let the control node track the completion of the transcoding task of each parallel transcoding node.

[0106] If the parallel transcoding node fails to transcode, a second merge task may be generated. The second merge task may include a node identifier, a video identifier, and a transcoding failure identifier. When the merge node reads the transcoding failure identifier, it may determine that the transcoding node has failed to transcode the sub-video corresponding to the merge task.

[0107] The video transcoding method provided in the embodiment of the present application writes the transcoding result data into the merge task if the transcoding is successful, and writes the transcoding failure flag into the merge task if the transcoding fails, so as to facilitate the merge node to judge whether the sub-video corresponding to the merge task has been successfully transcoded, thereby improving the overall efficiency of video transcoding.

[0108] In one embodiment, Figure 5 As shown, the above method also includes:

[0109] Step 501, when executing a transcoding task, the parallel transcoding node reports the node identifier of the parallel transcoding node and the video identifier of the video to be transcoded to the control node;

[0110] Step 502: When there is a second merge task in the merge task list, the control node determines a target node identifier from each node identifier corresponding to the video identifier of the second merge task, and sends a termination transcoding instruction to the parallel transcoding nodes corresponding to each target node identifier;

[0111] Step 503: The parallel transcoding node terminates the execution of the transcoding task in response to the termination transcoding instruction, and generates a second merge task in the merge task list.

[0112] In the embodiment of the present application, when a parallel transcoding node pulls a transcoding task, it can report its own node identification and the video identification of the video to be transcoded corresponding to the transcoding task to the control node, so that the control node can record which parallel transcoding nodes specifically transcode the sub-videos of the video to be transcoded. Since the control node records the number of slices of the video to be transcoded, when the number of parallel transcoding nodes reporting the video identification of the video to be transcoded reaches the number of slices, the control node can determine that all transcoding tasks corresponding to the video to be transcoded have been pulled, and can record the corresponding relationship between the node identification of each of the above parallel transcoding nodes and the video identification of the video to be transcoded.

[0113] The control node can monitor the merge task list. Since when the transcoding of a sub-video corresponding to the video to be transcoded fails, the merge node will generate a merge result indicating the merge failure when merging the transcoding results of each sub-video of the video to be transcoded. Therefore, if the control node detects that the second merge task is written into the merge task list, it can notify the parallel transcoding nodes executing other transcoding tasks of the video to be transcoded to terminate the transcoding, thereby preventing the parallel transcoding nodes from continuing to perform invalid operations and saving the computing power of the parallel transcoding nodes. The control node can determine the video identifier of the second merge task, determine the node identifiers corresponding to the video identifier, and then determine the target node identifier corresponding to the node that the control node needs to notify to terminate the transcoding from the node identifiers.

[0114] In one embodiment, the target node identifier is the identifier of all nodes. That is, the control node will issue a termination transcoding instruction to all parallel transcoding nodes that process the sub-video transcoding tasks of the video to be transcoded, regardless of whether these parallel transcoding nodes have written the merge task in the merge task list. The termination transcoding instruction may carry the video identifier corresponding to the second merge task. After receiving the termination transcoding instruction, the parallel transcoding node matches the target task that needs to be terminated from the various transcoding tasks processed by itself according to the video identifier. If the target task exists, the parallel transcoding node can discard the target task and generate a second merge task in the merge task list. If the target task does not exist, the parallel transcoding node does not process it.

[0115] In another embodiment, the target node identifier is an identifier corresponding to a node that has not yet written a merge task in the merge task list. The control node determines the target merge task from the merge task list based on the video identifier of the second merge task, and determines the first node identifier corresponding to each target merge task; and uses the node identifiers corresponding to the video identifier of the second merge task, except for the first node identifiers, as the target node identifier. The target merge task refers to a merge task whose video identifier is the same as the video identifier of the second merge task, and the target merge task includes the second merge task itself. After determining the target merge task, the control node can determine which parallel transcoding nodes have written merge tasks in the merge task list, and further determine which parallel transcoding nodes have not written merge tasks in the merge task list based on the correspondence between the video identifier and the node identifier, and then use the node identifiers of these parallel transcoding nodes as target node identifiers, and send termination transcoding instructions to these parallel transcoding nodes.

[0116] In the video transcoding method provided by the embodiment of the present application, if there is a second merge task in the merge task list, the control node determines the parallel transcoding nodes that process other transcoding tasks corresponding to the video identifier of the second merge task according to the video identifier of the second merge task, and notifies these parallel transcoding nodes to terminate the processing of transcoding tasks, which can avoid invalid operations of the parallel transcoding nodes and save the computing power of the parallel transcoding nodes. At the same time, it can also speed up the speed at which each parallel transcoding node completes the transcoding task, thereby speeding up the speed at which the control node receives the merge result indicating the merge failure and processes the serialization of the transcoded video, thereby improving the efficiency of video transcoding.

[0117] In one embodiment, in step 204, the merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded in response to the merging instruction, and reports the merging result to the control node, including:

[0118] In response to the merge instruction, the merge node obtains the merge task corresponding to the video to be transcoded from the merge task list, and when the transcoding tasks corresponding to the video to be transcoded are all first merge tasks, the merge node merges the transcoding result data corresponding to the first merge tasks to obtain the second target transcoded video, and reports the merge result representing a successful merge to the control node, wherein the merge result includes the second target transcoded video; or when the transcoding tasks corresponding to the video to be transcoded include the second merge task, the merge result representing a failed merge is reported to the control node.

[0119] In an embodiment of the present application, after the merge node pulls each merge task corresponding to the video to be transcoded, it checks whether there is a second merge task in each merge task. If the second merge task exists, the merge node does not need to execute the step of merging each merge task, and reports the merge result representing the merge failure to the control node. If each merge task is a first merge task and the second merge task does not exist, the merge node reads the transcoding result data corresponding to each first merge task, merges the transcoding result data to obtain the second target transcoded video (if the audio is transcoded separately, the merge node also needs to obtain the audio corresponding to the video to be transcoded, and after transcoding the audio, merge the transcoded audio with the second target transcoded video again), and then reports the second target transcoded video to the control node through the merge result representing the successful merge, and the control node feeds back the second target transcoded video to the user.

[0120] In the video transcoding method provided by the embodiment of the present application, if there is a second merging task in the merging task, the merging node can report the merging result indicating the merging failure without further operation, which can avoid the merging node from performing invalid operations and save the computing power of the merging node. At the same time, it can also speed up the control node to receive the merging result indicating the merging failure and process the serialization of the transcoded video, thereby improving the efficiency of video transcoding.

[0121] In one embodiment, Figure 6 As shown, the above method also includes:

[0122] When the second merge task exists in the merge task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merge task, and sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0123] In an embodiment of the present application, after the control node detects that the second merge task is written into the merge task list, the video to be transcoded corresponding to the second merge task can be rolled back to serial transcoding, without waiting for the merge node to report a merge result indicating a merge failure before rolling back the video to be transcoded to serial transcoding, thereby improving the efficiency of video transcoding. While the control node issues a transcoding instruction for the video to be transcoded to the serial transcoding node, it can still execute the steps of determining the target node identifier and notifying the parallel transcoding nodes corresponding to each target node identifier to terminate transcoding, so that each parallel transcoding node does not need to perform invalid operations.

[0124] The control node may also set a serial transcoding mark for the video identifier of the video to be transcoded to record that the video to be transcoded has been serially transcoded. After the merging node reports the merging result indicating a merging failure, the control node determines whether the video identifier has a corresponding serial transcoding mark based on the video identifier corresponding to the merging result. If so, the control node does not need to execute the step of sending a transcoding instruction for the video to be transcoded to the serial transcoding node when the merging result indicates a merging failure. If not, the control node executes this step normally.

[0125] In one embodiment, the transcoding task includes a first transcoding task and a second transcoding task, and the method further includes:

[0126] The slicing node generates a first transcoding task for each sub-video in the transcoding task list, and the first transcoding task includes at least the video identifier of the video to be transcoded and the video data of the sub-video; or when the slicing fails, the slicing node generates a second transcoding task in the transcoding task list, and the second transcoding task includes at least the video identifier and the slicing failure identifier.

[0127] In an embodiment of the present application, when the slicing node successfully slices the video to be transcoded, it generates a first transcoding task for each sub-video in the transcoding task list. The first transcoding task may carry the video identifier of the video to be transcoded and the video data of the sub-video. The video data may be the video file of the sub-video or the storage address of the sub-video. If the slicing fails, the slicing node may generate a second transcoding task including a video identifier and a slicing failure identifier, and report the number of slices to the control node according to the number of second transcoding tasks. The number of second transcoding tasks may be 1. When the parallel transcoding node pulls the first transcoding task, it may normally perform transcoding processing on the sub-video. When the second transcoding task is pulled, it may discard the second transcoding task, or report to the control node based on the second transcoding task that the video to be transcoded needs to fall back to serial transcoding, or generate a second merge task based on the second transcoding task and write it into the merge task queue.

[0128] In one embodiment, Figure 7 As shown, the above method also includes:

[0129] Any parallel transcoding node obtains a transcoding task from the transcoding task list, and generates a second merged task in the merged task list when the transcoding task is a second transcoding task.

[0130] In the embodiment of the present application, each parallel transcoding node pulls a transcoding task from the transcoding task list for processing. If the parallel transcoding node pulls the first transcoding task, the transcoding task corresponding to the sub-video is executed according to the video data contained in the first transcoding task. If the parallel transcoding node pulls the second transcoding task, a second merge task can be generated in the merge task list, so that the merge node reports a merge result indicating a merge failure, and the video to be transcoded falls back to serial transcoding for processing.

[0131] In one embodiment, Figure 8 As shown, the above method also includes:

[0132] The slicing node generates a first transcoding task for each sub-video in the transcoding task list, wherein the first transcoding task includes a video identifier of the video to be transcoded and an identifier of the sub-video; or when slicing fails, the slicing node reports a slicing result indicating the slicing failure to the control node, wherein the slicing result includes at least the video identifier of the video to be transcoded and a slicing failure identifier;

[0133] When receiving the slicing result indicating slicing failure, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

[0134] In the embodiment of the present application, if the slicing node fails, the transcoding task is not written into the transcoding task list. The slicing node can report the slicing result of the slicing failure to the control node. The control node determines the video to be transcoded according to the video identifier in the slicing result, and sends the transcoding instruction for the video to be transcoded to the serial transcoding node, so that the video to be transcoded can fall back to serial transcoding for processing. In this way, the control node does not need to wait until the merging node reports the merging result indicating the merging failure before falling back to serial transcoding for the video to be transcoded, thereby improving the transcoding efficiency of the video to be transcoded.

[0135] In one embodiment, Fig. 9 As shown, the transcoding system further includes an analysis node, and the method further includes:

[0136] Step 901: When the video to be transcoded meets the parallel transcoding condition, the analysis node reports a first analysis result to the control node, where the first analysis result at least includes a video identifier and a parallel transcoding identifier of the video to be transcoded; or

[0137] Step 902: if the video to be transcoded does not meet the parallel transcoding condition, report a second analysis result to the control node, where the second analysis result includes at least a video identifier and a serial transcoding identifier;

[0138] Step 903: upon receiving the first analysis result, the control node sends a video slicing instruction for the video to be transcoded to the slicing node, or,

[0139] Step 904: upon receiving the second analysis result, a transcoding instruction for the video to be transcoded is sent to the serial transcoding node.

[0140] In an embodiment of the present application, the analysis node is used to analyze whether the video to be transcoded is suitable for parallel transcoding when receiving the video to be transcoded. The control node can record whether each video to be transcoded ultimately adopts parallel transcoding or serial transcoding, and the parallel transcoding condition can be summarized based on the transcoding method ultimately adopted by each video to be transcoded. For example, when the transcoding system transcodes a video of a certain target format, if the proportion of videos that ultimately adopt parallel transcoding is lower than the proportion threshold, the transcoding system can determine that the video in the target format is not suitable for parallel transcoding, and set the parallel transcoding condition to the format of the video to be transcoded is not the target format. Similarly, the transcoding system can also perform the above analysis from the dimensions of video duration, video frame rate, video volume size, and so on, to summarize which types of videos are suitable for parallel transcoding and which types of videos are not suitable for parallel transcoding, and set the parallel transcoding conditions accordingly. For example, when it is determined that a video with a duration of less than 5 minutes is not suitable for parallel transcoding, the parallel transcoding condition is set to a video duration greater than or equal to 5 minutes. When it is determined that a video with a frame rate variance less than a certain value and a format of H.265 is suitable for parallel transcoding, the parallel transcoding condition is set to a video frame rate variance less than the value and a video format of H.265.

[0141] If the analysis node determines that the video to be transcoded meets the parallel transcoding condition, the first analysis result is reported to the control node. The first analysis result may carry the video identifier and parallel transcoding identifier of the video to be transcoded, indicating the control node that the video can be transcoded in parallel. The control node may then send a video slicing instruction to the slicing node based on the video identifier, instructing the slicing node to perform the slicing task for the video to be transcoded. If it is determined that the video to be transcoded does not meet the parallel transcoding condition, the second analysis result is reported to the control node. The second analysis result may carry the video identifier and serial transcoding identifier of the video to be transcoded, indicating the control node that the video cannot be transcoded in parallel. The control node may then send a transcoding instruction to the serial transcoding node based on the video identifier, instructing the serial transcoding node to perform the serial transcoding task for the video to be transcoded.

[0142] The video transcoding method provided in the embodiment of the present application first determines whether the video to be transcoded is suitable for parallel transcoding through an analysis node when the video to be transcoded enters the transcoding system. If not, the video to be transcoded is converted to serial transcoding. The video to be transcoded that is likely to fail in parallel transcoding can be diverted to the serial transcoding node in advance, thereby saving the computing power of the parallel transcoding node and improving the overall efficiency of video transcoding.

[0143] In one embodiment, the parallel transcoding condition includes at least one of a video frame rate condition, a video format condition, and a video duration condition.

[0144] In the embodiment of the present application, whether the video to be transcoded is suitable for parallel transcoding can be determined based on the video frame rate, video format and video duration of the video to be transcoded. The historical videos to be transcoded that have been processed by the transcoding system in the previous period of time can be obtained, and the parallel transcoding success rate of the historical videos to be transcoded can be analyzed from the dimensions of video frame rate, video format and video duration with reference to the method of the aforementioned embodiment, and the video frame rate condition, video format condition and video duration condition can be set respectively according to the analysis results.

[0145] The above process is explained below with the video frame rate condition. According to actual needs, multiple sub-dimensions that need to be analyzed for the video frame rate can be further determined, such as the sub-dimension of the average frame rate, the sub-dimension of the difference between the frame rate and the average frame rate absolute value, the sub-dimension of the frame rate variance, etc. Multiple intervals can be constructed for each sub-dimension. For example, for the sub-dimension of the average frame rate, interval 1 corresponding to the average frame rate of 20 frames per second to 30 frames per second, interval 2 corresponding to the average frame rate of 30 frames per second to 50 frames per second, and interval 3 corresponding to the average frame rate of more than 50 frames per second can be constructed. The historical videos to be transcoded are classified into each interval according to the interval to which their average frame rates belong, and the number of historical videos to be transcoded that are finally transcoded in parallel in each interval is counted, and the ratio of the number of historical videos to be transcoded that are finally transcoded in parallel to the number of all historical videos to be transcoded in the interval is calculated as the parallel transcoding success rate of the interval, and it is determined which interval has a parallel transcoding success rate that exceeds the preset success rate threshold. Assuming that the parallel transcoding success rate of interval 1 and interval 2 exceeds the success rate threshold, and the parallel transcoding success rate of interval 3 is lower than the success rate threshold, the video frame rate condition can be set to an average frame rate of the video to be transcoded lower than 50 frames per second.

[0146] Similarly, for the dimensions of video format and video duration, the above-mentioned classification of historical videos to be transcoded can also be adopted, the parallel transcoding success rate of each category can be counted, and the strategy of setting the video format condition and the video duration condition can be set according to the category whose parallel transcoding success rate is greater than the success rate threshold. The embodiments of this application will not be repeated here. In one embodiment, the video frame rate condition is that the absolute value difference between the frame rate and the average frame rate is less than or equal to 10 frames, the video format condition is that the format of the video to be transcoded is H.264 or H.265, and the video duration condition is that the video duration is greater than or equal to 5 minutes.

[0147] In one embodiment, the slicing node performs video slicing processing on the video to be transcoded, including:

[0148] When the video length of the video to be transcoded is less than or equal to the length threshold, the slicing node determines the number of video slices according to the video length, and performs video slicing processing on the video to be transcoded according to the number of video slices; or when the video length is greater than the length threshold, the video slicing processing is performed on the video to be transcoded according to the preset number of video slices.

[0149] In an embodiment of the present application, the slicing node determines how many slices to cut into the video to be transcoded based on the video length of the video to be transcoded. The length threshold can be set in advance according to actual needs. If the video length of the video to be transcoded is less than or equal to the length threshold, the number of video slices is determined according to the video length of the video to be transcoded. In this case, the number of video slices can be proportional to the video length. For example, the number of video slices for a 6-minute video to be transcoded is 3, and the number of video slices for an 8-minute video to be transcoded is 5. The sub-video length that each sub-video should have in this case can also be pre-set, and the specific number of slices to be cut into for the transcoded video is determined according to the sub-video length. For example, in the case where the sub-video length is 1 minute, 7 sub-videos can be cut out of a 7.5-minute video to be transcoded according to a length of 1 minute, and the final 30-second duration is also used as a sub-video, so the number of video slices of the video to be transcoded is 8.

[0150] When the video duration is greater than the duration threshold, the video to be transcoded can be fixedly cut into a preset number of video slices of sub-videos. The preset number of video slices can be the maximum number of video slices that can be determined when the number of video slices is determined according to the video duration, or the number determined according to the total number of parallel transcoding nodes, such as half of the total number of parallel transcoding nodes, one-quarter of the total number of parallel transcoding nodes, etc., so that the longer video to be transcoded will not occupy too many parallel transcoding resources. In one embodiment, the duration threshold is 10 minutes. When the video duration of the video to be transcoded is less than or equal to 10 minutes, the number of video slices of the video to be transcoded is determined according to the preset 1-minute sub-video duration, and video slicing processing is performed on the video to be transcoded according to the number of video slices. When the video duration of the video to be transcoded is greater than 10 minutes, video slicing processing is performed on the video to be transcoded according to the preset 10 slices.

[0151] The video transcoding method provided in the embodiment of the present application determines the number of video slices according to the video duration when the video duration is less than or equal to the duration threshold, so as to ensure that the size of each sub-video is reasonable, improve the efficiency of transcoding the sub-video, and thus improve the overall efficiency of video transcoding. When the video duration is greater than the duration threshold, the video to be transcoded is processed by slicing according to the preset number of video slices to ensure that the video to be transcoded does not occupy too many parallel transcoding resources, and ensure that other videos to be transcoded processed by the transcoding system can still be transcoded in parallel using parallel transcoding nodes, which can also improve the overall efficiency of video transcoding.

[0152] In one embodiment, Fig.10 As shown, it is an example of a specific process for processing the video to be transcoded in the transcoding system. In the embodiment of the present application, the topological structure of the entire transcoding process is a DAG graph (Directed Acyclic Graph), and each node in the DAG graph is a task performed by a node in the transcoding system. The triggering of each node's task is determined by the result of the execution of the task by the predecessor node of the node. The overall transcoding process can be divided into four task types: analysis, slicing, transcoding, and merging of the video to be transcoded. Because the triggering of each node depends on the status of the task completed by its predecessor node, when the task of each node fails, the video to be transcoded can be rolled back to the serial transcoding node for serial transcoding. Therefore, when the video to be transcoded is not suitable for parallel transcoding, the video to be transcoded can be serially transcoded in time, which can improve the transcoding success rate of the video to be transcoded while improving the video transcoding efficiency.

[0153] After the video to be transcoded enters the transcoding system, the analysis node first analyzes the video to be transcoded. If the video to be transcoded meets the parallel transcoding conditions, the slicing node slices the video to be transcoded. If it does not meet the parallel transcoding conditions, the video to be transcoded is transferred to the serial transcoding node for serial transcoding. After the slicing node slices the video to be transcoded and forms multiple transcoding tasks, each parallel transcoding node pulls the transcoding tasks, processes each transcoding task in parallel, generates a merge task and writes it into the merge task list. The merge node pulls the merge task. If there is a second merge task in the merge task that indicates a transcoding failure, the merge node outputs a merge result that indicates a merge failure. If there is no second merge task, the merge node merges the transcoded sub-videos contained in each merge task, and transcodes the audio of the video to be transcoded separately, merges the transcoded audio and the merged video, and outputs a merge result that indicates a successful merge or a merge result that indicates a merge failure according to whether the merge is successful. When the merge result indicates a merge failure, the video to be transcoded is transferred to the serial transcoding node for serial transcoding. The embodiment of the present application utilizes an event-driven distributed architecture, and the activation of each task depends on the completion status of its predecessor task, which can reduce resource consumption. Because the activation of the next task depends on the completion status of the previous task, when any link in the parallel transcoding process fails, the video to be transcoded can be rolled back to the serial transcoding node for serial transcoding processing, which can improve the success rate of the transcoding task.

[0154] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Fig.11As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a file status monitoring method is implemented.

[0155] Those skilled in the art will understand that Fig.11 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0156] In one embodiment, a computer device is provided, including a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the steps in the above-mentioned method embodiments when executing the computer program.

[0157] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned method embodiments are implemented.

[0158] In one embodiment, a computer program product is provided, including a computer program, which implements the steps in the above method embodiments when executed by a processor.

[0159] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties.

[0160] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to the memory, database or other medium used in the embodiments provided in this application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. As an illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM). The database involved in each embodiment provided in this application may include at least one of a relational database and a non-relational database. Non-relational databases may include distributed databases based on blockchains, etc., but are not limited to this. The processor involved in each embodiment provided in this application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic device, a data processing logic device based on quantum computing, etc., but are not limited to this.

[0161] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0162] The above-described embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the present application. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the attached claims.

Claims

1. A video transcoding method, It is characterized in that Applied to a transcoding system, the transcoding system includes a slicing node, a plurality of parallel transcoding nodes, a serial transcoding node, a merging node and a control node, the method includes: The slicing node performs video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded; Any of the parallel transcoding nodes executes a transcoding task corresponding to any of the sub-videos; After determining that all transcoding tasks corresponding to the to-be-transcoded videos are completed, the control node sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks; The merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded in response to the merging instruction, and reports the merging result to the control node; When the merging result indicates that the merging fails, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node; The serial transcoding node performs serial transcoding processing on the video to be transcoded in response to the transcoding instruction to obtain a first target transcoded video.

2. The method according to claim 1, It is characterized in that The method further comprises: The slicing node reports the number of slices of the video to be transcoded to the control node; After completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result; When the number of merged tasks for the video to be transcoded in the merged task list is the number of slices, the control node determines that all transcoding tasks corresponding to the video to be transcoded are completed.

3. The method according to claim 2, It is characterized in that After completing the transcoding task, the parallel transcoding node generates a corresponding merge task in the merge task list based on the transcoding result, including: After the parallel transcoding node successfully executes the transcoding task, the parallel transcoding node generates a first merge task in the merge task list, wherein the first merge task at least includes the node identifier of the parallel transcoding node, the video identifier of the video to be transcoded, and the transcoding result data; or After the transcoding task fails to execute, the parallel transcoding node generates a second merge task in the merge task list, where the second merge task at least includes the node identifier, the video identifier, and a transcoding failure identifier.

4. The method according to claim 3, It is characterized in that The method further comprises: When executing the transcoding task, the parallel transcoding node reports the node identifier of the parallel transcoding node and the video identifier of the video to be transcoded to the control node; When the second merge task exists in the merge task list, the control node determines a target node identifier from each of the node identifiers corresponding to the video identifier of the second merge task, and issues a termination transcoding instruction to the parallel transcoding nodes corresponding to each of the target node identifiers; The parallel transcoding node terminates the execution of the transcoding task in response to the termination transcoding instruction, and generates the second merged task in the merged task list.

5. The method according to claim 4, It is characterized in that The determining the target node identifier from the node identifiers corresponding to the video identifiers of the second merging task includes: Determine a target merge task from the merge task list according to the video identifier of the second merge task, and determine a first node identifier corresponding to each target merge task; Among the node identifiers corresponding to the video identifiers of the second merging task, the node identifiers other than the first node identifiers are used as target node identifiers.

6. The method according to claim 3, It is characterized in that The merging node performs merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded in response to the merging instruction, and reports the merging result to the control node, including: In response to the merge instruction, the merge node obtains the merge task corresponding to the video to be transcoded from the merge task list, and when the transcoding tasks corresponding to the video to be transcoded are all the first merge tasks, merges the transcoding result data corresponding to each of the first merge tasks to obtain a second target transcoded video, and reports a merge result indicating a successful merge to the control node, wherein the merge result includes the second target transcoded video; or when the transcoding tasks corresponding to the video to be transcoded include the second merge task, reports a merge result indicating a failed merge to the control node.

7. The method according to claim 3, It is characterized in that The method further comprises: When the second merge task exists in the merge task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merge task, and sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

8. The method according to claim 3, It is characterized in that The transcoding task includes a first transcoding task and a second transcoding task, and the method further includes: The slicing node generates a first transcoding task for each of the sub-videos in the transcoding task list, wherein the first transcoding task at least includes a video identifier of the video to be transcoded and video data of the sub-video; or When slicing fails, the slicing node generates a second transcoding task in the transcoding task list, and the second transcoding task at least includes the video identifier and a slicing failure identifier.

9. The method according to claim 8, It is characterized in that The method further comprises: Any of the parallel transcoding nodes obtains a transcoding task from the transcoding task list, and generates the second merged task in the merged task list when the transcoding task is the second transcoding task.

10. The method according to claim 3, It is characterized in that The method further comprises: The slicing node generates a first transcoding task for each of the sub-videos in the transcoding task list, wherein the first transcoding task includes a video identifier of the video to be transcoded and an identifier of the sub-video; or When slicing fails, the slicing node reports a slicing result indicating the slicing failure to the control node, wherein the slicing result includes at least a video identifier of the video to be transcoded and a slicing failure identifier; When receiving the slicing result indicating slicing failure, the control node sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

11. The method according to claim 1, It is characterized in that The transcoding system further includes an analysis node, and the method further includes: The analysis node reports a first analysis result to the control node when the video to be transcoded meets the parallel transcoding condition, wherein the first analysis result includes at least a video identifier and a parallel transcoding identifier of the video to be transcoded; or reports a second analysis result to the control node when the video to be transcoded does not meet the parallel transcoding condition, wherein the second analysis result includes at least the video identifier and the serial transcoding identifier; Upon receiving the first analysis result, the control node sends a video slicing instruction for the video to be transcoded to the slicing node, or upon receiving the second analysis result, sends a transcoding instruction for the video to be transcoded to the serial transcoding node.

12. The method according to claim 11, It is characterized in that The parallel transcoding condition includes at least one of a video frame rate condition, a video format condition, and a video duration condition.

13. The method according to claim 1, It is characterized in that The slicing node performs video slicing processing on the video to be transcoded, including: When the video length of the video to be transcoded is less than or equal to the length threshold, the slicing node determines the number of video slices according to the video length, and performs video slicing processing on the video to be transcoded according to the number of video slices; or when the video length is greater than the length threshold, the slicing node performs video slicing processing on the video to be transcoded according to a preset number of video slices.

14. A transcoding system, It is characterized in that The transcoding system includes a slicing node, a plurality of parallel transcoding nodes, a serial transcoding node, a merging node and a control node, wherein: The slicing node is used to perform video slicing processing on the video to be transcoded to obtain multiple sub-videos of the video to be transcoded; The parallel transcoding node is used to execute the transcoding task corresponding to any of the sub-videos; The control node is used to send a merging instruction to the merging node based on the transcoding results of the transcoding tasks after determining that all transcoding tasks corresponding to the to-be-transcoded videos are completed; The merging node is used to respond to the merging instruction, perform merging processing based on each transcoding result of the transcoding task corresponding to the video to be transcoded, and report the merging result to the control node; The control node is used to send a transcoding instruction for the video to be transcoded to the serial transcoding node when the merging result indicates that the merging fails; The serial transcoding node is used to perform serial transcoding processing on the video to be transcoded in response to the transcoding instruction to obtain a first target transcoded video.

15. A computer device comprising a memory and a processor, wherein the memory stores a computer program. It is characterized in that When the processor executes the computer program, the steps of the method according to any one of claims 1 to 13 are implemented.

16. A computer-readable storage medium having a computer program stored thereon, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.

17. A computer program product comprising a computer program, It is characterized in that When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 13 are implemented.

Citation Information

Patent Citations

  • Distributed video transcoding method and related device and system

    CN105407413A

  • Efficient parallel transcoding method for multi-core platform

    CN108848384A

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

    CN110602122A

  • Video transcoding method and device, computer equipment and storage medium

    CN112423024A

  • Mounting device for pole-type solar power generation module

    KR1020240156718A