A video processing method, apparatus and electronic device
By dividing operation categories in video processing and determining the processing order based on priority, and generating processing instructions, the problem of low video processing efficiency is solved, and a more efficient video operation process is achieved.
Patent Information
- Application Number
- CN202210775022.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-01
- Publication Date
- 2025-07-18
- Estimated Expiration
- 2042-07-01
AI Technical Summary
In the prior art, video processing efficiency is low, making it difficult to meet users' demand for short videos and video animations and other video products with large amounts of information.
By determining the initial parameters of the video to be processed and the parameter changes of the target parameters, dividing operation categories, and determining the processing order based on the priority of the operation categories, generating processing instructions, instructing the video processing tool to perform operations in sequence, improving video processing efficiency.
It improves video processing speed and efficiency, reduces the number of IO and encoding times of video processing, and optimizes the video operation process.
Smart Images

Figure CN115297223B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of video processing, and particularly to a video processing method, apparatus, and electronic device. Background Art
[0002] Currently, with the continuous development of Internet technology, more and more users choose to watch various video products through the Internet. At the same time, users have put forward higher requirements for the duration and information volume of video products.
[0003] Video products such as short videos and video gifs are loved by more and more users due to their short duration and large information volume. Currently, video products such as short videos and video gifs are made by processing one or more videos through various operations. Therefore, the efficiency of video processing affects the production efficiency of video products such as short videos and video gifs.
[0004] In related technologies, the method for processing a video is as follows: determining the operations to be performed on the initial video to be processed, and then performing IO (Input / Output), decoding, and video stream processing operations on the video to be processed, and encoding the processed video stream to finally obtain a video processing result of a target specification, such as a video, a picture, etc.
[0005] As Figure 1 shown, the initial video can be decoded first to obtain a video stream, and then three operations of stretching, cropping, and adding watermarks are performed on the video stream, and the processed video stream is encoded, thereby obtaining a video processing result of a target specification.
[0006] Based on this, there is an urgent need for a video operation method to improve the efficiency of video processing. Summary of the Invention
[0007] The purpose of the embodiments of the present invention is to provide a video processing method, apparatus, and electronic device to improve the efficiency of video processing. The specific technical solutions are as follows:
[0008] In the first aspect of the present invention, a video processing method is first provided, and the method includes:
[0009] Determining a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed;
[0010] Determining the operation category to which each target operation belongs in a preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation;
[0011] Determining the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0012] Generate processing instructions for the multiple target operations based on the processing order; wherein, the processing instructions are used to instruct to decode the video to be processed, perform the multiple target operations on the decoded video stream according to the processing order, and encode the video stream after the operations.
[0013] Send the processing instructions to a video processing tool so that the video processing tool executes the processing instructions on the video to be processed to obtain a video processing result.
[0014] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the multiple target operations include: at least one target operation for each video to be processed;
[0015] The determining the processing order of the multiple target operations based on the priorities of the operation categories to which each target operation belongs includes:
[0016] For each video to be processed, if the number of target operations for the video to be processed is multiple, determine the processing sub-order of each target operation for the video to be processed based on the priorities of the operation categories to which each target operation for the video to be processed belongs;
[0017] Determine the processing order of the multiple target operations based on the respective processing sub-orders.
[0018] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the multiple target operations include: a first sequence of target operations for each video to be processed, a merging operation for the multiple videos to be processed, and a second sequence of target operations for the merged video;
[0019] The processing instructions are used to instruct to decode each video to be processed, perform the first sequence of target operations for each video to be processed on the video stream decoded from each video to be processed in parallel; merge the video streams after the operations, and perform the second sequence of target operations on the merged video stream, and encode the video stream after the execution.
[0020] Optionally, in a specific implementation manner, the step of determining the processing order of the multiple target operations based on the priorities of the operation categories to which each target operation belongs includes:
[0021] Determine the processing order of each target operation belonging to different operation categories in sequence according to the order of priorities from high to low;
[0022] For multiple target operations belonging to the same operation category, based on the operation parameters of each target operation, determine the sub-priority of the target operation in the operation category, and determine the processing order of each target operation belonging to the operation category in descending order of sub-priority.
[0023] Optionally, in a specific implementation manner, the preset operation category includes at least two of: the first type of operation, the second type of operation, the third type of operation, and the fourth type of operation;
[0024] Among them, the first type of operation includes: operations that reduce the amount of video stream data and affect the video processing speed after the operation;
[0025] The second type of operation includes: operations that do not affect the amount of video stream data;
[0026] The third type of operation includes: operations that increase the amount of video stream data and affect the video processing speed after the operation;
[0027] The fourth type of operation includes: operations that affect the amount of video stream data and do not affect the video processing speed after the operation;
[0028] The category priority of the first type of operation is higher than the category priority of the second type of operation, the category priority of the second type of operation is higher than the category priority of the third type of operation, and the relationship between the category priority of the fourth type of operation and the category priorities of the first type of operation, the second type of operation, and the third type of operation is set according to preset conditions.
[0029] In the second aspect of the implementation of the present invention, a video processing method is further provided, and the method includes:
[0030] Based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target static image, determine multiple target operations; where the multiple target operations include: frame extraction and frame operations after frame extraction, and the frame operations include at least one of: cropping, stretching, scaling, adding watermarks, and color adjustment;
[0031] Based on the method described in any one of the first aspects, determine the operation category to which each target operation belongs in the preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs;
[0032] Based on the processing order, generate a processing instruction for the multiple target operations;
[0033] Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, performs the multiple target operations on the decoded video stream in the processing order, and encodes the video stream after the operations to obtain the target still image.
[0034] In a third aspect of the implementation of the present invention, a video processing method is further provided, and the method includes:
[0035] Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target dynamic image; wherein, the target operations include multiple ones among frame dropping, merging, cropping, color correction, and scaling.
[0036] Based on any of the methods in the first aspect, determine the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs.
[0037] Generate a processing instruction for the multiple target operations based on the processing order.
[0038] Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, performs the multiple target operations on the decoded video stream in the processing order, and encodes the video stream after the operations to obtain the target dynamic image.
[0039] In a fourth aspect of the implementation of the present invention, a video processing method is further provided, and the method includes:
[0040] Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video; wherein, the target operations include multiple ones among frame dropping, merging, cropping, color correction, and scaling.
[0041] Based on any of the methods in the first aspect, determine the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs.
[0042] Generate a processing instruction for the multiple target operations based on the processing order.
[0043] Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, performs the multiple target operations on the decoded video stream in the processing order, and encodes the video stream after the operations to obtain the target video.
[0044] In the fifth aspect of the implementation of the present invention, a video processing device is further provided, and the device includes:
[0045] A first operation determination module, configured to determine a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed;
[0046] A first category determination module, configured to determine the operation category to which each target operation belongs in a preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation;
[0047] A first order determination module, configured to determine the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0048] A first instruction generation module, configured to generate a processing instruction for the plurality of target operations based on the processing order; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the plurality of target operations on the decoded video stream according to the processing order, and encode the video stream after the operation;
[0049] A first execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result.
[0050] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the plurality of target operations include: at least one target operation for each video to be processed;
[0051] The first order determination module is specifically configured to:
[0052] For each video to be processed, if the number of target operations for the video to be processed is multiple, then based on the priority of the operation category to which each target operation for the video to be processed belongs, determine the processing sub-order of each target operation for the video to be processed;
[0053] Based on each processing sub-order, determine the processing order of the plurality of target operations.
[0054] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the plurality of target operations include: a first sequence of target operations for each video to be processed, a merging operation for the plurality of videos to be processed, and a second sequence of target operations for the merged video;
[0055] The processing instruction is used to indicate decoding each video to be processed, and parallelly executing a first sequence of target operations for the video stream after decoding each video to be processed; merging the video streams after the operations, and executing the second sequence of target operations for the merged video stream, and encoding the video stream after the execution.
[0056] Optionally, in a specific implementation manner, the first sequence determination module is specifically configured to:
[0057] Determine the processing order of each target operation belonging to different operation categories in sequence according to the order from high to low priority;
[0058] For multiple target operations belonging to the same operation category, based on the operation parameters of each target operation, determine the sub-priority of the target operation in the operation category, and determine the processing order of each target operation belonging to the operation category according to the order from high to low sub-priority.
[0059] Optionally, in a specific implementation manner, the preset operation categories include at least two of: the first type of operation, the second type of operation, the third type of operation, and the fourth type of operation;
[0060] Among them, the first type of operation includes: operations that reduce the amount of video stream data and affect the video processing speed after the operation;
[0061] The second type of operation includes: operations that do not affect the amount of video stream data;
[0062] The third type of operation includes: operations that increase the amount of video stream data and affect the video processing speed after the operation;
[0063] The fourth type of operation includes: operations that affect the amount of video stream data and do not affect the video processing speed after the operation;
[0064] The category priority of the first type of operation is higher than the category priority of the second type of operation, the category priority of the second type of operation is higher than the category priority of the third type of operation, and the relationship between the category priority of the fourth type of operation and the category priorities of the first type of operation, the second type of operation, and the third type of operation is set according to preset conditions.
[0065] In a sixth aspect of the implementation of the present invention, there is also provided a video processing device, and the device includes:
[0066] A second operation determination module, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target static image; wherein, the plurality of target operations include: frame extraction and frame operations after frame extraction, and the frame operations include at least one of: cropping, stretching, watermark adding, and color adjustment
[0067] A second sequence determination module, configured to determine, based on the device according to any one of the fifth aspects, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0068] A second instruction generation module, configured to generate a processing instruction regarding the plurality of target operations based on the processing sequence;
[0069] A second execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream according to the processing sequence, and encodes the video stream after the operations to obtain the target static image.
[0070] In a seventh aspect of the implementation of the present invention, there is also provided a video processing device, the device includes:
[0071] A third operation determination module, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target dynamic image; wherein, the target operations include multiple ones of: frame rate reduction, merging, cropping, color adjustment, and scaling;
[0072] A third sequence determination module, configured to determine, based on the device according to any one of the fifth aspects, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0073] A third instruction generation module, configured to generate a processing instruction regarding the plurality of target operations based on the processing sequence;
[0074] A third execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream according to the processing sequence, and encodes the video stream after the operations to obtain the target dynamic image.
[0075] In an eighth aspect of the implementation of the present invention, there is also provided a video processing device, the device includes:
[0076] A fourth operation determination module, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target video; wherein, the target operations include multiple ones of frame dropping, merging, cropping, color grading, and scaling;
[0077] A fourth sequence determination module, configured to determine, based on the device according to any one of the fifth aspects, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0078] A fourth instruction generation module, configured to generate a processing instruction regarding the plurality of target operations based on the processing sequence;
[0079] A fourth execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream according to the processing sequence, and encodes the video stream after the operation to obtain the target video.
[0080] In a ninth aspect of the implementation of the present invention, there is also provided an electronic device, including a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus;
[0081] The memory is used to store a computer program;
[0082] The processor is configured to implement the video processing method according to any one of the above when executing the program stored on the memory.
[0083] In yet another aspect of the implementation of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the video processing method according to any one of the above is implemented.
[0084] In yet another aspect of the implementation of the present invention, there is also provided a computer program product containing instructions, which when running on a computer, causes the computer to execute the video processing method according to any one of the above.
[0085] Advantageous effects of the embodiments of the present invention:
[0086] As can be seen above, when applying the solution provided by the embodiments of the present invention to process a video to be processed, multiple target operations can be determined first based on the parameter change amount between the initial parameters and the target parameters of the video to be processed; then, the operation category to which each target operation belongs in the preset operation categories can be determined; wherein, the preset operation categories are divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation; thereafter, based on the priority of the operation category to which each target operation belongs, the processing order of the multiple target operations can be determined; in this way, based on the processing order, a processing instruction for the multiple target operations can be generated; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the multiple target operations on the decoded video stream in accordance with the processing order, and encode the video stream after the operation; furthermore, the processing instruction is sent to a video processing tool so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result.
[0087] Based on this, when applying the solution provided by the embodiments of the present invention, after determining multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the processing order of the multiple target operations can be determined based on the operation category to which each determined target operation belongs and based on the priority of the operation category. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool encapsulates and executes the multiple target operations in one stream processing in accordance with the above processing order to obtain a video processing result. In this way, the video to be processed is processed according to the processing order obtained based on the priority of the operation category, which improves the video processing speed and thus improves the video processing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0088] In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art.
[0089] Figure 1 It is a schematic diagram of a specific example of a video processing method in the prior art;
[0090] Figure 2 It is a schematic flowchart of a video processing method provided by an embodiment of the present invention;
[0091] Figure 3 It is a schematic diagram of a specific example of S203 provided by an embodiment of the present invention;
[0092] Figure 4 It is a schematic diagram of a specific example of S205 provided by an embodiment of the present invention;
[0093] Figure 5 It is a schematic diagram of a specific example of determining the sub-priorities corresponding to each target operation provided by an embodiment of the present invention;
[0094] Figure 6 A structural schematic diagram of a specific example of a video processing method provided by an embodiment of the present invention;
[0095] Figure 7 A flowchart of another video processing method provided by an embodiment of the present invention;
[0096] Figure 8 A flowchart of yet another video processing method provided by an embodiment of the present invention;
[0097] Figure 9 A flowchart of yet another video processing method provided by an embodiment of the present invention;
[0098] Figure 10 A structural schematic diagram of a device for a video processing method provided by an embodiment of the present invention;
[0099] Figure 11 A structural schematic diagram of a device for another video processing method provided by an embodiment of the present invention;
[0100] Figure 12 A structural schematic diagram of a device for another video processing method provided by an embodiment of the present invention;
[0101] Figure 13 A structural schematic diagram of a device for another video processing method provided by an embodiment of the present invention;
[0102] Figure 14 A structural schematic diagram of an electronic device provided by an embodiment of the present invention. Detailed implementation manners
[0103] Next, the technical solutions in the embodiments of the present invention will be described in conjunction with the accompanying drawings in the embodiments of the present invention.
[0104] In the related art, the method for processing a video is as follows: determine the operations to be performed on the initial video to be processed. After that, perform IO, decoding, and video stream processing operations on the video to be processed, and encode the processed video stream to finally obtain a video processing result of a target specification, such as a video, a picture, etc.
[0105] As Figure 1 shown, the initial video can be decoded first to obtain a video stream. After that, the video stream is sequentially subjected to three operations of stretching, cropping, and adding a watermark, and the processed video stream is encoded, thereby obtaining a video processing result of a target specification.
[0106] Based on this, there is an urgent need for a video operation method to improve the efficiency of video processing.
[0107] To solve the above technical problems, an embodiment of the present invention provides a video processing method.
[0108] This method can be applied to various application scenarios that require video processing. For example, a video can be processed to obtain audio, animated images, or static images; several videos can also be processed to obtain a short video; or a video can be processed to shorten its duration, etc.
[0109] At the same time, this method can be applied to various electronic devices such as mobile phones, laptops, and desktop computers. Among them, an independent application software for executing this method can be installed in various electronic devices, or a functional module for executing this method can be added to the functional modules of the electronic device. Thus, the above-mentioned application software and / or functional module can execute this method to generate the above-mentioned processing instructions. For the sake of convenience, the above-mentioned application software and / or functional module are simply referred to as instruction generation tools, and can also be called command generators. To distinguish from the subsequent video processing tools, in the following, the execution entity of a video processing method provided by an embodiment of the present invention is simply referred to as an instruction generation tool.
[0110] In addition, after generating the above-mentioned processing instructions, the above-mentioned processing instructions can be executed by various video processing tools with video processing functions, thereby completing the processing of the video to be processed and obtaining a video processing result with the target specifications.
[0111] Among them, the video processing tool can be application software installed in various electronic devices such as mobile phones, laptops, desktop computers, and servers. For example, ffmpeg (Fast Forward Mpeg), and the above-mentioned server can be a local server or a cloud server. The video processing tool can also be a functional module in the functional modules of various electronic devices such as mobile phones, laptops, and desktop computers for executing the above-mentioned processing instructions. And the video processing tool can also be called a command executor.
[0112] Moreover, the above-mentioned instruction generation tool and video processing tool can be located in the same electronic device or in different electronic devices.
[0113] Based on this, an embodiment of the present invention does not limit the application scenario and execution entity of this method.
[0114] A video processing method provided by an embodiment of the present invention may include the following steps:
[0115] Determine a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed;
[0116] Determine the operation category to which each target operation belongs in the preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation;
[0117] Determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs;
[0118] Generate a processing instruction for the multiple target operations based on the processing order; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the multiple target operations on the decoded video stream according to the processing order, and encode the video stream after the operation;
[0119] Send the processing instruction to a video processing tool, so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result.
[0120] As can be seen above, when applying the solution provided by the embodiment of the present invention to process a video to be processed, multiple target operations can be first determined based on the parameter change amount between the initial parameters and the target parameters of the video to be processed; then, determine the operation category to which each target operation belongs in the preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation; after that, determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs; in this way, a processing instruction for the multiple target operations can be generated based on the processing order; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the multiple target operations on the decoded video stream according to the processing order, and encode the video stream after the operation; furthermore, send the processing instruction to a video processing tool, so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result.
[0121] Based on this, when applying the solution provided by the embodiment of the present invention, after determining multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the operation category to which each determined target operation belongs can be based on, and the processing order of the multiple target operations can be determined based on the priority of the operation category. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool encapsulates and executes the multiple target operations in a single stream processing according to the above processing order to obtain a video processing result. In this way, the video to be processed is processed according to the processing order obtained based on the priority of the operation category, which improves the video processing speed, and further improves the video processing efficiency.
[0122] Next, a video processing method provided by an embodiment of the present application will be specifically described with reference to the accompanying drawings.
[0123] Figure 2 The flowchart of a video processing method provided by an embodiment of the present invention is shown as follows Figure 2 As shown, the method may include the following steps S201 - S205.
[0124] S201: Determine a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed;
[0125] Before processing the video to be processed, first, the staff determines, according to actual needs, the video product obtained after processing the video to be processed and the parameters of the video product. For example, it is desired to process the video to be processed to obtain an animated image with a frame rate of 12, a width and height of 480 * 270, and a contrast of 1.05.
[0126] In this way, the desired video product can be used as the target video, and the parameters of the target video can be used as the target parameters.
[0127] Furthermore, the instruction generation tool can determine the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video. In this way, based on the above parameter change amount, the instruction generation tool can determine a plurality of target operations that need to be performed on the above video to be processed.
[0128] Among them, the instruction generation tool can obtain the initial parameters of the video to be processed and the target parameters of the target video, and then calculate the parameter change amount between the initial parameters and the target parameters; the instruction generation tool can also directly obtain the above parameter change amount, that is, after the staff determines the above target parameters, calculate the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video, and input the parameter change amount to the instruction generation tool.
[0129] Moreover, the above - mentioned plurality of target operations may include operations of the same type or operations of different types. For example, the target operations include adding watermarks with different operation parameters twice. Another example is that the target operations include merging, cropping, adding watermarks, and color correction. These are all reasonable.
[0130] In the embodiments of the present invention, the specific acquisition method of the parameter change amount and the specific quantity and type of the target operations are not limited.
[0131] S202: Determine the operation category to which each target operation belongs in the preset operation category;
[0132] Among them, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation;
[0133] In this specific implementation, since the data volume of the video stream can affect the video processing speed, and the smaller the data volume of the video stream, the faster the video processing speed. That is to say, if the video stream decreases after performing an operation, the video processing speed after that operation can increase accordingly; if the video stream increases after performing an operation, the video processing speed after that operation can decrease accordingly.
[0134] Based on this, multiple operations can be pre-divided into multiple categories according to the influence of each operation on the video stream data volume and the video processing speed after the operation, obtaining multiple preset operation categories. For example, multiple operations can be divided into three operation categories, obtaining three preset operation categories, namely the first type of operation, the second type of operation, and the third type of operation.
[0135] In this way, after determining multiple target operations, for each target operation, the operation category to which the target operation belongs in the preset operation categories can be determined.
[0136] Exemplarily, multiple operations can be pre-divided into three categories, obtaining three preset operation categories, and obtaining the corresponding relationship between various operations and operation categories. In this way, after determining that multiple target operations include cropping, scaling, color correction, and stretching, in the above corresponding relationship, the operation category to which each target operation belongs in the preset operation categories can be determined respectively.
[0137] Table 1 shows the corresponding relationship between each target operation and the operation category. Among them, cropping belongs to the first type of operation in the preset operation categories, scaling belongs to the first type of operation in the preset operation categories, color correction belongs to the second type of operation in the preset operation categories, and stretching belongs to the third type of operation in the preset operation categories.
[0138] Table 1
[0139] Operation Operation category Cropping First type of operation Scaling First type of operation Color adjustment Second type of operation Stretching Third type of operation
[0140] Among them, each operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation. For example, it can be divided according to how much the operation reduces the video stream data volume and improves the video processing speed after the operation, or it can be divided according to how much the operation increases the video stream data volume and reduces the video processing speed after the operation; at the same time, the number of divided operation categories can be set according to the requirements of the actual situation. In this regard, the embodiments of the present invention do not limit the specific division method of the operation categories.
[0141] Optionally, in a specific implementation, the above preset operation categories may include at least two of the first type of operation, the second type of operation, the third type of operation, and the fourth type of operation;
[0142] Among them, the first type of operations includes operations that reduce the amount of video stream data and affect the video processing speed after the operation;
[0143] The second type of operations includes operations that do not affect the amount of video stream data;
[0144] The third type of operations includes operations that increase the amount of video stream data and affect the video processing speed after the operation;
[0145] The fourth type of operations includes operations that affect the amount of video stream data and do not affect the video processing speed after the operation;
[0146] Moreover, the category priority of the first type of operations is higher than that of the second type of operations, the category priority of the second type of operations is higher than that of the third type of operations, and the relationship between the category priority of the fourth type of operations and the category priorities of the first type of operations, the second type of operations, and the third type of operations is set according to preset conditions.
[0147] In this specific implementation, the operations can be classified into four types according to their impacts on the video data volume and the video processing speed after the operation, namely the first type of operations, the second type of operations, the third type of operations, and the fourth type of operations.
[0148] Among them, the conditions that the operations in the first type of operations need to meet include that after the operation is executed, the amount of video stream data decreases, and the video processing speed increases accordingly. For example: frame extraction, cropping, frame rate reduction, scaling, etc.
[0149] The conditions that the operations in the second type of operations need to meet include that after the operation is executed, the amount of video stream data is not affected, neither increasing nor decreasing. For example: adding watermarks, color correction, etc.
[0150] The conditions that the operations in the third type of operations need to meet include that after the operation is executed, the amount of video stream data increases, and the video processing speed also decreases accordingly. For example: stretching, etc.
[0151] The conditions that the operations in the fourth type of operations need to meet include that after the operation is executed, the amount of video stream data is affected, which may increase or decrease, and the video processing speed does not change. For example: merging, etc.
[0152] After being classified into four types of operation categories, the category priorities of the above four types of operation categories are determined as follows: the category priority of the first type of operations is higher than that of the second type of operations, the category priority of the second type of operations is higher than that of the third type of operations, and moreover, the relationship between the category priority of the fourth type of operations and the category priorities of the first type of operations, the second type of operations, and the third type of operations is set according to preset conditions.
[0153] Among them, the above preset conditions can be that the category priority of the fourth type of operation is higher than the category priorities of the first type of operation, the second type of operation, and the third type of operation, or the category priority of the fourth type of operation is lower than at least one of the category priorities of the first type of operation, the second type of operation, and the third type of operation. Both are reasonable.
[0154] That is to say, the relationship between the category priority of the fourth type of operation and the category priorities of the first type of operation, the second type of operation, and the third type of operation can be set according to actual needs.
[0155] S203: Determine the processing order of multiple target operations based on the priority of the operation category to which each target operation belongs;
[0156] For each target operation, after determining the operation category of the target operation in the preset operation category, the priorities of the operation categories to which each target operation belongs can be used to sort the multiple target operations to determine the processing order of the multiple target operations.
[0157] That is to say, after determining the operation category of the target operation in the preset operation category, the priority of the operation category to which the target operation belongs can be determined as the priority corresponding to the target operation. In this way, for each target operation, the priority corresponding to the target operation is the priority of the operation category to which it belongs. For example, adding a watermark belongs to the second type of operation, and the category priority of the second type of operation is the second priority, then the priority corresponding to adding a watermark is the second priority.
[0158] Furthermore, based on the priority corresponding to each target operation, the processing order of the multiple target operations can be sorted to determine the processing order of the multiple target operations.
[0159] For each target operation, after determining the operation category to which the target operation belongs, the priority corresponding to the operation category to which the target operation belongs can be determined according to the correspondence between the operation, the operation category, and the priority, and the priority corresponding to the operation category to which the target operation belongs can be used as the priority corresponding to the target operation.
[0160] Exemplarily, Table 2 shows a partial correspondence between the operation, the operation category, and the priority.
[0161] Table 2
[0162] Operation Operation category Category priority Cropping First type of operation First priority Scaling First type of operation First priority Watermarking Second type of operation Second priority Stretching Third type of operation Third priority
[0163] Among them, the so-called priority is used to represent the execution order of each target operation. And for each target operation, the higher the priority corresponding to the target operation, the earlier the target operation is executed. That is, the execution order of the target operation with a higher corresponding priority is before the execution order of the target operation with a lower corresponding priority.
[0164] Furthermore, after determining the priority of each target operation, the processing order of the above-mentioned multiple target operations can be sorted according to the priority corresponding to each target operation. For each target operation, the higher the priority corresponding to the target operation, the earlier the execution order.
[0165] That is to say, the processing order of multiple target operations is determined according to the order of the priorities corresponding to each target operation from high to low.
[0166] Exemplarily, the multiple target operations include: cropping, stretching, and color adjustment. And the priority corresponding to cropping is higher than the priority corresponding to color adjustment, and the priority corresponding to color adjustment is higher than the priority corresponding to stretching. Then the processing order of the above-mentioned multiple target operations is cropping, color adjustment, and stretching in sequence.
[0167] Exemplarily, in order to facilitate understanding of the specific implementation method of determining the processing order of multiple target operations based on the priority of each target operation belonging to an operation category, hereinafter, in combination with Figure 3 Specific illustration will be given.
[0168] As Figure 3 shown, based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, five target operations are determined. Among them, two target operations belong to the first type of operation, and the two target operations belonging to the first type of operation are respectively denoted as type-one operation 1 and type-one operation 2; two target operations belong to the second type of operation, and the two target operations belonging to the second type of operation are respectively denoted as type-two operation 1 and type-two operation 2; one operation belongs to the third type of operation, denoted as type-three operation. Among them, the priority of the first type of operation is higher than that of the second type of operation and the third type of operation, and the priority of the second type of operation is higher than that of the third type of operation.
[0169] In this way, based on the priority of each target operation belonging to an operation category, the processing order of each target operation can be determined, that is, the processing order of the five target operations is sorted. Type-one operation 1 and type-one operation 2 are executed first, type-two operation 1 and type-two operation 2 are executed later, and type-three operation is executed last. Then the processing order of the five target operations is type-one operation 1, type-one operation 2, type-two operation 1, type-two operation 2, and type-three operation in sequence.
[0170] Among them, Figure 3The area of the square where each target operation is located represents the amount of video stream data when the operation is executed. That is to say, executing a type of operation 1 and a type of operation 2 can reduce the amount of video stream data, executing a type of operation 1 and a type of operation 2 does not affect the amount of video stream data, and executing a type of operation 3 will increase the amount of video stream data. Thus, by sequentially executing the above five target operations in the stream processing according to the above processing order, the amount of video stream data can first decrease and then increase.
[0171] S204: Generate a processing instruction for multiple target operations based on the processing order; wherein, the processing instruction is used to indicate decoding the video to be processed, executing multiple target operations on the decoded video stream according to the processing order, and encoding the video stream after the operation.
[0172] After determining the processing order of the above multiple target operations, the instruction generation tool can generate a processing instruction for the above multiple target operations, and this processing instruction is used to indicate that the video processing tool decodes the input video to be processed and processes the decoded video stream. During the process of processing the video stream, the above multiple target operations are encapsulated together and executed according to the above processing order.
[0173] That is to say, during the execution of the above processing instruction, the video to be processed can be decoded first. Furthermore, the above multiple target operations are executed on the decoded video stream according to the above processing order. After that, the processed video stream is encoded to obtain a video processing result of the target specification.
[0174] In this way, the above multiple target operations can be executed in the above processing order during one video stream processing, that is, the multiple target operations are encapsulated together and executed according to the above processing order. Thus, a video processing result of the target specification can be obtained by performing one IO, one decoding, and one encoding on the video to be processed, without the need for multiple IOs, multiple decodings, and multiple encodings.
[0175] S205: Send the processing instruction to the video processing tool so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result.
[0176] Send the above processing instruction to the video processing tool so that the video processing tool executes the processing instruction on the device to be processed to obtain a video processing result.
[0177] After generating a processing instruction, the processing instruction is sent to a video processing tool, so that after receiving the above processing instruction, the video processing tool processes the input video to be processed, that is, the video processing tool decodes the video to be processed, and executes the above-mentioned multiple target operations on the decoded video stream in the above-mentioned processing order, and then encodes the processed video stream to obtain a video processing result that meets the target parameters.
[0178] Exemplarily, to facilitate understanding of the specific implementation manner of the above S205, hereinafter, in combination with Figure 4 specifically illustrate.
[0179] As Figure 4 shown, in the figure, ffmpeg is a video processing tool, and the multiple target operations include: cropping, scaling, and watermarking. The ffmpeg command is a processing instruction generated by the instruction generation tool for the above-mentioned multiple target operations. This ffmpeg command is used to instruct ffmpeg to decode the video to be processed, execute the above-mentioned cropping, scaling, and watermarking operations on the decoded video stream, and encode the processed video stream. In this way, after receiving the above ffmpeg command, ffmpeg can decode the video to be processed, and encapsulate the above-mentioned cropping, scaling, and watermarking operations in a single video stream processing through the filter function of ffmpeg. In this way, the above-mentioned cropping, scaling, and watermarking operations can be executed serially when processing the decoded video stream. Then, the processed video stream is encoded to obtain the target video processing result.
[0180] Optionally, when the above instruction generation tool and the video processing tool are located in the same electronic device, the above video to be processed can be a video pre-stored in the electronic device, and the above processing instruction can carry an identifier of the video to be processed. Thus, after receiving the above video to be processed, the video processing tool can determine the video to be processed according to the identifier, and then execute the above processing instruction for the video to be processed.
[0181] Optionally, when the above instruction generation tool and the video processing tool are located in the same electronic device, the above video to be processed can be a video stored in other electronic devices, and the above processing instruction can carry an identifier of the video to be processed. Thus, after receiving the above video to be processed, the video processing tool can obtain the video to be processed from other electronic devices according to the identifier, and then execute the above processing instruction for the video to be processed.
[0182] Optionally, when the above instruction generation tool and the video processing tool are located in different electronic devices, the above instruction generation tool can simultaneously send the above video to be processed and the processing instruction to the video processing tool. Thus, after receiving the above video to be processed and the processing instruction, the video processing tool executes the above processing instruction for the video to be processed.
[0183] Optionally, when the above instruction generation tool and the video processing tool are located in different electronic devices, the to-be-processed video may be a video stored in an electronic device other than the electronic device where the video processing tool is located, and the above processing instruction may carry an identifier of the to-be-processed video. Thus, after receiving the to-be-processed video, the video processing tool may obtain the to-be-processed video from other electronic devices according to the identifier, and then execute the above processing instruction for the to-be-processed video.
[0184] Among them, the above embodiments are merely examples of the ways for the video processing tool to obtain the to-be-processed video, rather than limitations. Any way that can enable the video processing tool to obtain the to-be-processed video belongs to the protection scope of this application.
[0185] As can be seen above, by applying the solution provided by the embodiments of the present invention, after determining multiple target operations to be executed based on the parameter change amount between the initial parameters and the target parameters of the to-be-processed video, the processing order of the multiple target operations can be determined based on the operation category to which each determined target operation belongs and based on the priority of the operation category. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool encapsulates the multiple target operations in a single stream processing and executes them according to the above processing order to obtain a video processing result. In this way, the to-be-processed video is processed according to the processing order obtained based on the priority of the operation category, which improves the video processing speed and further improves the video processing efficiency.
[0186] Optionally, in a specific implementation, the number of to-be-processed videos is multiple, and the multiple target operations include: at least one target operation for each to-be-processed video;
[0187] In the above step S203, determining the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs may include steps 11-12:
[0188] Step 11: For each to-be-processed video, if the number of target operations for the to-be-processed video is multiple, then determine the processing sub-order of each target operation for the to-be-processed video based on the priority of the operation category to which each target operation for the to-be-processed video belongs;
[0189] Step 12: Determine the processing order of the multiple target operations based on each processing sub-order.
[0190] In this specific implementation, after determining that there are multiple videos to be processed in the current video processing and at least one target operation can be performed for each video to be processed, it can be further determined that multiple target operations need to be performed for each of the above-mentioned videos to be processed. In this way, for each video to be processed, it can be determined which operation category in the preset operation categories each target operation required to process this video to be processed belongs to. Furthermore, based on the priorities of the operation categories to which each target operation required to process this video to be processed belongs, the processing sub-sequence of the multiple target operations for this video to be processed can be determined. In this way, for multiple videos to be processed, based on the processing sub-sequences of the multiple target operations for each video to be processed, the processing sequence of the multiple target operations in the current video processing process can be determined.
[0191] That is to say, when it is determined that there are multiple videos to be processed in the current video processing process, for each video to be processed, after determining the multiple target operations for each video to be processed, it can be determined which operation category in the preset operation categories each target operation of this video to be processed belongs to. Furthermore, based on the priorities of the operation categories to which the above-mentioned respective target operations belong, the execution sequence of the multiple target operations for this video to be processed is sorted. In this way, the processing sub-sequence of the multiple target operations for this video to be processed can be determined. Thus, after determining the processing sub-sequences of the multiple target operations that need to be performed for each video to be processed, it can be further determined the processing sequence of the multiple target operations in the current video processing process.
[0192] Exemplarily, when there are two videos to be processed in the current video processing process, it is determined that the multiple target operations that need to be performed are cropping, stretching, color correction, frame rate reduction, and merging. Further, it can be determined that the target operations to be performed on Video A are cropping, stretching, and color correction, and the target operations to be performed on Video B are frame rate reduction and stretching. Then, it is respectively determined which operation category in the preset operation categories each of the three target operations for Video A belongs to, that is, cropping belongs to the first type of operation, color correction belongs to the second type of operation, and stretching belongs to the third type of operation. Based on the priorities of the operation categories to which the respective target operations belong, the processing sub-sequence of the three target operations for Video A can be determined as cropping, color correction, and stretching; it is respectively determined which operation category in the preset operation categories each of the two target operations for Video B belongs to, that is, frame rate reduction belongs to the first type of operation, and stretching belongs to the third type of operation. Based on the priorities of the operation categories to which the respective target operations belong, the processing sub-sequence of the two target operations for Video B can be determined as frame rate reduction and stretching.
[0193] Furthermore, determine the processing order of multiple target operations in the current video processing process as follows: First, crop Video A and reduce the frame rate of Video B simultaneously. Then, stretch Video A and Video B simultaneously. Next, perform color correction on Video A. Finally, merge the processed Video A and Video B to obtain the target video processing result.
[0194] In this specific implementation, the above processing instructions can be used to indicate decoding the video to be processed, serially executing multiple target operations on the decoded video stream in the above processing order, and encoding the video stream after the operations; can be used to indicate decoding the video to be processed, partially serially and partially parallelly executing multiple target operations on the decoded video stream in the above processing order, and encoding the video stream after the operations; or can be used to indicate decoding the video to be processed, parallelly executing multiple target operations on the decoded video stream in the above processing order, and encoding the video stream after the operations.
[0195] Optionally, in a specific implementation, the number of videos to be processed is multiple, and the multiple target operations include: first-sequence target operations for each video to be processed, a merge operation for multiple videos to be processed, and second-sequence target operations for the merged video.
[0196] In this specific implementation, the processing instructions are used to indicate decoding each video to be processed, parallelly executing the first-sequence target operations for the decoded video stream of each video to be processed; merging the video streams after the operations, and executing the second-sequence target operations on the merged video stream, and encoding the video stream after the operations.
[0197] When processing a video, it is determined that the number of videos to be processed is multiple, and it is determined that the operations to be performed on each video to be processed include first-sequence target videos, a merge operation for multiple videos to be processed, and second-sequence target operations for the merged video. Each video to be processed can be decoded according to the above processing instructions, and the first-sequence target operations can be parallelly executed on the decoded video stream. After that, a merge operation is performed on the video stream after the first-sequence target operations are completed. Then, the second-sequence target operations are performed on the merged video stream, and the video stream after the operations is encoded to obtain the video processing result.
[0198] According to the category and number of target operations, the above first-sequence target operations can include one or more target operations, and the above second-sequence target operations can also include one or more target operations.
[0199] Exemplarily, when processing videos, it is determined that there are multiple videos to be processed. Furthermore, according to the initial parameters and target parameters of the videos to be processed, it is determined that multiple target operations to be performed include cropping, stretching, color correction, and merging. It is determined that cropping and stretching are the first sequence of target operations, and color correction is the second sequence of target operations. Then, according to the above processing order, the videos to be processed are first decoded, and the first sequence of target operations is performed in parallel on the decoded video stream. After that, the processing results are merged. Furthermore, the second sequence of target operations is performed on the merged video stream. Finally, the processed video stream is encoded to obtain the target video processing result. That is to say, cropping and stretching are performed in parallel on the decoded video stream first. After that, the video stream after cropping and stretching is merged. Then, color correction is performed on the merged video stream. In this way, the video stream after color correction is encoded to obtain the target video processing result.
[0200] When determining the operation categories of multiple target operations, there may be a situation where two or more target operations belong to the same operation category. Since the priorities corresponding to several target operations belonging to the same operation category are the same, when determining the processing order of each target operation, the processing order between the two or more target operations belonging to the same operation category can also be considered.
[0201] Optionally, in a specific implementation manner, in step S203 above, determining the processing order of multiple target operations based on the priorities of the operation categories to which each target operation belongs may include steps 21-22:
[0202] Step 21: Determine the processing order of each target operation belonging to different operation categories in turn according to the order from high to low of the priorities.
[0203] Step 22: For multiple target operations belonging to the same operation category, based on the operation parameters of each target operation, determine the sub-priority of the target operation in this operation category, and determine the processing order of each target operation belonging to this operation category according to the order from high to low of the sub-priorities.
[0204] In this specific implementation manner, when determining the processing order of multiple target operations, for each target operation, it can first be determined which operation category the target operation belongs to in the preset operation categories. Furthermore, according to the order from high to low of the priorities of the operation categories to which each target operation belongs, the various target operations can be sorted first according to different operation categories to determine the processing order of each operation category.
[0205] After that, for two or more target operations belonging to the same operation category, based on the operation parameters of each target operation for the data volume of the video stream, determine the sub-priorities of each target operation in the operation category to which it belongs, and determine the processing order of each target operation belonging to the operation category in descending order of the sub-priorities in the operation category.
[0206] Exemplarily, for the sake of facilitating the understanding of the specific implementation manner of the priorities corresponding to the above operations, hereinafter, in combination with Figure 5 specific descriptions will be given.
[0207] As Figure 5 shown, based on the parameter change amounts of the initial parameters and the target parameters of the video to be processed, six target operations are determined. Among them, two target operations belong to the first type of operation, two target operations belong to the second type of operation, and two operations belong to the third type of operation. After that, based on the priorities of the operation categories to which each target operation belongs, the above six target operations are sorted. First, the two target operations belonging to the first type of operation are executed. After that, the two target operations belonging to the second type of operation are executed. Subsequently, the two target operations belonging to the third type of operation are executed last.
[0208] Then, for each operation category, determine the sub-priorities of the two target operations belonging to the operation category. As Figure 5 shown, in the first type of operation, the sub-priority of the high-efficiency one is higher than that of the low-efficiency one; in the second type of operation, the two target operations are arranged in any order; in the third type of operation, the sub-priority of the high-efficiency three is higher than that of the low-efficiency three. That is to say, the processing order of the six target operations can be, in turn, high-efficiency one, low-efficiency one, two, two, high-efficiency three, and low-efficiency three. Furthermore, the above six target operations can be encapsulated in a single video stream processing according to the above processing order through the filter function of ffmpeg.
[0209] Among them, different operation categories have different effects on the data volume of the video stream and the video processing rate after the operation. Therefore, for each operation category, the sub-priorities corresponding to each operation belonging to the operation category can be determined according to different determination methods.
[0210] Optionally, in the first type of operation, determine that the sub-priority corresponding to the operation that reduces the data volume of the video stream more is higher than the sub-priority corresponding to the operation that reduces the data volume of the video stream less; among them, the operation with a higher sub-priority can be called a high-efficiency one operation, and the operation with a lower sub-priority can be called a low-efficiency one operation.
[0211] In the second type of operation, since each operation has no influence on the data volume of the video stream, the sub-priorities of the operations belonging to the second type of operation can be randomly determined;
[0212] In the third type of operation, it is determined that the sub-priority corresponding to the operation with less increase in the data volume of the video stream is higher than the sub-priority corresponding to the operation with more increase in the data volume of the video stream; among them, the operation with a high sub-priority can be called an efficient third-type operation, and the operation with a low sub-priority can be called an inefficient third-type operation.
[0213] In the fourth type of operation, since the fourth type of operation has little impact on the data volume of the video stream and does not affect the video processing speed after the operation, the sub-priorities of each operation belonging to the fourth type of operation can be randomly determined.
[0214] For example, the target operations belonging to the first type of operation include: cropping, frame dropping, and scaling. Comparing the operation parameters of the above three target operations, since the operation parameters of scaling can reduce the video stream data volume the least, it can be determined that the sub-priority of scaling in the first type of operation is the lowest. For the two operations of cropping and frame dropping, based on the specific operation parameters, compare the cropping ratio and the frame dropping ratio. When the cropping ratio is greater than the frame dropping ratio, it can be shown that the video stream data volume reduced by cropping is more than the video stream data volume reduced by frame dropping. Furthermore, in the first type of operation, the sub-priority of cropping is higher than that of frame dropping. On the contrary, when the cropping ratio is less than the frame dropping ratio, it can be shown that the video stream data volume reduced by cropping is less than the video stream data volume reduced by frame dropping. Furthermore, in the first type of operation, the sub-priority of frame dropping is higher than that of cropping. Among them, the above cropping ratio is the ratio of the cropping area to the original video area, and the above frame dropping ratio is the ratio of the frame dropping value to the original frame rate.
[0215] Exemplarily, the video to be processed includes three videos, and the initial parameters of the three videos are all: the frame rate is 25, and the width and height are 1980*1080; and the target parameters of the target videos corresponding to the three videos are all: the frame rate is 12, the width and height are 480*270, and the contrast ratio is 1.05. Thus, the determined multiple target operations include: cropping, frame dropping, scaling, merging, and adjusting the contrast. And it is determined that cropping, frame dropping, and scaling belong to the first type of operation, and merging and adjusting the contrast belong to the fourth type of operation. The cropping positions of the three videos are (0,0,1080,720), (200,200,1080,720), and (500,350,1080,720) respectively.
[0216] Among them, it is preset that the priority of the first type of operation is higher than that of the fourth type of operation. That is to say, the priorities corresponding to cropping, frame dropping, and scaling are higher than the priorities corresponding to merging and adjusting the contrast. The processing order of cropping, frame dropping, and scaling is before merging and adjusting the contrast.
[0217] After that, compare the operation parameters of cropping, frame rate reduction, and scaling. For each video to be processed, the width and height of the video are 1980*1080, and the original area is 2,073,600; after cropping, the width and height are 1080*720, and the area is 777,600. Then the cropped area is 1,296,000, and the cropping ratio is 0.625. The frame rate of each video to be processed is 25, and the frame rate after frame rate reduction is 12. The frame rate reduction value is 13, and the frame rate reduction ratio is 0.52. By comparison, the cropping ratio is greater than the frame rate reduction ratio, so the amount of data in the video stream reduced by cropping is greater than the amount of data in the video stream reduced by frame rate reduction. Therefore, in the first type of operation, the sub-priority of cropping is higher than that of frame rate reduction.
[0218] In addition, the amount of data in the video stream reduced by scaling is the least. Based on this, in the first type of operation, the sub-priority corresponding to cropping is higher than that of frame rate reduction, and the sub-priority corresponding to frame rate reduction is higher than that of scaling.
[0219] Moreover, the target operation belonging to the fourth type of operation can be sequenced according to the principle of the merge-first execution preset by the user. Thus, the processing order of the above five target operations is finally determined as: cropping, frame rate reduction, scaling, merging, and contrast adjustment.
[0220] Optionally, in a specific implementation, after the instruction generation tool sends the above processing instructions to the video processing tool, the video processing tool can execute the following steps 31-32:
[0221] Step 31: Receive the processing instruction for the video to be processed; where the processing instruction is generated based on any one of the video operation processing methods provided in the above embodiments of the present invention;
[0222] Step 32: Based on the processing instruction, decode the video to be processed, execute multiple target operations on the decoded video stream according to the processing order, and encode the video stream after the operation to obtain the target video.
[0223] Based on the above video processing method, the instruction generation tool generates a processing instruction for instructing the video processing tool to decode the video to be processed, execute multiple target operations on the decoded video stream according to the above processing order, and encode the video stream after the operation.
[0224] Furthermore, the video processing tool can communicate with the above instruction generation tool and receive the processing instruction for the video to be processed sent by the above instruction generation tool.
[0225] The video processing tool receives the processing instruction for the video to be processed, decodes the video to be processed according to the processing instruction, executes the above multiple target operations on the decoded video stream in the above order, and then encodes the video stream after the operation. In this way, a video processing result with target parameters can be obtained.
[0226] Exemplarily, for the convenience of understanding the specific implementation of the above video processing method, hereinafter, in combination with Figure 6 a specific description will be given.
[0227] As Figure 6 shown, the various input parameters in the figure are the initial parameters of the video to be processed and the target parameters of the target video; the command generator is the instruction generation tool. Thus, the command generator can execute any video processing method provided by the present invention to generate the above processing instructions, that is, as Figure 6 shown, the command generator generates an ffmpeg command through a generation strategy, that is, generates the above processing instructions, and sends the processing instructions to the command executor, where the command executor is the video processing tool.
[0228] After receiving the above ffmpeg command, the command executor can decode the video to be processed, and perform the above multiple target operations on the decoded video stream in the above order. After that, the processed video stream is encoded to obtain the video processing result.
[0229] Based on the same inventive concept, an embodiment of the present invention further provides another video processing method.
[0230] Figure 7 is a schematic flowchart of a video processing method provided by an embodiment of the present invention. As Figure 7 shown, the method may include the following steps S701-S704:
[0231] S701: Determine a plurality of target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target static image;
[0232] Among them, the plurality of target operations include: frame extraction and frame operations after frame extraction, and the frame operations include at least one of: cropping, stretching, scaling, adding watermarks, and color adjustment;
[0233] S702: Based on the method provided by the embodiment of the present invention, determine the operation category to which each target operation belongs in the preset operation category, and determine the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs;
[0234] S703: Generate processing instructions for the plurality of target operations based on the processing order;
[0235] S704: Send the processing instructions to the video processing tool, so that the video processing tool decodes the video to be processed, performs a plurality of target operations on the decoded video stream in the processing order, and encodes the processed video stream to obtain the target static image.
[0236] In this specific implementation, the desired static image can be used as the target static image, and thus, the parameters of the target static image can be used as the target parameters.
[0237] Among them, the so-called static image can include cover images, illustrations, static expressions, etc.
[0238] In this way, based on the parameter variation between the initial parameters of the video to be processed and the target parameters of the target static image, multiple target operations can be determined, including frame extraction and frame operations after frame extraction. The above frame operations can include at least one of: cropping, stretching, scaling, adding watermarks, and color adjustment.
[0239] That is to say, when processing the video to be processed into a target static image, frame extraction can be performed on the video to be processed. In this way, at least one of the frame operations of cropping, stretching, scaling, adding watermarks, and color adjustment can be performed on the video frames obtained after frame extraction.
[0240] Of course, the target operations for processing the video to be processed into a target static image may also include other operations. After determining the target operations, according to the method provided by the present invention, determining the processing order of the above multiple target operations and the solution of performing the above multiple target operations in the above order are all within the protection scope of the present invention.
[0241] Based on the method provided by the embodiments of the present invention, after determining the above multiple target operations, the operation category of each target operation in the preset operation category can be determined. Furthermore, based on the priority of the operation category to which each target operation belongs, the processing order of the above multiple target operations can be determined.
[0242] After that, based on the above processing order, a processing instruction for multiple target operations can be generated and sent to the video processing tool. In this way, the video processing tool can decode the video to be processed, and then perform multiple target operations on the decoded video stream in the above processing order, and encode the video stream after the operation to obtain the target static image.
[0243] Among them, the specific implementation manners of the above S701 - S704 are the same as those of S201 - S205, and will not be elaborated here.
[0244] As can be seen above, when applying the solution provided by the embodiments of the present invention, after determining multiple target operations to be performed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the processing order of the multiple target operations can be determined based on the operation category to which each determined target operation belongs and the priority of the operation category. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool encapsulates and executes the multiple target operations in a single stream processing according to the above processing order to obtain a video processing result. In this way, by processing the video to be processed according to the processing order obtained based on the priority of the operation category, the video processing speed is increased, and further, the video processing efficiency is improved.
[0245] Based on the same inventive concept, the embodiments of the present invention further provide another video processing method.
[0246] Figure 8 A flowchart of a video processing method provided by an embodiment of the present invention is shown as Figure 8 shown, and the method may include the following steps S801 - S804:
[0247] S801: Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target dynamic image; where the target operations include multiple operations among frame dropping, merging, cropping, color adjustment, and scaling;
[0248] S802: Determine the operation category to which each target operation belongs in a preset operation category based on the method provided by the embodiments of the present invention, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs;
[0249] S803: Generate a processing instruction for the multiple target operations based on the processing order;
[0250] S804: Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes multiple target operations on the decoded video stream according to the processing order, and encodes the video stream after the operation to obtain the target dynamic image.
[0251] In this specific implementation, the desired dynamic image can be used as the target dynamic image, and thus, the parameters of the target dynamic image can be used as the target parameters.
[0252] Among them, the so-called dynamic image may include a preview image, a dynamic picture, etc.
[0253] In this way, based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target dynamic image, it can be determined that the multiple target operations include multiple operations among frame dropping, merging, cropping, color adjustment, and scaling.
[0254] That is to say, when processing the video to be processed into the target dynamic image, multiple operations among frame rate reduction, merging, cropping, color adjustment, and scaling can be performed on the video to be processed. In this way, the target operations can include multiple ones among the above-mentioned frame rate reduction, merging, cropping, color adjustment, and scaling.
[0255] Of course, the target operations for processing the video to be processed into the target dynamic image can also include other operations. After determining the target operations, according to the method provided by the present invention, determining the processing order of the above-mentioned multiple target operations and processing the solutions for executing the above-mentioned multiple target operations in the above order are all within the protection scope of the present invention.
[0256] Based on the method provided by the embodiments of the present invention, after determining the above-mentioned multiple target operations, the operation category of each target operation in the preset operation category can be determined. Furthermore, based on the priority of the operation category to which each target operation belongs, the processing order of the above-mentioned multiple target operations can be determined.
[0257] After that, based on the above processing order, a processing instruction for multiple target operations can be generated and the above processing instruction can be sent to the video processing tool. In this way, the video processing tool can decode the video to be processed, and then execute multiple target operations on the decoded video stream in the above processing order, and encode the video stream after the operation to obtain the target dynamic image.
[0258] Among them, the specific implementation manners of the above S801 - S804 are the same as those of S201 - S205, and will not be elaborated here.
[0259] As can be seen above, by applying the solution provided by the embodiments of the present invention, after determining multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the operation category to which each determined target operation belongs can be based on, and the processing order of the multiple target operations can be determined based on the priority of the operation category. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool executes the multiple target operations encapsulated in a single stream processing in the above processing order to obtain the video processing result. In this way, processing the video to be processed according to the processing order obtained based on the priority of the operation category improves the video processing speed, and further improves the video processing efficiency.
[0260] Based on the same inventive concept, the embodiments of the present invention also provide another video processing method.
[0261] Figure 9 For the flowchart of a video processing method provided by an embodiment of the present invention, as Figure 9 shown, the method may include the following steps S901 - S904:
[0262] S901: Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video; wherein, the target operations include multiple ones among frame dropping, merging, cropping, color grading, and scaling;
[0263] S902: Based on the method provided in the embodiments of the present invention, determine the operation category to which each target operation belongs in the preset operation category, and based on the priority of the operation category to which each target operation belongs, determine the processing order of the multiple target operations;
[0264] S903: Generate a processing instruction regarding the multiple target operations based on the processing order;
[0265] S904: Send the processing instruction to the video processing tool, so that the video processing tool decodes the video to be processed, executes the multiple target operations on the decoded video stream in the processing order, and encodes the processed video stream to obtain the target video.
[0266] In this specific implementation, the desired video can be used as the target video, and thus, the parameters of this target video can be used as the target parameters.
[0267] Among them, multiple videos to be processed can be processed into one video; or one video to be processed can be processed into a video with a smaller video stream data volume; both are reasonable and are not specifically limited in the embodiments of the present invention.
[0268] In this way, based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video, it can be determined that the multiple target operations include multiple ones among frame dropping, merging, cropping, color grading, and scaling.
[0269] That is to say, when processing the video to be processed into the target video, multiple operations among frame dropping, merging, cropping, color grading, and scaling can be performed on the video to be processed. In this way, the target operations can include multiple ones among frame dropping, merging, cropping, color grading, and scaling.
[0270] Of course, the target operations for processing the video to be processed into the target video may also include other operations. After determining the target operations, according to the method provided by the present invention, determining the processing order of the above-mentioned multiple target operations and processing and executing the above-mentioned multiple target operations according to the above order are all within the protection scope of the present invention.
[0271] Based on the method provided in the embodiments of the present invention, after determining the above-mentioned multiple target operations, the operation category of each target operation in the preset operation category can be determined. Furthermore, based on the priority of the operation category to which each target operation belongs, the processing order of the above-mentioned multiple target operations can be determined.
[0272] After that, based on the above processing order, processing instructions for multiple target operations can be generated and sent to the video processing tool. In this way, the video processing tool can decode the video to be processed, and then perform multiple target operations on the decoded video stream according to the above processing order, and encode the video stream after the operations to obtain the target video.
[0273] Among them, the specific implementation manners of the above S901 - S904 are the same as those of S201 - S205, and will not be elaborated here.
[0274] As can be seen above, by applying the solution provided in the embodiments of the present invention, after determining multiple target operations that need to be performed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the operation category to which each determined target operation belongs can be based on, and the processing order of the multiple target operations can be determined based on the priority of the operation category. Then, based on the above processing order, processing instructions for the multiple target operations are generated, so that the video processing tool encapsulates and executes the multiple target operations in one stream processing according to the above processing order to obtain the video processing result. In this way, by processing the video to be processed according to the processing order obtained based on the priority of the operation category, the video processing speed is improved, and thus, the video processing efficiency is improved.
[0275] Corresponding to the Figure 2 video processing method provided in the above embodiments of the present invention, the embodiments of the present invention also provide a video processing device.
[0276] Figure 10 For the structure schematic diagram of a video processing device provided in the embodiments of the present invention, as Figure 10 shown, the device may include the following modules:
[0277] The first operation determination module 1010 is configured to determine multiple target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed;
[0278] The first category determination module 1020 is configured to determine the operation category to which each target operation belongs in the preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation;
[0279] The first order determination module 1030 is configured to determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs;
[0280] The first instruction generation module 1040 is configured to generate a processing instruction regarding the multiple target operations based on the processing order; wherein, the processing instruction is used to indicate decoding the video to be processed, performing the multiple target operations on the decoded video stream in accordance with the processing order, and encoding the video stream after the operations.
[0281] The first execution module 1050 is configured to send the processing instruction to a video processing tool, so that the video processing tool executes the processing instruction on the device to be processed to obtain a video processing result.
[0282] As can be seen above, by applying the solution provided in the embodiment of the present invention, after determining multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the video to be processed, the processing order of the multiple target operations can be determined based on the operation category to which each determined target operation belongs and based on the priority of the operation category. Then, a processing instruction regarding the multiple target operations is generated based on the above processing order, and then the above processing instruction is sent to a video processing tool, so that the video processing tool encapsulates and executes the multiple target operations in one stream processing in accordance with the above processing order to obtain a video processing result. In this way, the video to be processed is processed according to the processing order obtained based on the priority of the operation category, which improves the video processing speed, and further improves the video processing efficiency.
[0283] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the multiple target operations include: at least one target operation for each video to be processed;
[0284] The first order determination module 1020 is specifically configured to:
[0285] For each video to be processed, if the number of target operations for the video to be processed is multiple, then based on the priority of the operation category to which each target operation for the video to be processed belongs, determine the processing sub-order of each target operation for the video to be processed;
[0286] Based on each processing sub-order, determine the processing order of the multiple target operations.
[0287] Optionally, in a specific implementation manner, the number of videos to be processed is multiple, and the multiple target operations include: the first sequence of target operations for each video to be processed, the merging operation for the multiple videos to be processed, and the second sequence of target operations for the merged video;
[0288] The processing instructions are used to indicate decoding each video to be processed, and parallelly executing a first sequence of target operations for each video to be processed on the video stream after decoding the video to be processed; merging the video streams after the operations, and executing the second sequence of target operations on the merged video stream, and encoding the video stream after the execution.
[0289] Optionally, in a specific implementation manner, the first sequence determination module 1030 is specifically configured to:
[0290] Determine the processing order of each target operation belonging to different operation categories in sequence according to the priority from high to low;
[0291] For multiple target operations belonging to the same operation category, based on the operation parameters of each target operation, determine the sub-priority of the target operation in the operation category, and determine the processing order of each target operation belonging to the operation category according to the sub-priority from high to low.
[0292] Optionally, in a specific implementation manner, the preset operation categories include at least two of: the first type of operation, the second type of operation, the third type of operation, and the fourth type of operation;
[0293] Among them, the first type of operation includes: operations that reduce the amount of video stream data and affect the video processing speed after the operation;
[0294] The second type of operation includes: operations that do not affect the amount of video stream data;
[0295] The third type of operation includes: operations that increase the amount of video stream data and affect the video processing speed after the operation;
[0296] The fourth type of operation includes: operations that affect the amount of video stream data and do not affect the video processing speed after the operation;
[0297] The category priority of the first type of operation is higher than the category priority of the second type of operation, the category priority of the second type of operation is higher than the category priority of the third type of operation, and the relationship between the category priority of the fourth type of operation and the category priorities of the first type of operation, the second type of operation, and the third type of operation is set according to preset conditions.
[0298] Corresponding to the Figure 7 video processing method shown in the above embodiments of the present invention, the embodiments of the present invention further provide a video processing device.
[0299] Figure 11 is a schematic structural diagram of a video processing device provided by an embodiment of the present invention. As Figure 11 shown, the device may include the following modules:
[0300] A second operation determination module 1110, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target still image; wherein, the plurality of target operations include: frame extraction and frame operations after frame extraction, and the frame operations include: at least one of cropping, stretching, watermarking, and color adjustment;
[0301] A second sequence determination module 1120, configured to determine, based on the device provided in the embodiment of the present invention, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on a priority of the operation category to which each target operation belongs;
[0302] A second instruction generation module 1130, configured to generate a processing instruction for the plurality of target operations based on the processing sequence;
[0303] A second execution module 1140, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream according to the processing sequence, and encodes the video stream after the operation to obtain the target still image.
[0304] As can be seen above, by applying the solution provided in the embodiment of the present invention, after determining a plurality of target operations to be executed based on a parameter change amount between an initial parameter of a video to be processed and a target parameter, the processing sequence of the plurality of target operations can be determined based on the operation category to which each determined target operation belongs and based on the priority of the operation category, and then, a processing instruction for the plurality of target operations is generated based on the above processing sequence, so that the video processing tool executes the plurality of target operations encapsulated in a single stream processing according to the above processing sequence to obtain a video processing result. In this way, the video to be processed is processed according to the processing sequence obtained based on the priority of the operation category, which improves the video processing speed and further improves the video processing efficiency.
[0305] Corresponding to the Figure 8 video processing method provided in the embodiment of the present invention as shown above, the embodiment of the present invention further provides a video processing device.
[0306] Figure 12 It is a schematic structural diagram of a video processing device provided in the embodiment of the present invention. As Figure 12 shown, the device may include the following modules:
[0307] A third operation determination module 1210, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target dynamic image; wherein, the target operations include: multiple of frame rate reduction, merging, cropping, color adjustment, and scaling;
[0308] A third-order determination module 1220, configured to determine, based on the device provided in the embodiment of the present invention, the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priorities of the operation categories to which each target operation belongs;
[0309] A third instruction generation module 1230, configured to generate a processing instruction for the multiple target operations based on the processing order;
[0310] A third execution module 1240, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the to-be-processed video, executes the multiple target operations on the decoded video stream according to the processing order, and encodes the video stream after the operation to obtain the target dynamic image.
[0311] As can be seen above, by applying the solution provided in the embodiment of the present invention, after determining multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the to-be-processed video, the operation category to which each determined target operation belongs can be determined, and the processing order of the multiple target operations can be determined based on the priorities of the operation categories. Then, a processing instruction for the multiple target operations is generated based on the above processing order, so that the video processing tool encapsulates and executes the multiple target operations in a single stream processing according to the above processing order to obtain a video processing result. In this way, the to-be-processed video is processed according to the processing order obtained based on the priorities of the operation categories, which improves the video processing speed and further improves the video processing efficiency.
[0312] Corresponding to the above-mentioned video processing method provided in the embodiment of the present invention Figure 9 shown, the embodiment of the present invention further provides a video processing device.
[0313] Figure 13 is a schematic structural diagram of a video processing device provided in the embodiment of the present invention. As Figure 13 shown, the device may include the following modules:
[0314] A fourth operation determination module 1310, configured to determine multiple target operations based on the parameter change amount between the initial parameters of the to-be-processed video and the target parameters of the target video; wherein, the target operations include multiple of: frame dropping, merging, cropping, color adjustment, and scaling;
[0315] A fourth order determination module 1320, configured to determine, based on the device provided in the embodiment of the present invention, the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priorities of the operation categories to which each target operation belongs;
[0316] The fourth instruction generation module 1330 is configured to generate a processing instruction regarding the multiple target operations based on the processing sequence;
[0317] The fourth execution module 1340 is configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the to-be-processed video, executes the multiple target operations on the decoded video stream according to the processing sequence, and encodes the video stream after the operations to obtain the target video.
[0318] As can be seen above, by applying the solution provided in the embodiment of the present invention, after determining the multiple target operations that need to be executed based on the parameter change amount between the initial parameters and the target parameters of the to-be-processed video, the processing sequence of the multiple target operations can be determined based on the operation category to which each determined target operation belongs and based on the priority of the operation category. Then, a processing instruction regarding the multiple target operations is generated based on the above processing sequence, so that the video processing tool encapsulates and executes the multiple target operations in one stream processing according to the above processing sequence to obtain a video processing result. In this way, the to-be-processed video is processed according to the processing sequence obtained based on the priority of the operation category, which improves the video processing speed and thus improves the video processing efficiency.
[0319] The embodiment of the present invention further provides an electronic device, as Figure 14 shown, including a processor 1401, a communication interface 1402, a memory 1403, and a communication bus 1404. Among them, the processor 1401, the communication interface 1402, and the memory 1403 complete mutual communication through the communication bus 1404.
[0320] The memory 1403 is used to store a computer program;
[0321] The processor 1401 is configured to implement the steps of any video processing method provided in the above embodiment of the present invention when executing the program stored on the memory 1403.
[0322] The communication bus mentioned in the above terminal may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For the sake of simplicity of representation, only a thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.
[0323] The communication interface is used for communication between the above terminal and other devices.
[0324] The memory may include a Random Access Memory (RAM), or may also include a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located far from the aforementioned processor.
[0325] The aforementioned processor may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.
[0326] In another embodiment provided by the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, it implements any one of the video processing methods in the above embodiments.
[0327] In another embodiment provided by the present invention, there is also provided a computer program product containing instructions, and when it runs on a computer, it causes the computer to execute any one of the video processing methods in the above embodiments.
[0328] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the processes or functions described in the embodiments of the present invention are generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website, computer, server, or data center to another website, computer, server, or data center by wire (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (such as a floppy disk, hard disk, magnetic tape), an optical medium (such as a DVD), or a semiconductor medium (such as a solid state disk (SSD)).
[0329] It should be noted that in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the term "comprising", "including", or any other variant thereof is intended to cover non-exclusive inclusion, such that a process, method, article, or device that includes a series of elements includes not only those elements but also other elements that are not explicitly listed, or elements that are inherent to such process, method, article, or device. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article, or device that includes the element.
[0330] Each embodiment in this specification is described in a related manner. For the same or similar parts among the embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the device embodiments, electronic device embodiments, computer-readable storage medium embodiments, and computer-readable storage media, since they are basically similar to the method embodiments, the description is relatively simple, and reference can be made to the corresponding parts of the method embodiments for the relevant content.
[0331] The above are only the preferred embodiments of the present invention and are not intended to limit the protection scope of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principle of the present invention are all included in the protection scope of the present invention.
Claims
1. A video processing method, characterized in that, The method includes: Determining a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed; Determining the operation category to which each target operation belongs in a preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation; Determining the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs; Generating a processing instruction for the plurality of target operations based on the processing order; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the plurality of target operations on the decoded video stream in accordance with the processing order, and encode the video stream after the operation; Sending the processing instruction to a video processing tool so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result; Wherein, the preset operation category includes at least two of: a first type of operation, a second type of operation, a third type of operation, and a fourth type of operation; the first type of operation includes: an operation that reduces the video stream data volume and affects the video processing speed after the operation; the second type of operation includes: an operation that does not affect the video stream data volume; the third type of operation includes: an operation that increases the video stream data volume and affects the video processing speed after the operation; the fourth type of operation includes: an operation that affects the video stream data volume and does not affect the video processing speed after the operation; the priority of the first type of operation is higher than the priority of the second type of operation, the priority of the second type of operation is higher than the priority of the third type of operation, and the relationship between the priority of the fourth type of operation and the priorities of the first type of operation, the second type of operation, and the third type of operation is set according to preset conditions.
2. The method according to claim 1, wherein The number of videos to be processed is multiple, and the plurality of target operations include: at least one target operation for each video to be processed; The determining the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs includes: For each video to be processed, if the number of target operations for the video to be processed is multiple, determining the processing sub-order of each target operation for the video to be processed based on the priority of the operation category to which each target operation for the video to be processed belongs; Determining the processing order of the plurality of target operations based on each processing sub-order.
3. The method according to claim 2, wherein The number of videos to be processed is multiple, and the plurality of target operations include: a first sequence of target operations for each video to be processed, a merging operation for the plurality of videos to be processed, and a second sequence of target operations for the merged video; The processing instruction is used to instruct to decode each video to be processed, and execute the first sequence of target operations for each video to be processed on the video stream decoded from each video to be processed in parallel; merge the video streams after the operation, and execute the second sequence of target operations on the merged video stream, and encode the video stream after the execution.
4. The method according to claim 1, wherein The step of determining the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs includes: Determine the processing order of each target operation belonging to different operation categories in descending order of priority; For multiple target operations belonging to the same operation category, based on the operation parameters of each target operation, determine the sub-priority of the target operation in this operation category, and determine the processing order of each target operation belonging to this operation category in descending order of sub-priority.
5. A video processing method, characterized in that, The method includes: Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target static image; wherein, the multiple target operations include: frame extraction and frame operations after frame extraction, and the frame operations include: at least one of cropping, stretching, scaling, watermarking, and color correction. Based on the method according to any one of claims 1-4, determine the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs. Generate a processing instruction for the multiple target operations based on the processing order. Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the multiple target operations on the decoded video stream in the processing order, and encodes the processed video stream to obtain the target static image.
6. A video processing method, characterized in that, The method includes: Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target dynamic image; wherein, the target operations include: multiple of frame rate reduction, merging, cropping, color correction, and scaling. Based on the method according to any one of claims 1-4, determine the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs. Generate a processing instruction for the multiple target operations based on the processing order. Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the multiple target operations on the decoded video stream in the processing order, and encodes the processed video stream to obtain the target dynamic image.
7. A video processing method, characterized in that The method includes: Determine multiple target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target video; wherein, the target operations include: multiple of frame rate reduction, merging, cropping, color correction, and scaling. Based on the method according to any one of claims 1-4, determine the operation category to which each target operation belongs in a preset operation category, and determine the processing order of the multiple target operations based on the priority of the operation category to which each target operation belongs. Generate a processing instruction for the multiple target operations based on the processing order. Send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the multiple target operations on the decoded video stream in the processing order, and encodes the processed video stream to obtain the target video.
8. A video processing device, characterized in that, The device includes: The first operation determination module is configured to determine a plurality of target operations based on the parameter change amount between the initial parameters and the target parameters of the video to be processed; The first category determination module is configured to determine the operation category to which each target operation belongs in a preset operation category; wherein, the preset operation category is divided according to the influence of each operation on the video stream data volume and the video processing speed after the operation; The first order determination module is configured to determine the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs; The first instruction generation module is configured to generate a processing instruction regarding the plurality of target operations based on the processing order; wherein, the processing instruction is used to instruct to decode the video to be processed, execute the plurality of target operations on the decoded video stream according to the processing order, and encode the video stream after the operation; The first execution module is configured to send the processing instruction to a video processing tool, so that the video processing tool executes the processing instruction on the video to be processed to obtain a video processing result; wherein, the preset operation category includes at least two of: the first type of operation, the second type of operation, the third type of operation, and the fourth type of operation; the first type of operation includes: an operation that reduces the video stream data volume and affects the video processing speed after the operation; the second type of operation includes: an operation that does not affect the video stream data volume; the third type of operation includes: an operation that increases the video stream data volume and affects the video processing speed after the operation; the fourth type of operation includes: an operation that affects the video stream data volume and does not affect the video processing speed after the operation; the priority of the first type of operation is higher than the priority of the second type of operation, the priority of the second type of operation is higher than the priority of the third type of operation, and the relationship between the priority of the fourth type of operation and the priorities of the first type of operation, the second type of operation, and the third type of operation is set according to a preset condition.
9. A video processing device, characterized in that, The device includes: The second operation determination module is configured to determine a plurality of target operations based on the parameter change amount between the initial parameters of the video to be processed and the target parameters of the target still image; wherein, the plurality of target operations include: frame extraction and frame operations after frame extraction, and the frame operations include: at least one of cropping, stretching, adding a watermark, and color adjustment; The second order determination module is configured to determine the operation category to which each target operation belongs in a preset operation category based on the device according to claim 8, and determine the processing order of the plurality of target operations based on the priority of the operation category to which each target operation belongs; The second instruction generation module is configured to generate a processing instruction regarding the plurality of target operations based on the processing order; The second execution module is configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream according to the processing order, and encodes the video stream after the operation to obtain the target still image.
10. A video processing device, characterized in that, The device includes: A third operation determination module, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target animated image; wherein, the target operations include multiple ones of frame dropping, merging, cropping, color grading, and scaling; A third sequence determination module, configured to determine, based on the device described in claim 8, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on the priority of the operation category to which each target operation belongs; A third instruction generation module, configured to generate a processing instruction regarding the plurality of target operations based on the processing sequence; A third execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream in accordance with the processing sequence, and encodes the operated video stream to obtain the target animated image.
11. A video processing device, characterized in that, The device includes; A fourth operation determination module, configured to determine a plurality of target operations based on a parameter change amount between an initial parameter of a video to be processed and a target parameter of a target video; wherein, the target operations include multiple ones of frame dropping, merging, cropping, color grading, and scaling; A fourth sequence determination module, configured to determine, based on the device described in claim 8, an operation category to which each target operation belongs in a preset operation category, and determine a processing sequence of the plurality of target operations based on the priority of the operation category to which each target operation belongs; A fourth instruction generation module, configured to generate a processing instruction regarding the plurality of target operations based on the processing sequence; A fourth execution module, configured to send the processing instruction to a video processing tool, so that the video processing tool decodes the video to be processed, executes the plurality of target operations on the decoded video stream in accordance with the processing sequence, and encodes the operated video stream to obtain the target video.
12. An electronic device, characterized in that, It includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus; The memory is used for storing a computer program; The processor, when executing the program stored on the memory, implements the method steps described in any one of claims 1-7.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, the method steps described in any one of claims 1-7 are implemented.
Citation Information
Patent Citations
Video processing method and device
CN112788366A
System and method for efficient automatic design and tuning of video processing systems
US20020168010A1