Video transcoding method, transcoding system, computer device, storage medium and computer program product
By performing parallel transcoding and merging of video segments, combined with the management of control nodes, the problem of low video transcoding efficiency was solved, and a highly efficient video transcoding process was achieved.
Patent Information
- Application Number
- CN202411122207.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2025-11-18
- Estimated Expiration
- 2044-08-15
AI Technical Summary
In existing video transcoding solutions, the inability to transcode in parallel or the failure of parallel transcoding leads to repeated attempts, resulting in low video transcoding efficiency.
The video is sliced using a slicing node, transcoded in parallel using a parallel transcoding node, and merged using a merging node. The control node manages the transcoding process and reverts to serial transcoding if merging fails.
It improves the efficiency of video transcoding, avoids invalid parallel transcoding attempts, and ensures successful video transcoding.
Smart Images

Figure CN118972608B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of video processing, and in particular to a video transcoding method, transcoding system, computer equipment, storage medium, and computer program product. Background Technology
[0002] With the continuous increase in digital media content, the content disseminated on the internet is gradually shifting 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] Currently, to save transcoding time, the common video transcoding solution involves splitting a video file into multiple smaller videos and distributing these smaller videos in parallel to different transcoding nodes for transcoding. Finally, these smaller videos are aggregated into a single node for transcoding and splicing. However, the video encapsulation and encoding formats uploaded to the transcoding nodes are diverse, and some videos cannot be transcoded in parallel or will fail. Since the transcoding service is unaware that the reason for the parallel transcoding failure is that the video itself is not suitable for parallel transcoding, the transcoding service may repeatedly attempt parallel transcoding multiple times for these videos, resulting in low transcoding efficiency. Summary of the Invention
[0004] Therefore, it is necessary to provide a video transcoding method, transcoding system, computer equipment, storage medium, and computer program product to address the aforementioned technical problems.
[0005] In a first aspect, this application provides a video transcoding method applied to a transcoding system, the transcoding system including a slicing node, multiple parallel transcoding nodes, a serial transcoding node, a merging node, and a control node, the method comprising:
[0006] The slicing node performs video slicing processing on the video to be transcoded, resulting in multiple sub-videos of the video to be transcoded;
[0007] Each of the parallel transcoding nodes executes the transcoding task corresponding to any of the sub-videos;
[0008] After the control node determines that all transcoding tasks corresponding to the video to be transcoded have been completed, it sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks.
[0009] The merging node responds to the merging command, performs merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node;
[0010] If the merging result indicates that the merging has failed, the control node issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
[0011] The serial transcoding node responds to the transcoding instruction by performing serial transcoding on the video to be transcoded, thereby obtaining the first target transcoded video.
[0012] In one embodiment, the method further includes:
[0013] The slice 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 merging task in the merging task list based on the transcoding result.
[0015] When the number of merging tasks for the video to be transcoded in the merging task list is equal to 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 merging task in the merging task list based on the transcoding result, including:
[0017] After the parallel transcoding node successfully executes the transcoding task, it generates a first merging task in the merging task list. The first merging task includes at least 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 a transcoding task fails, the parallel transcoding node generates a second merging task in the merging task list. The second merging task includes at least the node identifier, the video identifier, and the transcoding failure identifier.
[0019] In one embodiment, the method further includes:
[0020] When performing the transcoding task, the parallel transcoding node reports its node identifier and the video identifier of the video to be transcoded to the control node.
[0021] If the second merging task exists in the merging task list, the control node determines the target node identifier from the node identifiers corresponding to the video identifier of the second merging task, and issues a termination transcoding instruction to the parallel transcoding node corresponding to each target node identifier.
[0022] In response to the termination transcoding instruction, the parallel transcoding node terminates the execution of the transcoding task and generates the second merging task in the merging task list.
[0023] In one embodiment, determining the target node identifier from the node identifiers corresponding to the video identifier of the second merging task includes:
[0024] Based on the video identifier of the second merging task, a target merging task is determined from the merging task list, and a first node identifier corresponding to each target merging task is determined;
[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 the target node identifiers.
[0026] In one embodiment, the merging node responds to the merging command by performing merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node, including:
[0027] In response to the merge command, the merging node retrieves the merging task corresponding to the video to be transcoded from the merging task list. If all the transcoding tasks corresponding to the video to be transcoded are the first merging tasks, the node merges the transcoding result data corresponding to each of the first merging tasks to obtain the second target transcoded video. The node then reports a merging result indicating a successful merging to the control node, wherein the merging result includes the second target transcoded video. Alternatively, if the transcoding task corresponding to the video to be transcoded includes the second merging task, the node reports a merging result indicating a failed merging to the control node.
[0028] In one embodiment, the method further includes:
[0029] If the second merging task exists in the merging task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merging task, and issues 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 slice node generates a first transcoding task for each of the sub-videos in the transcoding task list. 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...
[0032] When a slicing node fails, it generates a second transcoding task in the transcoding task list. The second transcoding task includes at least the video identifier and the slicing failure identifier.
[0033] In one embodiment, the method further includes:
[0034] Each of the parallel transcoding nodes obtains a transcoding task from the transcoding task list, and when the transcoding task is the second transcoding task, generates the second merging task from the merging task list.
[0035] In one embodiment, the method further includes:
[0036] The slice node generates a first transcoding task for each of the sub-videos in the transcoding task list. The first transcoding task includes the video identifier of the video to be transcoded and the identifier of the sub-video; or,
[0037] When a slicing node fails, it reports a slicing result indicating the failure to the control node. The slicing result includes at least the video identifier of the video to be transcoded and a slicing failure identifier.
[0038] Upon receiving the slicing result indicating a slicing failure, the control node issues a transcoding instruction to the serial transcoding node for the video to be transcoded.
[0039] In one embodiment, the transcoding system further includes an analysis node, and the method further includes:
[0040] If the video to be transcoded meets the parallel transcoding conditions, the analysis node reports a first analysis result to the control node, the first analysis result including at least the video identifier and the parallel transcoding identifier of the video to be transcoded; or if the video to be transcoded does not meet the parallel transcoding conditions, the analysis node reports a second analysis result to the control node, the second analysis result including at least the video identifier and the serial transcoding identifier.
[0041] Upon receiving the first analysis result, the control node issues a video slicing instruction for the video to be transcoded to the slicing node, or upon receiving the second analysis result, issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
[0042] In one embodiment, the parallel transcoding conditions include at least one of video frame rate conditions, video format conditions, and video duration conditions.
[0043] In one embodiment, the slicing node performs video slicing processing on the video to be transcoded, including:
[0044] If the video duration of the video to be transcoded is less than or equal to the duration threshold, the slicing node determines the number of video slices based on the video duration and performs video slicing processing on the video to be transcoded according to the number of video slices; or if the video duration is greater than the duration threshold, the slicing node performs video slicing processing on the video to be transcoded according to a preset number of video slices.
[0045] Secondly, this application also provides a transcoding system, which includes a slicing node, multiple parallel transcoding nodes, a serial transcoding node, a merging node, and a control node, wherein...
[0046] The slice node is used to slice the video to be transcoded, thereby obtaining 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 issue a merging instruction to the merging node based on the transcoding result of the transcoding task after determining that all transcoding tasks corresponding to the video to be transcoded have been completed.
[0049] The merging node is configured to respond to the merging instruction, perform merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and report the merging results to the control node;
[0050] The control node is used to issue a transcoding instruction for the video to be transcoded to the serial transcoding node when the merging result indicates that the merging has failed.
[0051] The serial transcoding node is used to perform serial transcoding processing on the video to be transcoded in response to the transcoding instruction, so as to obtain the first target transcoded video.
[0052] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement any of the methods described above.
[0053] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements any of the above methods.
[0054] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements any of the above methods.
[0055] The aforementioned video transcoding methods, transcoding systems, computer devices, storage media, and computer program products attempt to perform parallel transcoding on the video to be transcoded. When merging the transcoding results obtained after parallel transcoding, if the merging node fails to merge successfully, it falls back to serial transcoding to process the video. Since more videos can be serially transcoded, this embodiment of the application performs parallel transcoding on all videos that can be transcoded in parallel, and can also convert the video to serial transcoding when merging fails, ensuring successful video transcoding. Since the videos that fail to merge may include those that are not suitable for parallel transcoding, converting the video to serial transcoding after merging failure can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding. Attached Figure Description
[0056] Figure 1 This is a schematic diagram of a transcoding system in one embodiment;
[0057] Figure 2 This is a flowchart illustrating a video transcoding method in one embodiment;
[0058] Figure 3 This is a flowchart illustrating the process of determining whether the transcoding task of the video to be transcoded has been completed in one embodiment.
[0059] Figure 4 This is a flowchart illustrating the process of generating a merging task by parallel transcoding nodes in one embodiment.
[0060] Figure 5 This is a flowchart illustrating the process of the control node terminating other transcoding tasks after a transcoding failure in one embodiment.
[0061] Figure 6 This is a schematic diagram of the process by which the control node sends a transcoding instruction to the serial transcoding node after a transcoding failure in one embodiment.
[0062] Figure 7 This is a flowchart illustrating the process of a parallel transcoding node generating a second merging task after a slicing failure in one embodiment.
[0063] Figure 8 This is a schematic diagram of the process by which the control node sends a transcoding instruction to the serial transcoding node after a slicing failure in one embodiment.
[0064] Figure 9 This is a schematic diagram of the process by which the analysis node determines whether the video to be transcoded is suitable for parallel transcoding in one embodiment;
[0065] Figure 10 This is a schematic diagram illustrating the process of a transcoding system processing a video to be transcoded in one embodiment.
[0066] Figure 11This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0067] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0068] In one embodiment, such as 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 it can be deployed on multiple devices, which can be implemented using independent servers or a server cluster composed of multiple servers. The nodes are decoupled from each other and interact via RPC (Remote Procedure Call Protocol) or HTTP (Hypertext Transfer Protocol). The process involves several steps: Slicing node 101 performs video slicing on the video to be transcoded, resulting in multiple sub-videos; Parallel transcoding node 102 executes the transcoding task corresponding to any sub-video; Control node 105, after determining that all transcoding tasks for the video to be transcoded have been completed, issues a merging command to merging node 104 based on the transcoding results; Merging node 104, in response to the merging command, performs merging processing based on the transcoding results of each transcoding task for the video to be transcoded and reports the merging result to control node 105; Control node 105, if the merging result indicates merging failure, issues a transcoding command for the video to be transcoded to serial transcoding node 103; Serial transcoding node 103, in response to the transcoding command, performs serial transcoding processing on the video to be transcoded to obtain the first target transcoded video. Specific implementation details of each step can be found in the following method embodiments, which will not be repeated here.
[0069] The transcoding system provided in this application attempts to perform parallel transcoding on the video to be transcoded. When merging the transcoding results obtained after parallel transcoding, if the merging node fails to merge successfully, it falls back to serial transcoding to process the video. Since more videos can be serially transcoded, this application embodiment performs parallel transcoding on all videos that can be transcoded in parallel, and can also convert the video to serial transcoding when merging fails, ensuring successful video transcoding. Because the videos that fail to merge may include those that are not suitable for parallel transcoding, converting the video to serial transcoding after merging failure can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding.
[0070] In one embodiment, such as Figure 2 As shown, a video transcoding method is provided. This method is applied to... Figure 1 The transcoding system shown includes the following steps:
[0071] Step 201: The slice node performs video slicing processing on the video to be transcoded, resulting in multiple sub-videos of the video to be transcoded.
[0072] In this embodiment, the video to be transcoded is a user-uploaded video that needs to be transcoded. After receiving the video to be transcoded, the slicing node slices it into multiple sub-videos, so that each sub-video can be transcoded separately in its respective parallel transcoding node. This embodiment does not specifically limit the video slicing strategy; it can slice the video to be transcoded according to a fixed duration, so that each sub-video has a fixed length, or slice the video to be transcoded according to a fixed number of sub-videos, so that each video to be transcoded is sliced into a fixed number of sub-videos, etc.
[0073] After slicing, the slice node can issue transcoding tasks to the parallel transcoding nodes, either through the control node or without going through the control node. The control node or slice node can select some parallel transcoding nodes from all parallel transcoding nodes to execute transcoding tasks according to certain rules, or it can add transcoding tasks to the transcoding task list, and the parallel transcoding nodes can pull transcoding tasks from the transcoding task list themselves.
[0074] The following section first explains the information that a transcoding task may contain. A transcoding task may contain sub-videos obtained from slicing. If the slicing node stores the sub-video in another node (such as a storage node) after completing the slicing, the transcoding task may contain the storage address of the sub-video in the storage node. The transcoding task may also contain the encoding information (such as format, frame rate, etc.) of the sub-video required for transcoding.
[0075] The following explains the selection of parallel transcoding nodes by the control node or slice node. Each sub-video can be assigned a target parallel transcoding node responsible for transcoding that sub-video. Taking the control node's role in issuing transcoding tasks as an example, the task issuance process is explained (the slice node's task issuance process can refer to this process). The slice node can transmit the obtained sub-video to the control node, which then generates a transcoding task containing the sub-video and issues the task to each target parallel transcoding node. Alternatively, the slice node can report a notification message indicating that slicing is complete to the control node. Upon receiving the notification message, the control node generates a transcoding task containing communication instructions, enabling each target parallel transcoding node to communicate with the slice node after receiving the transcoding task to obtain the sub-video and perform transcoding. Alternatively, after completing slicing, the slice node can store the sub-video in another node (such as a storage node) and report the storage address of the sub-video to the control node. The control node generates a transcoding task containing the storage address, enabling each target parallel transcoding node to obtain the sub-video from the storage node according to the storage address and perform transcoding.
[0076] It should be noted that the transcoding capabilities of different parallel transcoding nodes may vary. For example, if the nodes are deployed on different servers, due to limitations in server computing power or network communication quality, some parallel transcoding nodes can handle shorter sub-videos or those with fewer frames, while others can handle longer sub-videos or those with more frames. When selecting a target parallel transcoding node, the process can be tailored to the characteristics of each sub-video, such as length, frame count, file size, and video format. The process can be described using the example of the control node selecting a target parallel transcoding node (the process of the slice node selecting a target parallel transcoding node can also be described as follows): The control node obtains the sub-video characteristics of each sub-video (which can be reported by the slice nodes). If the control node stores the video transcoding capabilities of each parallel transcoding node (e.g., what format of sub-video the node can handle, the estimated maximum length and size of sub-videos it can handle), the control node matches a target parallel transcoding node for each sub-video based on its stored video transcoding capabilities. In this scenario, the control node can periodically send video transcoding capability update messages to each parallel transcoding node. Each parallel transcoding node responds to these messages by reporting its latest video transcoding capabilities to the control node. If the control node does not store video transcoding capabilities, it can issue video transcoding capability reporting instructions to each parallel transcoding node based on the characteristics of each sub-video. Each parallel transcoding node then reports to the control node which sub-video it can process, based on 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 multiple different videos may be transcoded simultaneously, some sub-videos may not yet have a corresponding target parallel transcoding node. To ensure that all sub-videos undergo parallel transcoding simultaneously, the process of determining the target parallel transcoding node can be repeated periodically until each sub-video has a target parallel transcoding node. Alternatively, if batch parallel transcoding of sub-videos is allowed, transcoding tasks can be first issued to the parallel transcoding nodes for the sub-videos with target parallel transcoding nodes. For the remaining sub-videos, the process of determining the target parallel transcoding node can be repeated periodically, allowing some sub-videos to undergo parallel transcoding first, and others to undergo it later. These two strategies can be selected by those skilled in the art based on actual needs, and this application does not specifically limit them.
[0078] The following describes the scenario where parallel transcoding nodes automatically retrieve tasks. After generating transcoding tasks following the aforementioned process, the control node or slice node adds the transcoding tasks to its transcoding task list. The control node or slice node can send a task retrieval notification to all parallel transcoding nodes, indicating that a new task exists in each node's transcoding task list. Upon receiving the task retrieval notification, idle parallel transcoding nodes can retrieve transcoding tasks from their lists. Alternatively, parallel transcoding nodes can periodically check their transcoding task lists for new tasks when they are in an idle state.
[0079] Parallel transcoding nodes can determine the sub-video features of each sub-video corresponding to a transcoding task in the transcoding task list (the sub-video features can be contained within the transcoding task, or the parallel transcoding node can communicate with the slice node or control node based on the transcoding task's identifier, with the slice node or control node informing the parallel transcoding node of the sub-video features corresponding to the transcoding task), and determine which transcoding task it can process. If a transcoding task exists in the transcoding task list that the parallel transcoding node can process, it will retrieve that transcoding task from the list. The parallel transcoding node can also report to the control node which transcoding task it has retrieved and processed, allowing the control node to record the target parallel transcoding node for each sub-video. If no transcoding task exists, the parallel transcoding node will not retrieve the transcoding task.
[0080] In this scenario, to ensure that all sub-videos undergo parallel transcoding simultaneously, the parallel transcoding nodes can report a request message to the node containing the transcoding task list (control node or slice node) before fetching the task, and temporarily enter a waiting state until a response is received. The control node or slice node will then lock the transcoding task to prevent other parallel transcoding nodes from fetching it. After receiving a request message for all transcoding tasks under a given video, the control node or slice node will reply with a response message to the corresponding parallel transcoding nodes, instructing each node to fetch the transcoding task and begin transcoding. If batch parallel transcoding of sub-videos is allowed, the parallel transcoding nodes can begin processing the transcoding tasks independently after fetching them.
[0081] Step 202: Any parallel transcoding node executes the transcoding task corresponding to any sub-video.
[0082] In this embodiment, multiple parallel transcoding nodes acquire sub-videos and transcode each sub-video in parallel. After completing transcoding, each parallel transcoding node reports the transcoding result to the control node. If the sub-video transcoding is successful, the transcoding result contains the transcoded sub-video or the storage address of the transcoded sub-video in the storage node. If the sub-video transcoding fails, the transcoding result contains any content that can indicate the transcoding failure, such as a failure indicator or no data.
[0083] Step 203: After the control node determines that all transcoding tasks corresponding to the video to be transcoded have been completed, it sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks.
[0084] In this embodiment, after collecting the transcoding results of all sub-videos of the video to be transcoded, the control node determines that all transcoding tasks are complete and instructs the merging node to start merging the transcoding results of the transcoding tasks via a merging command. This embodiment does not specifically limit how the control node determines that all transcoding tasks corresponding to the video to be transcoded are complete. For example, if the control node can determine the target parallel transcoding nodes processing each sub-video (e.g., the target parallel transcoding nodes are 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 nodes report to the control node when pulling transcoding tasks), the control node can determine which parallel transcoding node uploaded the transcoding result of the transcoding task after receiving it. After receiving the transcoding results of all target parallel transcoding nodes, the control node determines that all transcoding tasks corresponding to the video to be transcoded are complete. If the control node cannot determine the target parallel transcoding nodes for processing each sub-video (e.g., 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. After receiving the transcoding results of that number of transcoding tasks for the corresponding video to be transcoded, the control node determines that all transcoding tasks for the video to be transcoded are completed. Alternatively, the control node can obtain the duration of the video to be transcoded. When it receives the transcoding results of multiple transcoding tasks for the corresponding 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, the control node determines that all transcoding tasks for the video to be transcoded are completed.
[0085] Step 204: The merging node responds to the merging command, performs merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node.
[0086] In this embodiment, after the control node issues a merge command to the merge node, the merge node obtains each transcoding result and merges them. If the transcoding result contains a transcoded sub-video, the merge 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 merge node needs to obtain the transcoded sub-video based on the storage address. If the merge node successfully obtains the transcoded sub-video for each transcoding result, the merge node performs a merge process on each transcoded sub-video. When the merge is successful, the merge 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 merge node reports any content that can indicate the failure of the merge, such as a failure indicator or no data.
[0087] If the transcoding result contains content indicating transcoding failure, the merging node can stop merging the transcoding results and report any content that can indicate merging failure, such as a failure indicator or no data.
[0088] It should be noted that, to ensure the quality of audio transcoding in the video, audio can be transcoded separately. After the video to be transcoded enters the transcoding system, a node (such as a slicing node or other node responsible for video processing) can separate the video and audio, and store the audio. When the merging node executes the merging task, if the merging is successful, the merging node obtains the audio corresponding to the video to be transcoded from the control node, or communicates with the node storing the audio to obtain the audio. The merging node then transcodes the audio separately, and merges the transcoded audio with the merged video to obtain the transcoded video. If the merging fails, the merging node can skip the above-mentioned audio acquisition and transcoding operations, saving the merging node's resources.
[0089] Step 205: If the merging result indicates that the merging has failed, the control node issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
[0090] In this embodiment, if the control node obtains a merging result indicating a merging failure, it processes the video to be transcoded into a serial format. The control node issues a transcoding instruction to the serial transcoding node for the video to be transcoded. The transcoding instruction may contain the video to be transcoded or its storage address, so that the serial transcoding node performs serial transcoding on the video to be transcoded. In this embodiment, a merging result indicating a merging failure may be due to the video itself being unsuitable for parallel transcoding, resulting in sub-video transcoding failure; the video to be transcoded could be transcoded in parallel, but the parallel transcoding node failed to transcode the sub-video for other reasons; or all sub-videos were successfully transcoded, but the merging node failed to merge the transcoded sub-videos for other reasons. Considering that verifying which specific situation caused the merging failure and then taking corresponding actions is inefficient, this embodiment reverts the video to be transcoded to serial transcoding in all three situations, ensuring the transcoding efficiency of the video to be transcoded.
[0091] Step 206: The serial transcoding node responds to the transcoding instruction to perform serial transcoding on the video to be transcoded, and obtains the first target transcoded video.
[0092] In this embodiment, the serial transcoding node obtains the video to be transcoded according to the transcoding instruction, performs video transcoding on the video to be transcoded in serial mode, and obtains the first target transcoded video after transcoding the video to be 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 this application attempts to perform parallel transcoding on the video to be transcoded. When merging the transcoding results obtained after parallel transcoding, if the merging node fails to merge successfully, it falls back to serial transcoding to process the video. Since more videos can be serially transcoded, this application embodiment performs parallel transcoding on all videos that can be transcoded in parallel, and can also convert the video to serial transcoding when merging fails, ensuring successful video transcoding. Since the videos that fail to merge may include those that are not suitable for parallel transcoding, converting the video to serial transcoding after merging failure can avoid repeated invalid parallel transcoding attempts and improve the efficiency of video transcoding.
[0094] In one embodiment, such as Figure 3 As shown, the above method also includes:
[0095] Step 301: The slice node reports the number of video slices to be transcoded to the control node;
[0096] Step 302: After completing the transcoding task, the parallel transcoding node generates a corresponding merging task in the merging task list based on the transcoding result;
[0097] Step 303: When the number of merging tasks for the video to be transcoded is equal to the number of slices in the merge task list, the control node determines that all transcoding tasks corresponding to the video to be transcoded are completed.
[0098] In this embodiment, after slicing, the slicing node can report the number of slices of the video to be transcoded, i.e., the number of sub-videos obtained from 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 have been 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 merging task can carry an identifier indicating which video to be transcoded corresponds to that merging task, such as the video identifier of the video to be transcoded. The control node can periodically traverse the merging task list, retrieve the video identifiers for each merging task, and count the number of merging tasks corresponding to each video identifier. This count is then compared to the number of segments in the video to be transcoded corresponding to that video identifier. If the number of merging tasks is less than the number of segments, the control node determines that the transcoding tasks for the video to be transcoded corresponding to that video identifier are not all complete and continues to wait for a new merging task corresponding to that video identifier to be written into the merging task list. If the number of merging tasks equals the number of segments, the control node determines that the transcoding tasks for the video to be transcoded corresponding to that video identifier are all complete and issues a merging command to the merging node.
[0100] The video transcoding method provided in this application records the number of slices of the video to be transcoded in the control node. When the number of merging tasks corresponding to the video to be transcoded in the merging task list is equal to the number of slices, it is determined that all transcoding tasks corresponding to the video to be transcoded are completed. This simplifies the process of the control node tracking whether each sub-video of the video to be transcoded has been transcoded, and improves the overall efficiency of video transcoding.
[0101] In one embodiment, such as Figure 4 As shown, in step 302, after completing the transcoding task, the parallel transcoding node generates a corresponding merging task in the merging task list based on the transcoding result, including:
[0102] Step 401: After the parallel transcoding node successfully executes the transcoding task, it generates a first merging task in the merging task list. The first merging task includes at least 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 parallel transcoding node fails to execute the transcoding task, it generates a second merging task in the merging task list. The second merging task includes at least a node identifier, a video identifier, and a transcoding failure identifier.
[0104] In this embodiment, the parallel transcoding node can generate different merging tasks in the merging task list based on whether the transcoding task is successful. This allows the merging node to determine whether the parallel transcoding node has successfully transcoded the sub-video based on the different contents of the merging task after reading it.
[0105] If the parallel transcoding node successfully transcodes, a first merging task can be generated. The first merging task may include the transcoding result data obtained after successful transcoding. This transcoding result data can be the transcoded sub-video or the storage address of the transcoded sub-video on 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 inform the control node which specific video to be transcoded corresponds to the first merging task, and the node identifier is used to allow the control node to track the completion status of each parallel transcoding node's transcoding task.
[0106] If the parallel transcoding node fails to transcode, a second merging task can be generated. The second merging task may include a node identifier, a video identifier, and a transcoding failure identifier. When the merging node reads the transcoding failure identifier, it can determine that the transcoding node failed to transcode the sub-video corresponding to the merging task.
[0107] The video transcoding method provided in this application writes transcoding result data into the merging task if transcoding is successful, and writes a transcoding failure flag into the merging task if transcoding fails. This facilitates the merging node in determining whether the sub-videos corresponding to the merging task have been successfully transcoded, thereby improving the overall efficiency of video transcoding.
[0108] In one embodiment, such as Figure 5 As shown, the above method also includes:
[0109] Step 501: When performing 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: If a second merging task exists in the merging task list, the control node determines the target node identifier from the node identifiers corresponding to the video identifier of the second merging task, and issues a termination transcoding instruction to the parallel transcoding node corresponding to each target node identifier.
[0111] Step 503: In response to the termination transcoding instruction, the parallel transcoding node terminates the transcoding task and generates a second merging task in the merging task list.
[0112] In this embodiment, when a parallel transcoding node retrieves a transcoding task, it can report its own node identifier and the video identifier of the video to be transcoded corresponding to the transcoding task to the control node. This allows the control node to record which parallel transcoding nodes are specifically transcoding 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 identifiers 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 retrieved, and can record the correspondence between the node identifiers of each of the aforementioned parallel transcoding nodes and the video identifiers of the video to be transcoded.
[0113] The control node can monitor the merging task list. Since the merging node will produce a merge result indicating failure when merging the transcoding results of each sub-video of the video to be transcoded, if the control node detects that a second merging task has been added to the merging task list, it can notify the parallel transcoding nodes executing other transcoding tasks for that video to terminate transcoding, preventing them from continuing invalid operations and saving their computing power. The control node can determine the video identifier of the second merging task, identify the corresponding node identifiers, and then determine the target node identifier from among the node identifiers for which the control node needs to notify the node to terminate transcoding.
[0114] In one embodiment, the target node identifier is the identifier of all nodes. That is, the control node sends a termination transcoding command to all parallel transcoding nodes processing the sub-video transcoding task, regardless of whether these parallel transcoding nodes have already written a merge task into the merge task list. The termination transcoding command may carry the video identifier corresponding to the second merge task. After receiving the termination transcoding command, the parallel transcoding node matches the target task to be terminated from its processed transcoding tasks based on 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 the identifier corresponding to a node that has not yet been written into the merging task list. The control node determines the target merging task from the merging task list based on the video identifier of the second merging task, and determines the first node identifier corresponding to each target merging task; the node identifiers other than the first node identifiers among the node identifiers corresponding to the video identifier of the second merging task are used as target node identifiers. The target merging task refers to a merging task whose video identifier is the same as the video identifier of the second merging task, and includes the second merging task itself. After determining the target merging task, the control node can determine which parallel transcoding nodes have already written merging tasks into the merging task list, and further determine which parallel transcoding nodes have not yet written merging tasks into the merging task list based on the correspondence between video identifiers and node identifiers. Then, the node identifiers of these parallel transcoding nodes are used as target node identifiers, and a termination transcoding command is issued to these parallel transcoding nodes.
[0116] The video transcoding method provided in this application embodiment, if a second merging task exists in the merging task list, determines the parallel transcoding nodes that process other transcoding tasks corresponding to the video identifier of the second merging task based on the video identifier of that video identifier, and notifies these parallel transcoding nodes to terminate the transcoding task processing. This avoids invalid operations by the parallel transcoding nodes and saves their computing power. It also speeds up the completion of transcoding tasks by each parallel transcoding node, thereby accelerating the speed at which the control node receives the merging result indicating merging failure and processes the video to be transcoded serially, thus improving the efficiency of video transcoding.
[0117] In one embodiment, in step 204, the merging node responds to the merging command by performing merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node, including:
[0118] In response to the merge command, the merge node retrieves the merge task corresponding to the video to be transcoded from the merge task list. If all the transcoding tasks corresponding to the video to be transcoded are first merge tasks, the node merges the transcoding result data corresponding to each first merge task to obtain the second target transcoded video. The node then reports a merge result indicating a successful merge to the control node, which includes the second target transcoded video. Alternatively, if the transcoding task corresponding to the video to be transcoded includes the second merge task, the node reports a merge result indicating a failed merge to the control node.
[0119] In this embodiment, after the merging node retrieves the merging tasks corresponding to the video to be transcoded, it checks whether a second merging task exists in each merging task. If a second merging task exists, the merging node does not need to perform the merging step for each merging task and reports the merging result indicating a failed merge to the control node. If each merging task is a first merging task and a second merging task does not exist, the merging node reads the transcoding result data corresponding to each first merging task, merges the transcoding result data to obtain the second target transcoded video (if the audio is transcoded separately, the merging node also needs to obtain the audio corresponding to the video to be transcoded, transcode the audio, and then merge the transcoded audio with the second target transcoded video again). The merging node then reports the second target transcoded video to the control node through the merging result indicating a successful merge, and the control node provides feedback on the second target transcoded video to the user.
[0120] The video transcoding method provided in this application embodiment allows the merging node to report a failed merge result without further operation if a second merging task exists within the merging task. This avoids invalid operations by the merging node and saves its computing power. Simultaneously, it accelerates the speed at which the control node receives the failed merge result and processes the transcoded video serially, thus improving the efficiency of video transcoding.
[0121] In one embodiment, such as Figure 6 As shown, the above method also includes:
[0122] If a second merging task exists in the merging task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merging task and issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
[0123] In this embodiment, after the control node detects that the second merging task has been written into the merging task list, it can roll back the video to be transcoded corresponding to the second merging task to serial transcoding. This eliminates the need to wait for the merging node to report a merging result indicating merging failure before rolling back the video to serial transcoding, thereby improving the efficiency of video transcoding. While issuing transcoding instructions for the video to be transcoded to the serial transcoding node, the control node can still perform the steps of determining the target node identifier and notifying the parallel transcoding nodes corresponding to each target node identifier to terminate transcoding, ensuring that the parallel transcoding nodes do not perform invalid operations.
[0124] The control node can also set a serial transcoding flag for the video identifier of the video to be transcoded, to record that the video to be transcoded has already undergone serial transcoding. After the merging node reports a merging result indicating merging failure, the control node determines whether the video identifier corresponding to the merging result already has a corresponding serial transcoding flag. If so, the control node does not need to perform the step of issuing transcoding instructions to the serial transcoding node for the video to be transcoded when the merging result indicates merging failure. If not, the control node performs 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 slice node generates a first transcoding task for each sub-video in the transcoding task list. The first transcoding task includes at least the video identifier of the video to be transcoded and the video data of the sub-video. Alternatively, if the slice node fails to slice, it generates a second transcoding task in the transcoding task list. The second transcoding task includes at least the video identifier and the slice failure identifier.
[0127] In this embodiment, when a 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 can be the video file of the sub-video or the storage address of the sub-video. If slicing fails, the slicing node can generate a second transcoding task including the 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 can be 1. When a parallel transcoding node retrieves a first transcoding task, it can perform normal transcoding processing on the sub-video. When it retrieves a second transcoding task, it can 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 be rolled back to serial transcoding, or generate a second merging task based on the second transcoding task and write it to the merging task queue.
[0128] In one embodiment, such as Figure 7 As shown, the above method also includes:
[0129] Any parallel transcoding node obtains a transcoding task from the transcoding task list, and when the transcoding task is the second transcoding task, generates a second merge task in the merge task list.
[0130] In this embodiment, each parallel transcoding node pulls transcoding tasks from the transcoding task list for processing. If a parallel transcoding node pulls a first transcoding task, it executes the transcoding task corresponding to the sub-video based on the video data contained in the first transcoding task. If a parallel transcoding node pulls a second transcoding task, it can generate a second merging task in the merging task list, so that the merging node reports a merging result indicating a merging failure, causing the video to be transcoded to revert to serial transcoding for processing.
[0131] In one embodiment, such as Figure 8 As shown, the above method also includes:
[0132] The slice node generates the first transcoding task for each sub-video in the transcoding task list. The first transcoding task includes the video identifier of the video to be transcoded and the identifier of the sub-video. Alternatively, when the slice fails, the slice node reports the slice result indicating the slice failure to the control node. The slice result includes at least the video identifier of the video to be transcoded and the slice failure identifier.
[0133] When the control node receives a slice result indicating a failed slice, it sends a transcoding instruction for the video to be transcoded to the serial transcoding node.
[0134] In this embodiment, if a slicing node fails to slice, it does not write a transcoding task into the transcoding task list. The slicing node can report the failed slicing result to the control node. The control node determines the video to be transcoded based on the video identifier in the slicing result and issues a transcoding instruction to the serial transcoding node for the video to be transcoded, allowing the video to be transcoded to revert to serial transcoding for processing. This eliminates the need for the control node to wait for the merging node to report a merging result indicating a merging failure before reverting the video to be transcoded to serial transcoding, thus improving the transcoding efficiency of the video to be transcoded.
[0135] In one embodiment, such as Figure 9 As shown, the transcoding system also includes an analysis node, and the methods also include:
[0136] Step 901: If the video to be transcoded meets the conditions for parallel transcoding, the analysis node reports the first analysis result to the control node. The first analysis result includes at least the video identifier and the parallel transcoding identifier of the video to be transcoded; or,
[0137] Step 902: If the video to be transcoded does not meet the conditions for parallel transcoding, report the second analysis result to the control node. The second analysis result includes at least the video identifier and the serial transcoding identifier.
[0138] Step 903: Upon receiving the first analysis result, the control node issues a video slicing command 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 this embodiment, the analysis node analyzes whether a video to be transcoded is suitable for parallel transcoding upon receiving it. The control node records whether each video to be transcoded ultimately uses parallel or serial transcoding. The parallel transcoding conditions can be summarized based on the transcoding method ultimately used for each video. For example, if the proportion of videos using parallel transcoding is lower than a threshold when transcoding a video of a certain target format, the transcoding system can determine that the target format video 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 dimensions such as video duration, video frame rate, and video size to summarize which types of videos are suitable for parallel transcoding and which types are not, and set the parallel transcoding conditions accordingly. For example, if 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. If it is determined that a video with a frame rate variance less than a certain value and an H.265 format is suitable for parallel transcoding, the parallel transcoding condition is set to a video frame rate variance less than that value and a video format of H.265.
[0141] If the analysis node determines that the video to be transcoded meets the conditions for parallel transcoding, it reports the first analysis result to the control node. The first analysis result may carry the video identifier and parallel transcoding identifier of the video to be transcoded, instructing the control node that the video can be transcoded in parallel. The control node can then issue video slicing instructions to the slicing nodes based on the video identifier, instructing the slicing nodes to perform slicing tasks for the video to be transcoded. If the analysis node determines that the video to be transcoded does not meet the conditions for parallel transcoding, it reports the second analysis result to the control node. The second analysis result may carry the video identifier and serial transcoding identifier of the video to be transcoded, instructing the control node that the video cannot be transcoded in parallel. The control node can then issue transcoding instructions to the serial transcoding nodes based on the video identifier, instructing the serial transcoding nodes to perform serial transcoding tasks for the video to be transcoded.
[0142] The video transcoding method provided in this application first determines whether the video to be transcoded is suitable for parallel transcoding by analyzing the nodes when the video to be transcoded enters the transcoding system. If it is not suitable, the video to be transcoded is processed into serial transcoding. This can divert the video to be transcoded that is likely to fail in parallel transcoding to the serial transcoding node in advance, saving the computing power of the parallel transcoding node and improving the overall efficiency of video transcoding.
[0143] In one embodiment, the parallel transcoding conditions include at least one of video frame rate conditions, video format conditions, and video duration conditions.
[0144] In this embodiment, the suitability of a video for parallel transcoding can be determined based on its frame rate, format, and duration. Historical videos processed by the transcoding system over a previous period can be obtained, and, referring to the methods described in the preceding embodiments, the parallel transcoding success rate of these historical videos can be analyzed from the dimensions of frame rate, format, and duration. Based on the analysis results, conditions for frame rate, format, and duration can be set accordingly.
[0145] The above process is explained below using video frame rate as an example. Multiple sub-dimensions for analysis related to video frame rate can be further determined based on actual needs, such as the sub-dimension of average frame rate, the sub-dimension of the difference between the absolute value of frame rate and average frame rate, and the sub-dimension of frame rate variance. Multiple intervals can be constructed for each sub-dimension. For example, for the sub-dimension of average frame rate, interval 1 can be constructed corresponding to an average frame rate of 20 to 30 frames per second, interval 2 corresponding to an average frame rate of 30 to 50 frames per second, and interval 3 corresponding to an average frame rate of 50 frames per second or higher. Historical videos to be transcoded are categorized into intervals according to their average frame rate. The number of historical videos to be transcoded that ultimately use parallel transcoding in each interval is counted. The ratio of the number of historical videos to be transcoded that ultimately use parallel transcoding to the total number of historical videos to be transcoded in that interval is calculated as the parallel transcoding success rate for that interval. It is then determined which interval's parallel transcoding success rate exceeds a pre-set success rate threshold. If the parallel transcoding success rate of intervals 1 and 2 exceeds the success rate threshold, while the parallel transcoding success rate of interval 3 is lower than the success rate threshold, then the video frame rate condition can be set to an average frame rate of less than 50 frames per second for the video to be transcoded.
[0146] Similarly, for the dimensions of video format and video duration, the strategy described above can be adopted: classifying historical videos to be transcoded, calculating the parallel transcoding success rate for each category, and setting video format and video duration conditions according to categories with parallel transcoding success rates greater than a success rate threshold. This will not be elaborated further in the embodiments of this application. In one embodiment, the video frame rate condition is that the absolute 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 slice node performs video slicing processing on the video to be transcoded, including:
[0148] If the video duration of the video to be transcoded is less than or equal to the duration threshold, the slicing node determines the number of video slices based on the video duration and performs video slicing processing on the video to be transcoded according to the number of video slices; or if the video duration is greater than the duration threshold, the slicing node performs video slicing processing on the video to be transcoded according to the preset number of video slices.
[0149] In this embodiment, the slicing node determines the number of video slices to be cut based on the video duration of the video to be transcoded. A duration threshold can be preset according to actual needs. If the video duration is less than or equal to the duration threshold, the number of video slices is determined based on the video duration. In this case, the number of video slices can be proportional to the video duration; for example, a 6-minute video to be transcoded has 3 video slices, and an 8-minute video to be transcoded has 5 video slices. Alternatively, the duration of each sub-video can be preset, and the number of slices to be cut is determined according to the sub-video duration. For example, if the sub-video duration is 1 minute, a 7.5-minute video to be transcoded can be cut into 7 sub-videos of 1-minute duration, with the final 30-second duration also considered as a sub-video; therefore, the number of video slices for this video to be transcoded is 8.
[0150] When the video duration exceeds a duration threshold, the video to be transcoded can be fixedly cut into a preset number of sub-videos. The preset number of video segments can be the maximum number of video segments that can be determined based on the video duration, or a number determined based on the total number of parallel transcoding nodes, such as half the total number of parallel transcoding nodes, a quarter of the total number of parallel transcoding nodes, etc., to ensure that longer videos to be transcoded do not occupy excessive parallel transcoding resources. In one embodiment, the duration threshold is 10 minutes. When the video duration to be transcoded is less than or equal to 10 minutes, the number of video segments to be transcoded is determined according to a preset sub-video duration of 1 minute, and the video to be transcoded is processed according to this preset number of video segments. When the video duration to be transcoded is greater than 10 minutes, the video to be transcoded is processed into 10 preset segments.
[0151] The video transcoding method provided in this application determines the number of video slices based on the video duration when the video duration is less than or equal to a duration threshold. This ensures that the size of each sub-video is reasonable, improving the efficiency of transcoding sub-videos and thus improving the overall efficiency of video transcoding. When the video duration exceeds the duration threshold, the video to be transcoded is processed by video slicing according to a preset number of video slices. This ensures that the video to be transcoded does not occupy too many parallel transcoding resources, guaranteeing that other videos to be transcoded processed by the transcoding system can still be transcoded in parallel using parallel transcoding nodes, which also improves the overall efficiency of video transcoding.
[0152] In one embodiment, such as Figure 10 The diagram illustrates a specific workflow example of video processing within a transcoding system. In this embodiment, the overall transcoding process is structured as a DAG (Directed Acyclic Graph), where each node represents a task performed by a node within the transcoding system. The triggering of each node's task is determined by the result of the task performed by its predecessor node. The overall transcoding process can be divided into four task types: video analysis, slicing, transcoding, and merging. Because the triggering of each node depends on the completion status of its predecessor node's task, if a node's task fails, the video to be transcoded can be rolled back to a serial transcoding node for serial transcoding. Therefore, serial transcoding can be performed promptly when the video is unsuitable for parallel transcoding, improving both the success rate and efficiency of video transcoding.
[0153] After the video to be transcoded enters the transcoding system, it is first analyzed by the analysis node. If the video meets the conditions for parallel transcoding, the slicing node slices it; otherwise, it is transferred to the serial transcoding node for serial transcoding. The slicing node slices the video into multiple transcoding tasks. Each parallel transcoding node then pulls a transcoding task, processes it in parallel, generates a merging task, and writes it to the merging task list. The merging node pulls a merging task. If a second merging task indicating transcoding failure exists, the merging node outputs a merge result indicating failure. If no second merging task exists, the merging node merges the transcoded sub-videos contained in each merging task, while simultaneously transcoding the audio of the video to be transcoded separately. The transcoded audio and the merged video are then merged, and a merge result indicating success or failure is output based on whether the merging was successful. If the merge result indicates failure, the video to be transcoded is transferred to the serial transcoding node for serial transcoding. This application utilizes an event-driven distributed architecture, where the activation of each task depends on the completion status of its preceding task, reducing resource consumption. Because the activation of the next task depends on the completion status of the previous task, if any stage fails during parallel transcoding, the video to be transcoded can be rolled back to the serial transcoding node for serial transcoding processing, improving the success rate of transcoding tasks.
[0154] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 11As shown, the computer device includes a processor, memory, and a network interface connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The network interface is used to communicate with external terminals via a network connection. When executed by the processor, the computer program implements a file status monitoring method.
[0155] Those skilled in the art will understand that Figure 11 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0156] In one embodiment, a computer device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps in the above-described method embodiments.
[0157] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, implements the steps in the above method embodiments.
[0158] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, implements the steps in the above method embodiments.
[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, data stored, data displayed, 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 will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments described above. Any references to memory, databases, or other media 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), magnetic 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. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, etc., and are not limited to these.
[0161] The technical features of the above embodiments can be combined in any way. For the sake of brevity, 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 embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A video transcoding method, characterized in that, Applied to a transcoding system, the transcoding system including a slicing node, multiple 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, resulting in multiple sub-videos of the video to be transcoded; Each of the parallel transcoding nodes executes the transcoding task corresponding to any of the sub-videos; After the control node determines that all transcoding tasks corresponding to the video to be transcoded have been completed, it sends a merging instruction to the merging node based on the transcoding results of the transcoding tasks. The merging node responds to the merging command, performs merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node; If the merging result indicates that the merging has failed, the control node issues a transcoding instruction for the video to be transcoded to the serial transcoding node. The serial transcoding node responds to the transcoding instruction by performing serial transcoding on the video to be transcoded, thereby obtaining the first target transcoded video.
2. The method according to claim 1, characterized in that, The method further includes: The slice 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 merging task in the merging task list based on the transcoding result. When the number of merging tasks for the video to be transcoded in the merging task list is equal to 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, characterized in that, After completing the transcoding task, the parallel transcoding node generates a corresponding merging task in the merging task list based on the transcoding result, including: After the parallel transcoding node successfully executes the transcoding task, it generates a first merging task in the merging task list. The first merging task includes at least the node identifier of the parallel transcoding node, the video identifier of the video to be transcoded, and the transcoding result data; or... After a transcoding task fails, the parallel transcoding node generates a second merging task in the merging task list. The second merging task includes at least the node identifier, the video identifier, and the transcoding failure identifier.
4. The method according to claim 3, characterized in that, The method further includes: When performing the transcoding task, the parallel transcoding node reports its node identifier and the video identifier of the video to be transcoded to the control node. If the second merging task exists in the merging task list, the control node determines the target node identifier from the node identifiers corresponding to the video identifier of the second merging task, and issues a termination transcoding instruction to the parallel transcoding node corresponding to each target node identifier. In response to the termination transcoding instruction, the parallel transcoding node terminates the execution of the transcoding task and generates the second merging task in the merging task list.
5. The method according to claim 4, characterized in that, Determining the target node identifier from the node identifiers corresponding to the video identifiers of the second merging task includes: Based on the video identifier of the second merging task, a target merging task is determined from the merging task list, and a first node identifier corresponding to each target merging task is determined; 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 the target node identifiers.
6. The method according to claim 3, characterized in that, The merging node responds to the merging command, performs merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and reports the merging results to the control node, including: In response to the merge command, the merging node retrieves the merging task corresponding to the video to be transcoded from the merging task list. If all the transcoding tasks corresponding to the video to be transcoded are the first merging tasks, the node merges the transcoding result data corresponding to each of the first merging tasks to obtain the second target transcoded video. The node then reports a merging result indicating a successful merging to the control node, wherein the merging result includes the second target transcoded video. Alternatively, if the transcoding task corresponding to the video to be transcoded includes the second merging task, the node reports a merging result indicating a failed merging to the control node.
7. The method according to claim 3, characterized in that, The method further includes: If the second merging task exists in the merging task list, the control node determines the video to be transcoded corresponding to the video identifier of the second merging task, and issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
8. The method according to claim 3, characterized in that, The transcoding task includes a first transcoding task and a second transcoding task, and the method further includes: The slice node generates a first transcoding task for each of the sub-videos in the transcoding task list. 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 a slicing node fails, it generates a second transcoding task in the transcoding task list. The second transcoding task includes at least the video identifier and the slicing failure identifier.
9. The method according to claim 8, characterized in that, The method further includes: Each of the parallel transcoding nodes obtains a transcoding task from the transcoding task list, and when the transcoding task is the second transcoding task, generates the second merging task from the merging task list.
10. The method according to claim 3, characterized in that, The method further includes: The slice node generates a first transcoding task for each of the sub-videos in the transcoding task list. The first transcoding task includes the video identifier of the video to be transcoded and the identifier of the sub-video; or, When a slicing node fails, it reports a slicing result indicating the failure to the control node. The slicing result includes at least the video identifier of the video to be transcoded and a slicing failure identifier. Upon receiving the slicing result indicating a slicing failure, the control node issues a transcoding instruction to the serial transcoding node for the video to be transcoded.
11. The method according to claim 1, characterized in that, The transcoding system further includes an analysis node, and the method further includes: If the video to be transcoded meets the parallel transcoding conditions, the analysis node reports a first analysis result to the control node, the first analysis result including at least the video identifier and the parallel transcoding identifier of the video to be transcoded; or if the video to be transcoded does not meet the parallel transcoding conditions, the analysis node reports a second analysis result to the control node, the second analysis result including at least the video identifier and the serial transcoding identifier. Upon receiving the first analysis result, the control node issues a video slicing instruction for the video to be transcoded to the slicing node, or upon receiving the second analysis result, issues a transcoding instruction for the video to be transcoded to the serial transcoding node.
12. The method according to claim 11, characterized in that, The parallel transcoding conditions include at least one of the following: video frame rate conditions, video format conditions, and video duration conditions.
13. The method according to claim 1, characterized in that, The slicing node performs video slicing processing on the video to be transcoded, including: If the video duration of the video to be transcoded is less than or equal to the duration threshold, the slicing node determines the number of video slices based on the video duration and performs video slicing processing on the video to be transcoded according to the number of video slices; or if the video duration is greater than the duration 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, characterized in that, The transcoding system includes slicing nodes, multiple parallel transcoding nodes, serial transcoding nodes, merging nodes, and control nodes, wherein... The slice node is used to slice the video to be transcoded, thereby obtaining 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 issue a merging instruction to the merging node based on the transcoding result of the transcoding task after determining that all transcoding tasks corresponding to the video to be transcoded have been completed. The merging node is configured to respond to the merging instruction, perform merging processing based on the transcoding results of each transcoding task corresponding to the video to be transcoded, and report the merging results to the control node; The control node is used to issue a transcoding instruction for the video to be transcoded to the serial transcoding node when the merging result indicates that the merging has failed. The serial transcoding node is used to perform serial transcoding processing on the video to be transcoded in response to the transcoding instruction, so as to obtain the first target transcoded video.
15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 13.
16. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.
17. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 13.
Citation Information
Patent Citations
Video processing method and device, electronic equipment and storage medium
CN110602122A
Video transcoding method and device, computer equipment and storage medium
CN112423024A