Video transcoding apparatus, video transcoding method, electronic equipment and storage medium
By adding a video transcoding device to electronic devices, providing an adapted runtime environment and task scheduling, the problem that video transcoding tasks can only be executed by a few devices is solved, and flexible scheduling and efficient transcoding on various devices are realized.
Patent Information
- Application Number
- CN202310602699.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-25
- Publication Date
- 2026-01-30
- Estimated Expiration
- 2043-05-25
AI Technical Summary
In existing technologies, video transcoding tasks can only be performed by a few types of electronic devices, which cannot utilize a wide variety of electronic devices, resulting in poor scheduling flexibility and difficulty in meeting increasingly demanding video transcoding requirements.
Add a video transcoding device to electronic devices, provide a runtime environment adapted to electronic devices, develop a general video transcoding algorithm, and deploy it to various electronic devices for execution. Achieve flexible task scheduling by creating nodes and task scheduling nodes through the runtime environment.
It improves the scheduling flexibility of video transcoding tasks, enabling them to be executed on a wide variety of electronic devices, thus meeting increasingly demanding video transcoding requirements.
Smart Images

Figure CN116546031B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a video transcoding apparatus, a video transcoding method, an electronic device, and a storage medium. Background Technology
[0002] Video transcoding refers to converting a compressed video stream into another video stream to adapt to different network bandwidths, terminal processing capabilities, and user needs. Essentially, video transcoding is a process of decoding followed by encoding. The video streams before and after transcoding may follow the same or different video coding standards.
[0003] With the continuous development of the short video and live streaming industries, the amount of video resources generated is becoming increasingly massive, placing higher demands on video transcoding, such as lower transcoding latency and lower transcoding costs. Currently, video transcoding tasks can only be performed by a limited number of electronic devices, making it impossible to utilize a wide variety of electronic devices. This results in poor scheduling flexibility for video transcoding tasks, making it difficult to meet the increasingly stringent requirements. Summary of the Invention
[0004] This application provides a video transcoding apparatus, a video transcoding method, an electronic device, and a storage medium to improve the scheduling flexibility of video transcoding tasks.
[0005] This application provides a video transcoding device applied to an electronic device. The video transcoding device is positioned between the application layer and the operating system layer of the electronic device. The device includes resource data for providing multiple runtime environments, a runtime environment creation node, a task scheduling node, and multiple task execution nodes. The runtime environment creation node is used to determine a target runtime environment that matches the device information of the electronic device among the multiple runtime environments, create the target runtime environment based on the resource data of the target runtime environment, and schedule the task scheduling node and multiple task execution nodes to run in the target runtime environment. The task scheduling node is used to receive video transcoding tasks sent by the application layer and execute them on the multiple task execution nodes. A node sends a confirmation request, which instructs the task execution node to confirm whether it has the capability to execute the video transcoding task; it also receives multiple confirmation messages returned by multiple task execution nodes in response to the confirmation request, selects a target task execution node from among the multiple task execution nodes based on the multiple confirmation messages, and assigns the video transcoding task to the target task execution node; a task execution node, in response to the confirmation request, confirms whether it has the capability to execute the video transcoding task and sends confirmation messages to the task scheduling node, which in turn indicate whether it has the capability to execute the video transcoding task; if the task execution node is the target task execution node, it runs the video transcoding algorithm to execute the video transcoding task.
[0006] This application also provides a video transcoding method, including: determining a target runtime environment adapted to the electronic device from multiple runtime environments based on the device information of the electronic device; creating the target runtime environment in the electronic device based on the resource data of the target runtime environment; and running a transcoding algorithm in the target runtime environment to perform the video transcoding task in response to a received video transcoding task.
[0007] This application also provides an electronic device, wherein the aforementioned video transcoding device is provided between the application layer and the operating system layer of the electronic device.
[0008] This application also provides an electronic device, including: a memory and a processor; the memory for storing a computer program; and the processor coupled to the memory for executing the computer program to perform steps in a video transcoding method.
[0009] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, enables the processor to implement the steps in the video transcoding method.
[0010] The technical solution provided in this application adds a video transcoding device to an electronic device. This device provides a runtime environment adapted to the electronic device, allowing developers to create and deploy general-purpose video transcoding algorithms on a wide variety of electronic devices. This means video transcoding tasks are no longer limited to a few specific electronic devices but can be distributed across a diverse range of devices, improving scheduling flexibility and enabling the fulfillment of increasingly demanding video transcoding requirements. Attached Figure Description
[0011] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0012] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application;
[0013] Figure 2 A flowchart illustrating a video transcoding method provided in this application embodiment;
[0014] Figure 3 A flowchart illustrating a video transcoding method provided in this application embodiment;
[0015] Figure 4 This is a schematic diagram of the structure of a video transcoding device provided in an embodiment of this application;
[0016] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0017] To make the objectives, technical solutions, and advantages of this application clearer, the technical solutions of this application will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not all of them. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0018] In the embodiments of this application, "at least one" refers to one or more, and "more than one" refers to two or more. "And / or" describes the access relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone, where A and B can be singular or plural. In the textual description of this application, the character " / " generally indicates that the preceding and following associated objects have an "or" relationship. Furthermore, in the embodiments of this application, "first," "second," "third," etc., are only used to distinguish the content of different objects and have no other special meaning.
[0019] With the continuous development of the short video and live streaming industries, the generated video resources are becoming increasingly massive, placing higher demands on video transcoding, such as lower transcoding latency and lower transcoding costs. Considering the runtime environment of transcoding algorithms, which requires optimization for different instruction set architectures, operating systems, or hardware devices (e.g., CPUs or GPUs), the software development cost of transcoding algorithms is high and the efficiency is low. Therefore, current video transcoding tasks are mainly executed by transcoding servers equipped with CPUs (Central Processing Units) or GPUs (Graphics Processing Units). In other words, video transcoding tasks can only be executed by a limited number of electronic devices, making it difficult to utilize a wide variety of electronic equipment. This results in poor scheduling flexibility for video transcoding tasks, making it difficult to meet increasingly stringent video transcoding requirements.
[0020] Therefore, embodiments of this application provide a video transcoding apparatus, a video transcoding method, an electronic device, and a storage medium. The technical solution provided by these embodiments adds a video transcoding apparatus to an electronic device. This video transcoding apparatus can provide a runtime environment adapted to the electronic device, allowing developers to develop general-purpose video transcoding algorithms and deploy them on a wide variety of electronic devices. Thus, video transcoding tasks are no longer limited to being assigned to a few types of electronic devices but can be distributed across a wide variety of electronic devices, improving the scheduling flexibility of video transcoding tasks and providing the possibility of meeting increasingly demanding video transcoding requirements.
[0021] The technical solutions provided by the various embodiments of this application are described in detail below with reference to the accompanying drawings.
[0022] Figure 1 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. See also... Figure 1 The electronic device consists of, from top to bottom, an application layer, an operating system layer, a processor layer, and a hardware device layer.
[0023] In this embodiment, the application layer provides a variety of application layer protocols, offering an interface for interaction between the user and the network. The application layer of the electronic device receives the video transcoding task to be processed and then passes it down.
[0024] In this embodiment, there are no restrictions on the operating system in the operating system layer. Operating systems in the operating system layer include, but are not limited to, Linux, Windows, macOS, and Android. Linux is a multi-user, multi-tasking operating system based on POSIX (Portable Operating System Interface of UNIX), supporting multi-threading and multiple CPUs (Central Processing Units). Windows is an operating system developed based on a graphical user interface and is mainly used in computers, smartphones, and other devices.
[0025] In this embodiment, the instruction set architecture of the processor in the processor layer is not limited. For example, the processor in the processor layer includes at least one of the following: x86 processor, ARM (Advanced RISC Machine) processor, RISC (Reduced Instruction Set Computer)-V processor, and MIPS (Microprocessor without interlocked piped stages architecture) processor; wherein, x86 is the computer language instruction set executed by the microprocessor; ARM architecture is a 32-bit reduced instruction set processor architecture; RISC-V is an open instruction set architecture based on RISC; and MIPS is also a RISC-based processor architecture.
[0026] In this embodiment, no restrictions are placed on the hardware devices in the hardware device layer. For example, the hardware devices in the hardware device layer include at least one of the following: CPU, GPU, NPU (Neural network Processing Unit), and FPGA (Field Programmable Gate Array), wherein any one of the hardware devices is a heterogeneous device relative to the other hardware devices.
[0027] In this embodiment, the device type of the electronic device can be a PC (Personal Computer), a mobile device, or a Web (World Wide Web), but is not limited to these.
[0028] See Figure 1 A video transcoding device is installed between the application layer and the operating system layer of the electronic device. The video transcoding device includes resource data for multiple runtime environments, a runtime environment creation node, a task scheduling node, and multiple task execution nodes.
[0029] In this embodiment, the runtime environment (RTE) includes, but is not limited to, OCI (Open Container Initiative) RTE and Wasm (WebAssembly) RTE. OCI primarily has two standard documents: the container runtime specification and the container image specification. Wasm is a stack-based virtual machine binary instruction set that can be used as a compilation target for programming languages and can be deployed in web client and server applications.
[0030] In this embodiment, the video transcoding device provides resource data for multiple runtime environments. Using the resource data of each runtime environment, a runtime environment adapted to various electronic devices can be built. The resource data required for building the OCI Runtime and WASM Runtime runtime environments includes, but is not limited to, software libraries and environment variables. For an introduction to building the OCI Runtime and WASM Runtime runtime environments, please refer to existing technologies.
[0031] In this embodiment, if the electronic device's operating system is Linux, Windows, or macOS, OCI RTE can be selected. If the electronic device's operating system is Android, Wasm RTE can be selected.
[0032] In this embodiment, if the electronic device is a mobile or web-based device, Wasm RTE can be selected. If the electronic device is a PC (Personal Computer), OCI RTE can be selected.
[0033] In this embodiment, if the processor of the electronic device is an x86 processor, ARM processor, RISC-V processor, or MIPS processor, either OCI RTE or Wasm RTE can be selected.
[0034] In this embodiment, if the hardware of the electronic device is a CPU, GPU, NPU and FPGA, either OCI RTE or Wasm RTE can be selected.
[0035] It is worth noting that video transcoding devices are not limited by operating systems, processor instruction set architectures, or hardware devices; they can even run on mobile or web-based devices. Building a unified video transcoding device across a wide variety of electronic devices allows for better coverage of a vast array of heterogeneous devices.
[0036] In this embodiment, the runtime environment creation node in the video transcoding device undertakes the tasks of runtime environment creation and node scheduling. Specifically, the runtime environment creation node is used to determine the target runtime environment that matches the device information of the electronic device among multiple runtime environments, create the target runtime environment according to the resource data of the target runtime environment, and schedule the task scheduling node and multiple task execution nodes to run in the target runtime environment.
[0037] In this embodiment, the device information of the electronic device includes, but is not limited to, the operating system information, processor information, hardware device information, and device type of the electronic device. The runtime environment creation node determines the target runtime environment among multiple runtime environments that adapts to the device information of the electronic device. In practical applications, Wasm RTE can be selected in scenarios with low computing power, while OCI RTE can be selected in scenarios with high computing power.
[0038] In this embodiment, after determining the target runtime environment that is compatible with the device information of the electronic device, the target runtime environment is created based on the resource data of the target runtime environment, and the task scheduling node and multiple task execution nodes are scheduled to run in the target runtime environment.
[0039] In this embodiment, the task scheduling node is responsible for scheduling video transcoding tasks, that is, deciding which task execution node the video transcoding task will be executed on. Specifically, the task scheduling node is used to receive video transcoding tasks sent by the application layer, and send confirmation requests to multiple task execution nodes. The confirmation requests are used to instruct the task execution nodes to confirm whether they have the capability to execute the video transcoding task; and to receive multiple confirmation messages returned by multiple task execution nodes in response to the confirmation requests, select a target task execution node from the multiple task execution nodes based on the multiple confirmation messages, and assign the video transcoding task to the target task execution node.
[0040] Specifically, after receiving the video transcoding task sent by the application layer, the task scheduling node requests each task execution node to confirm whether it has the ability to execute the video transcoding task, and decides which task execution node to execute the video transcoding task based on the confirmation information returned by each task execution node.
[0041] In this embodiment, the task execution node is used to respond to the confirmation request to confirm whether it has the ability to execute the video transcoding task, and to send confirmation information to the task scheduling node. The confirmation information is used to indicate whether it has the ability to execute the video transcoding task. When the task execution node is the target task execution node, the transcoding algorithm is run to execute the video transcoding task.
[0042] As an example, when a task execution node responds to a confirmation request to confirm whether it has the ability to execute a video transcoding task, it is specifically used to: respond to the confirmation request and confirm whether it has the ability to execute a video transcoding task based on the resource status information of the task execution node.
[0043] Specifically, resource status information includes, but is not limited to, the current computing resource usage, storage resource usage, or remaining bandwidth of the task execution node.
[0044] For example, the task execution node compares its current computing resource usage with a preset resource usage threshold. If the current computing resource usage is greater than the preset threshold, it confirms that the task execution node has insufficient available computing resources. If the current computing resource usage is less than or equal to the preset threshold, it confirms that the task execution node has sufficient available computing resources.
[0045] For example, the task execution node compares its current storage resource usage with a preset storage resource usage threshold. If the current storage resource usage is greater than the preset threshold, it confirms that the task execution node has insufficient available storage resources. If the current storage resource usage is less than or equal to the preset threshold, it confirms that the task execution node has sufficient available storage resources.
[0046] For example, the task execution node compares its current remaining bandwidth with a preset remaining bandwidth threshold. If the current remaining bandwidth is greater than the preset remaining bandwidth threshold, it confirms that the task execution node's current remaining bandwidth is insufficient. If the current remaining bandwidth is less than or equal to the preset remaining bandwidth threshold, it confirms that the task execution node's current remaining bandwidth is sufficient.
[0047] For example, if a task execution node determines that its available computing resources, available storage resources, or remaining bandwidth are insufficient, the task execution node determines that it does not have the capability to execute the video transcoding task. If a task execution node determines that its available computing resources, available storage resources, or remaining bandwidth are sufficient, the task execution node determines that it has the capability to execute the video transcoding task.
[0048] As another example, the confirmation request includes task information for the video transcoding task, which includes at least one of the following: task type, task priority, and task execution time. Accordingly, when the task execution node responds to the confirmation request to confirm whether it has the capability to execute the video transcoding task, it specifically performs the following: in response to the confirmation request, it confirms whether it has the capability to execute the video transcoding task based on the resource status information of the task execution node and the task information of the video transcoding task.
[0049] In this embodiment, task types are flexibly categorized as needed. For example, based on whether the video transcoding task needs to be executed on a scheduled basis, the task types are divided into scheduled tasks and non-scheduled tasks. As another example, based on the importance of the user submitting the video transcoding task, the task types are divided into important tasks and general tasks.
[0050] In this embodiment, task priority affects the execution order of video transcoding tasks. The higher the task priority, the higher the corresponding video transcoding task will be executed. Task priority can be flexibly set as needed. For example, according to the execution order from early to late, the task priorities from high to low are: high priority, medium priority, and low priority, etc.
[0051] In this embodiment, the task execution time of the video transcoding task refers to the expected time when the video transcoding task is to be executed. Of course, in practical applications, the video transcoding task can also be executed later than the task execution time, and there is no restriction on this.
[0052] In this embodiment, the task execution node can comprehensively analyze its own resource status information and the task information of the video transcoding task to confirm whether it has the ability to execute the video transcoding task.
[0053] In this embodiment, the task scheduling node selects a target task execution node from multiple task execution nodes based on the confirmation information returned by each task execution node, and assigns the video transcoding task to the target task execution node. The target task execution node then runs the video transcoding algorithm to perform the video transcoding task.
[0054] Specifically, the video transcoding algorithm is a general-purpose video transcoding algorithm that can be adapted to a wide variety of electronic devices, eliminating the need to develop video transcoding algorithms specifically for different electronic devices based on their device information.
[0055] In practical applications, the target task execution node can use any workflow execution mode to run the video transcoding algorithm and perform the video transcoding task. Arbitrary workflow execution modes include, but are not limited to, DAG (Directed Acyclic Graph) mode or StepByStep mode. In DAG mode, the steps in the workflow run concurrently, providing parallel execution capability; in StepByStep mode, the steps in the workflow are executed sequentially, providing serial execution capability.
[0056] In this embodiment, task execution nodes can select the desired workflow execution mode from multiple workflow execution modes as needed, improving the flexibility of task execution. For example, when the target task execution node executes a video transcoding task, it specifically performs the following: selecting a target workflow execution mode from multiple optional workflow execution modes, including DAG mode and StepByStep mode; and executing the video transcoding task according to the target workflow execution mode.
[0057] Further optionally, when the target task execution node selects a target workflow execution mode from multiple selectable workflow execution modes, it is specifically used to: determine the task difficulty level of the video transcoding task; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a simple task, then the StepByStep mode is selected as the target workflow execution mode; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a complex task, then the DAG mode is selected as the target workflow execution mode.
[0058] In this embodiment, the difficulty of the video transcoding task can be determined based on the amount of data in the video file to be transcoded, but it is not limited to this. For example, the amount of data in the video file is directly proportional to the difficulty of the task; the more data in the video file, the greater the difficulty of the task; the less data in the video file, the less difficult the task.
[0059] In this embodiment, if the difficulty level of the video transcoding task is greater than a preset difficulty level threshold, the video transcoding task can be considered a complex task. If the difficulty level of the video transcoding task is less than or equal to the preset difficulty level threshold, the video transcoding task can be considered a simple task.
[0060] Understandably, the Step-by-Step pattern ensures efficient processing of simple tasks, while the Directed Acyclic Graph (DAG) pattern ensures efficient processing of complex tasks.
[0061] The technical solution provided in this application adds a video transcoding device to an electronic device. This device provides a runtime environment adapted to the electronic device, allowing developers to create and deploy general-purpose video transcoding algorithms on a wide variety of electronic devices. This means video transcoding tasks are no longer limited to a few specific electronic devices but can be distributed across a diverse range of devices, improving scheduling flexibility and enabling the fulfillment of increasingly demanding video transcoding requirements.
[0062] Figure 2 A flowchart illustrating a video transcoding method provided in an embodiment of this application. See also... Figure 2 The method may include the following steps:
[0063] 201. Based on the device information of the electronic device, determine the target runtime environment that is compatible with the electronic device from multiple runtime environments.
[0064] 202. Create the target runtime environment in the electronic device based on the resource data of the target runtime environment.
[0065] 203. In response to the received video transcoding task, run the video transcoding algorithm in the target runtime environment to perform the video transcoding task.
[0066] In this embodiment, the device information of the electronic device includes, but is not limited to, the operating system information, processor information, hardware device information, and device type of the electronic device. First, a target runtime environment that matches the device information of the electronic device is determined from multiple runtime environments. Then, the target runtime environment is created based on the resource data of the target runtime environment. In practical applications, Wasm RTE can be selected in scenarios with low computing power, while OCIRTE can be selected in scenarios with high computing power.
[0067] When an electronic device receives a video transcoding task, it runs a video transcoding algorithm in the target runtime environment to perform the task. Specifically, the video transcoding algorithm is a general-purpose algorithm that can be adapted to a wide variety of electronic devices, eliminating the need to develop video transcoding algorithms specifically tailored to different electronic devices based on their device information.
[0068] In practical applications, any workflow execution mode can be used to run video transcoding algorithms to perform video transcoding tasks. Such workflow execution modes include, but are not limited to, DAG (Directed Acyclic Graph) mode or StepByStep mode.
[0069] In this embodiment, the system supports selecting the desired workflow execution mode from multiple workflow execution modes on demand, improving the flexibility of task execution. For example, one possible implementation of running a video transcoding algorithm in the target runtime environment to perform a video transcoding task is as follows: select a target workflow execution mode from multiple optional workflow execution modes, including DAG mode and StepByStep mode; and run the video transcoding algorithm in the target runtime environment according to the target workflow execution mode to perform the video transcoding task.
[0070] Further optionally, to improve the efficiency of video transcoding tasks, when selecting a target workflow execution mode from multiple available workflow execution modes, the task difficulty level of the video transcoding task can be determined; if the task difficulty level indicates that the video transcoding task is a simple task, then the StepByStep mode is selected as the target workflow execution mode; if the task difficulty level indicates that the video transcoding task is a complex task, then the DAG mode is selected as the target workflow execution mode.
[0071] In this embodiment, the difficulty of the video transcoding task can be determined based on the amount of data in the video file to be transcoded, but it is not limited to this. For example, the amount of data in the video file is directly proportional to the difficulty of the task; the more data in the video file, the greater the difficulty of the task; the less data in the video file, the less difficult the task.
[0072] In this embodiment, if the difficulty level of the video transcoding task is greater than a preset difficulty level threshold, the video transcoding task can be considered a complex task. If the difficulty level of the video transcoding task is less than or equal to the preset difficulty level threshold, the video transcoding task can be considered a simple task.
[0073] Understandably, the Step-by-Step pattern ensures efficient processing of simple tasks, while the Directed Acyclic Graph (DAG) pattern ensures efficient processing of complex tasks.
[0074] The technical solution provided in this application selects a runtime environment compatible with the electronic device from multiple runtime environments based on the device information of the electronic device, and creates the compatible runtime environment in the electronic device. This allows developers to develop general video transcoding algorithms and deploy them on a wide variety of electronic devices. Thus, video transcoding tasks are no longer limited to being assigned to a few types of electronic devices, but can be assigned to a wide variety of electronic devices, improving the scheduling flexibility of video transcoding tasks and providing the possibility of meeting increasingly demanding video transcoding requirements.
[0075] Figure 3 A flowchart illustrating another video transcoding method provided in this application embodiment. See also... Figure 3 The method may include the following steps:
[0076] 301. Based on the device information of the electronic device, determine the target runtime environment that is compatible with the electronic device from multiple runtime environments.
[0077] 302. Create the target runtime environment in the electronic device based on the resource data of the target runtime environment.
[0078] 303. Schedule multiple task execution nodes to the target runtime environment.
[0079] 304. In response to the received video transcoding task, select the target task execution node from multiple task execution nodes.
[0080] 305. Control the target task execution node to run the video transcoding algorithm to perform the video transcoding task.
[0081] For details regarding steps 301 and 302, please refer to steps 201 and 202 in the foregoing embodiments, which will not be repeated here.
[0082] In this embodiment, in order to improve the efficiency and reliability of the video transcoding task, multiple task execution nodes are deployed in the target runtime environment; and upon receiving the video transcoding task, the video transcoding algorithm is run on any target task execution node among the multiple task execution nodes to execute the video transcoding task.
[0083] In practical applications, any one of multiple task execution nodes can be selected as the target task execution node. Further optionally, to select a more suitable target task execution node and improve the efficiency and reliability of the video transcoding task, when selecting the target task execution node from multiple task execution nodes, confirmation requests can be sent to multiple task execution nodes. This allows the task execution nodes to respond to the confirmation requests and confirm whether they have the capability to execute the video transcoding task. The target task execution node is then selected from the multiple task execution nodes based on the confirmation information.
[0084] Specifically, upon receiving a video transcoding task, the system requests each task execution node to confirm whether it has the capability to execute the video transcoding task, and decides which task execution node to execute the video transcoding task based on the confirmation information returned by each task execution node.
[0085] As an example, when a task execution node responds to a confirmation request to confirm whether it has the ability to execute a video transcoding task, it specifically uses the following method: in response to the confirmation request, it confirms whether it has the ability to execute a video transcoding task based on the resource status information of the task execution node and the task information of the video transcoding task.
[0086] Specifically, resource status information includes, but is not limited to, the current computing resource usage, storage resource usage, or remaining bandwidth of the task execution node.
[0087] For example, the task execution node compares its current computing resource usage with a preset resource usage threshold. If the current computing resource usage is greater than the preset threshold, it confirms that the task execution node has insufficient available computing resources. If the current computing resource usage is less than or equal to the preset threshold, it confirms that the task execution node has sufficient available computing resources.
[0088] For example, the task execution node compares its current storage resource usage with a preset storage resource usage threshold. If the current storage resource usage is greater than the preset threshold, it confirms that the task execution node has insufficient available storage resources. If the current storage resource usage is less than or equal to the preset threshold, it confirms that the task execution node has sufficient available storage resources.
[0089] For example, the task execution node compares its current remaining bandwidth with a preset remaining bandwidth threshold. If the current remaining bandwidth is greater than the preset remaining bandwidth threshold, it confirms that the task execution node's current remaining bandwidth is insufficient. If the current remaining bandwidth is less than or equal to the preset remaining bandwidth threshold, it confirms that the task execution node's current remaining bandwidth is sufficient.
[0090] For example, if a task execution node determines that its available computing resources, available storage resources, or remaining bandwidth are insufficient, the task execution node determines that it does not have the capability to execute the video transcoding task. If a task execution node determines that its available computing resources, available storage resources, or remaining bandwidth are sufficient, the task execution node determines that it has the capability to execute the video transcoding task.
[0091] As another example, the confirmation request includes task information for the video transcoding task, which includes at least one of the following: task type, task priority, and task execution time. Accordingly, when the task execution node responds to the confirmation request to confirm whether it has the capability to execute the video transcoding task, it specifically performs the following: in response to the confirmation request, it confirms whether it has the capability to execute the video transcoding task based on the resource status information of the task execution node and the task information of the video transcoding task.
[0092] In this embodiment, task types are flexibly categorized as needed. For example, based on whether the video transcoding task needs to be executed on a scheduled basis, the task types are divided into scheduled tasks and non-scheduled tasks. As another example, based on the importance of the user submitting the video transcoding task, the task types are divided into important tasks and general tasks.
[0093] In this embodiment, task priority affects the execution order of video transcoding tasks. The higher the task priority, the higher the corresponding video transcoding task will be executed. Task priority can be flexibly set as needed. For example, according to the execution order from early to late, the task priorities from high to low are: high priority, medium priority, and low priority, etc.
[0094] In this embodiment, the task execution time of the video transcoding task refers to the expected time when the video transcoding task is to be executed. Of course, in practical applications, the video transcoding task can also be executed later than the task execution time, and there is no restriction on this.
[0095] In this embodiment, the task execution node can comprehensively analyze its own resource status information and the task information of the video transcoding task to confirm whether it has the ability to execute the video transcoding task.
[0096] In this embodiment, a target task execution node is selected from multiple task execution nodes based on the confirmation information returned by each task execution node, and the video transcoding task is assigned to the target task execution node. The target task execution node runs the video transcoding algorithm to perform the video transcoding task.
[0097] In practical applications, the target task execution node can use any workflow execution mode to run the video transcoding algorithm to perform the video transcoding task. Arbitrary workflow execution modes include, but are not limited to, DAG (Directed Acyclic Graph) mode or StepByStep (sequential execution) mode.
[0098] In this embodiment, task execution nodes can select the desired workflow execution mode from multiple workflow execution modes as needed, improving the flexibility of task execution. For example, when the target task execution node executes a video transcoding task, it specifically performs the following: selecting a target workflow execution mode from multiple optional workflow execution modes, including DAG mode and StepByStep mode; and executing the video transcoding task according to the target workflow execution mode.
[0099] Further optionally, when the target task execution node selects a target workflow execution mode from multiple selectable workflow execution modes, it is specifically used to: determine the task difficulty level of the video transcoding task; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a simple task, then the StepByStep mode is selected as the target workflow execution mode; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a complex task, then the DAG mode is selected as the target workflow execution mode.
[0100] In this embodiment, the difficulty of the video transcoding task can be determined based on the amount of data in the video file to be transcoded, but it is not limited to this. For example, the amount of data in the video file is directly proportional to the difficulty of the task; the more data in the video file, the greater the difficulty of the task; the less data in the video file, the less difficult the task.
[0101] In this embodiment, if the difficulty level of the video transcoding task is greater than a preset difficulty level threshold, the video transcoding task can be considered a complex task. If the difficulty level of the video transcoding task is less than or equal to the preset difficulty level threshold, the video transcoding task can be considered a simple task.
[0102] Understandably, the Step-by-Step pattern ensures efficient processing of simple tasks, while the Directed Acyclic Graph (DAG) pattern ensures efficient processing of complex tasks.
[0103] The technical solution provided in this application selects a runtime environment compatible with the electronic device from multiple runtime environments based on the device information of the electronic device, and creates the compatible runtime environment in the electronic device. This allows developers to develop general video transcoding algorithms and deploy them on a wide variety of electronic devices. Thus, video transcoding tasks are no longer limited to a few types of electronic devices but can be distributed across a wide variety of electronic devices, improving the scheduling flexibility of video transcoding tasks and providing the possibility to meet increasingly demanding video transcoding requirements. Furthermore, to improve the efficiency and reliability of video transcoding tasks, multiple task execution nodes are deployed in the target runtime environment; and upon receiving a video transcoding task, the video transcoding algorithm is run on any target task execution node among the multiple task execution nodes to execute the video transcoding task.
[0104] This application also provides a video transcoding apparatus. See [link to relevant documentation]. Figure 4The video transcoding device includes resource data for providing multiple runtime environments, a runtime environment creation node 10, a task scheduling node 20, and multiple task execution nodes 30. For a detailed description of each module of the video transcoding device, please refer to the relevant descriptions in the foregoing embodiments; they will not be repeated here.
[0105] Figure 5 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 5 As shown, the electronic device includes: a memory 51 and a processor 52;
[0106] Memory 51 is used to store computer programs and can be configured to store various other data to support operation on the computing platform. Examples of this data include instructions for any application or method operating on the computing platform, contact data, phone book data, messages, pictures, videos, etc.
[0107] The memory 51 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random-access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk, or optical disk.
[0108] The processor 52, coupled to the memory 51, is used to execute a computer program in the memory 51 for: determining a target runtime environment adapted to the electronic device from multiple runtime environments based on device information of the electronic device; creating the target runtime environment in the electronic device based on resource data of the target runtime environment; and running a video transcoding algorithm in the target runtime environment to perform the video transcoding task in response to a received video transcoding task.
[0109] Optionally, before receiving the video transcoding task, the processor 52 may schedule multiple task execution nodes to the target runtime environment. Accordingly, when the processor 52 runs a video transcoding algorithm in the target runtime environment to execute the video transcoding task in response to the received video transcoding task, it is specifically used to: select a target task execution node from multiple task execution nodes in response to the received video transcoding task; and control the target task execution node to run the video transcoding algorithm to execute the video transcoding task.
[0110] Further optionally, when the processor 52 selects a target task execution node from multiple task execution nodes, it is specifically configured to: send confirmation requests to multiple task execution nodes so that the task execution nodes respond to the confirmation requests to confirm whether they have the ability to perform video transcoding tasks; receive multiple confirmation messages returned by multiple task execution nodes in response to the confirmation requests, the confirmation messages indicating whether they have the ability to perform video transcoding tasks; and select a target task execution node from multiple task execution nodes based on the multiple confirmation messages.
[0111] Optionally, the confirmation request includes task information for the video transcoding task, including at least one of the following: task type, task priority, and task execution time. Accordingly, when the task execution node responds to the confirmation request to confirm whether it has the ability to execute the video transcoding task, it is specifically used to: in response to the confirmation request, confirm whether it has the ability to execute the video transcoding task based on the resource status information of the task execution node and the task information of the video transcoding task.
[0112] Further optionally, when the processor 52 runs the video transcoding algorithm in the target runtime environment to perform the video transcoding task, it is specifically used to: select a target workflow execution mode from a plurality of optional workflow execution modes, including a directed acyclic graph (DAG) mode and a sequential execution StepByStep mode; and run the video transcoding algorithm in the target runtime environment according to the target workflow execution mode to perform the video transcoding task.
[0113] Furthermore, such as Figure 5 As shown, the electronic device also includes other components such as a communication component 53, a display 54, a power supply component 55, and an audio component 56. Figure 5 The diagram only shows some components and does not mean that the electronic device includes only these components. Figure 5 The components shown. Additionally... Figure 5The components within the dashed box are optional, not mandatory, and their specific requirements depend on the product form of the electronic device. The electronic device in this embodiment can be a desktop computer, laptop computer, smartphone, or IoT (Internet of Things) device, or a server-side device such as a conventional server, cloud server, or server array. If the electronic device in this embodiment is a desktop computer, laptop computer, or smartphone, it may include... Figure 5 The components within the dashed box; if the electronic device in this embodiment is implemented as a conventional server, cloud server, or server array, etc., it may be omitted. Figure 5 The component within the dashed box.
[0114] For a detailed description of the implementation process of each action by the processor, please refer to the relevant descriptions in the foregoing method embodiments or device embodiments, which will not be repeated here.
[0115] Accordingly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed, can implement the various steps in the video transcoding method.
[0116] Accordingly, embodiments of this application also provide a computer program product, including a computer program / instructions, which, when executed by a processor, enable the processor to implement the various steps in the video transcoding method.
[0117] It should be noted that the execution subject of each step of the method provided in the above embodiments can be the same device, or the method can be executed by different devices. For example, the execution subject of steps 201 to 203 can be device A; or the execution subject of steps 201 and 202 can be device A, and the execution subject of step 203 can be device B; and so on.
[0118] Furthermore, in some of the processes described in the above embodiments and accompanying drawings, multiple operations appear in a specific order. However, it should be clearly understood that these operations may not be executed in the order they appear herein, or they may be executed in parallel. The operation numbers, such as 201, 202, etc., are merely used to distinguish different operations and do not represent any execution order. Additionally, these processes may include more or fewer operations, and these operations may be executed sequentially or in parallel. It should be noted that the descriptions such as "first" and "second" in this document are used to distinguish different messages, devices, modules, etc., and do not represent a sequential order, nor do they limit "first" and "second" to different types.
[0119] 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. Furthermore, the collection, use and processing of the relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation portals are provided for users to choose to authorize or refuse.
[0120] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-readable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0121] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0122] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0123] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0124] In a typical configuration, a computing device includes one or more processors (Central Processing Unit, CPU), input / output interfaces, network interfaces, and memory.
[0125] Memory may include non-persistent storage in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0126] Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can store information using any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change RAM (PRAM), static random-access memory (SRAM), dynamic random-access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape, magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device. As defined in this article, computer-readable media do not include transient media, such as modulated data signals and carrier waves.
[0127] It should also be noted that the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.
[0128] The above are merely embodiments of this application and are not intended to limit the scope of this application. Various modifications and variations can be made to this application by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the scope of the claims of this application.
Claims
1. A video transcoding apparatus, characterized by comprising: The video transcoding device is applied to an electronic device, is arranged between an application layer and an operating system layer of the electronic device, and comprises resource data of a plurality of runtime environments, a runtime environment creation node, a task scheduling node, and a plurality of task execution nodes; The runtime environment creation node is configured to determine a target runtime environment from the plurality of runtime environments that is adapted to device information of the electronic device, create the target runtime environment according to resource data of the target runtime environment, and schedule the task scheduling node and the plurality of task execution nodes to run in the target runtime environment; The task scheduling node is configured to receive a video transcoding task sent by the application layer, send a confirmation request to the plurality of task execution nodes, the confirmation request being used to indicate whether the task execution nodes have the ability to execute the video transcoding task, receive a plurality of confirmation information returned by the plurality of task execution nodes in response to the confirmation request, select a target task execution node from the plurality of task execution nodes according to the plurality of confirmation information, and assign the video transcoding task to the target task execution node; The task execution node is configured to respond to the confirmation request to indicate whether the task execution node has the ability to execute the video transcoding task, and send confirmation information to the task scheduling node, the confirmation information being used to indicate whether the task execution node has the ability to execute the video transcoding task; In a case where the task execution node is the target task execution node, a video transcoding algorithm is run to execute the video transcoding task.
2. The video transcoding apparatus of claim 1, wherein The confirmation request comprises task information of the video transcoding task, and the task information is at least one of a task type, a task priority, and a task execution time; Correspondingly, when the task execution node responds to the confirmation request to indicate whether the task execution node has the ability to execute the video transcoding task, the task execution node is specifically configured to: respond to the confirmation request, and indicate whether the task execution node has the ability to execute the video transcoding task according to resource state information of the task execution node and the task information of the video transcoding task.
3. The video transcoding apparatus of claim 1, wherein When the target task execution node runs the video transcoding algorithm to execute the video transcoding task, the target task execution node is specifically configured to: select a target workflow execution mode from a plurality of selectable workflow execution modes, the selectable workflow execution modes comprising a directed acyclic graph (DAG) mode and a StepByStep mode; run the video transcoding algorithm according to the target workflow execution mode to execute the video transcoding task.
4. The video transcoding apparatus of claim 3, wherein When the target task execution node selects the target workflow execution mode from the plurality of selectable workflow execution modes, the target task execution node is specifically configured to: determine a task difficulty level of the video transcoding task; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a simple task, select the StepByStep mode as the target workflow execution mode; if the task difficulty level of the video transcoding task indicates that the video transcoding task is a complex task, select the DAG mode as the target workflow execution mode.
5. The video transcoding apparatus according to any one of claims 1-4, characterized in that, the operating system in the operating system layer of the electronic device is any one of the following: Linux operating system, Windows operating system, MacOS operating system and Android operating system; the processor in the processor layer of the electronic device includes at least one of the following: X86 processor, ARM processor, RISC processor and MIPS processor; the hardware device in the hardware device layer of the electronic device includes at least one of the following: CPU, GPU, NPU and FPGA; and / or, the electronic device is a Web terminal.
6. A method of video transcoding, characterized by, including: determining a target runtime environment suitable for the electronic device from a plurality of runtime environments according to device information of the electronic device; creating the target runtime environment in the electronic device according to resource data of the target runtime environment; scheduling a plurality of task execution nodes to the target runtime environment; selecting a target task execution node from the plurality of task execution nodes in response to a received video transcoding task based on a plurality of confirmation information returned by the plurality of task execution nodes in response to a confirmation request, the confirmation information being used to indicate whether the task execution node has the ability to execute the video transcoding task; controlling the target task execution node to run a video transcoding algorithm to execute the video transcoding task.
7. The method of claim 6, wherein, Selecting a target task execution node from the plurality of task execution nodes includes: sending a confirmation request to the plurality of task execution nodes to make the task execution node confirm whether it has the ability to execute the video transcoding task in response to the confirmation request; receiving a plurality of confirmation information returned by the plurality of task execution nodes in response to the confirmation request, the confirmation information being used to indicate whether the task execution node has the ability to execute the video transcoding task; selecting the target task execution node from the plurality of task execution nodes according to the plurality of confirmation information.
8. The method of claim 7, wherein, The confirmation request includes task information of the video transcoding task, and the task information includes at least one of the following: task type, task priority and task execution time; Accordingly, when the task execution node confirms whether it has the ability to execute the video transcoding task in response to the confirmation request, it is specifically used for: confirming whether it has the ability to execute the video transcoding task according to the resource state information of the task execution node and the task information of the video transcoding task in response to the confirmation request.
9. The method of claim 6, wherein, Controlling the target task execution node to run a video transcoding algorithm to execute the video transcoding task includes: selecting a target workflow execution mode from a plurality of selectable workflow execution modes, the selectable workflow execution modes including a directed acyclic graph (DAG) mode and a StepByStep mode; controlling the target task execution node to run the video transcoding algorithm to execute the video transcoding task according to the target workflow execution mode.
10. An electronic device, comprising: The video transcoding apparatus is arranged between the application layer and the operating system layer of the electronic device.
11. An electronic device, comprising: including: a memory and a processor; the memory is used to store a computer program; The processor is coupled to the memory for executing the computer program for performing the steps of the method of any one of claims 6-9.
12. A computer readable storage medium storing a computer program, characterized in that, The computer program, when executed by a processor, causes the processor to be enabled to implement the steps of the method of any one of claims 6-9.
Citation Information
Patent Citations
Resource allocation method, device and apparatus for panoramic video transcoding
CN109213593A