A method and system for adaptive code stream parallel transcoding based on sub-stream division

Through the parallel transcoding method based on substream division, the problems of long transcoding time and idle resources are solved, efficient transcoding timestamp alignment and resource utilization are achieved, and the overall transcoding time is shortened.

CN115914184BActive Publication Date: 2025-08-26WUHAN DONGHU UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211374845.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-11-04
Publication Date
2025-08-26
Estimated Expiration
2042-11-04

AI Technical Summary

Technical Problem

In the process of long-term video transcoding, the prior art has the problem of excessive transcoding time and idle transcoding machine resources, especially when the number of sub-streams in the adaptive code stream is large and the specifications are high, it is impossible to efficiently utilize transcoding machine resources.

Method used

The parallel transcoding method based on substream division is adopted, and the molecular set is divided by calculating the transcoding calculation threshold value, and distributed transcoding is performed using multiple transcoding machines in parallel. The reference substream is introduced to ensure the alignment of audio and video timestamps, and the final index file is constructed.

Benefits of technology

This greatly shortens the transcoding time and effectively utilizes the transcoding machine resources, ensuring the accurate alignment of audio and video timestamps of various result files, and improving the transcoding efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115914184B_ABST
    Figure CN115914184B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for parallel transcoding of adaptive bitstreams based on substream division, the method comprising: parallel transcoding number calculation, parallel adaptive bitstream construction, distributed parallel transcoding, and transcoding result construction. The present invention can implement static and dynamic subset division of a complete adaptive bitstream task, construction of an audio and video timestamp reference substream, and multi-channel subsets with reference substreams, and then select the most idle transcoder in the transcoding cluster to perform transcoding in parallel, thereby greatly shortening the transcoding time, effectively utilizing idle transcoder resources within the transcoding cluster, and accurately aligning the audio and video timestamps of all substreams; compared to a complete one-time execution, the overall execution time is greatly shortened, and the audio and video timestamps of each result file are exactly the same as those of a complete one-time execution.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of adaptive code streams, and in particular relates to a method and system for adaptive code stream parallel transcoding based on sub-stream division. Background Art

[0002] Adaptive bitrate streaming (ABT) is a streaming feature that includes audio and video sub-streams at multiple bitrates, such as smooth, standard definition, high definition, full HD, 2K, and 4K. With adaptive bitrate streaming, the player dynamically selects the most appropriate bitrate for playback based on the current bandwidth.

[0003] Adaptive bitstreaming requires that the audio and video timestamps of all substreams be aligned to ensure zero-stuttering and consistent audio and video synchronization when switching between substreams. Traditional transcoding systems perform a complete adaptive bitstream transcoding operation in one go to ensure the alignment of audio and video timestamps for all substreams. This presents a significant drawback when transcoding long videos, involving a high number of substreams and high output specifications: a single complete transcoding operation consumes an extremely long execution time. This results in a significant wait time for the transcoded result file to be retrieved, and even if a large number of available transcoders exist within the transcoding cluster, only one can be used, leaving transcoder resources idle. Summary of the Invention

[0004] The present invention provides a method and system for adaptive code stream parallel transcoding based on sub-stream division, which can utilize multiple transcoding machines to simultaneously perform distributed transcoding operations on an adaptive code stream task and ensure that the audio and video timestamps of the sub-stream result files on the multiple transcoding machines are all aligned.

[0005] The present invention adopts the following technical solutions:

[0006] A method for adaptive code stream parallel transcoding based on sub-stream division includes the following steps:

[0007] (1) Calculation of parallel transcoding number

[0008] Evaluate the transcoding computational effort of each substream in the adaptive bitstream; obtain a transcoding computational effort threshold, and divide the substreams or a collection of multiple substreams whose transcoding computational effort is greater than or equal to the threshold into a subset. The total number of subsets is the static parallel transcoding number;

[0009] Get the sub-threshold value for transcoding load. The number of transcoding machines with a transcoding load less than the sub-threshold value is the number of dynamic parallel transcoding machines.

[0010] If the dynamic parallel transcoding number is greater than or equal to the static parallel transcoding number, the final parallel transcoding number is the static parallel transcoding number, and the parallel transcoding set partition is the set partition corresponding to the static parallel transcoding number; if the dynamic parallel transcoding number is less than the static parallel transcoding number, the final parallel transcoding number is the dynamic parallel transcoding number, and the subset is re-partitioned according to the dynamic parallel transcoding number and the subset dynamic partitioning algorithm to obtain the parallel transcoding set partition;

[0011] (2) Parallel Adaptive Bitstream Construction

[0012] Based on the core parameters that affect audio and video timestamps: video frame rate and audio sampling rate, a baseline substream with the minimum transcoding computation is constructed, and the baseline substream is added as the first substream to the subset divided into the parallel transcoding set;

[0013] (3) Distributed parallel transcoding

[0014] Select transcoding machines with the same number as the final number of parallel transcoding machines to perform parallel transcoding;

[0015] (4) Transcoding result construction

[0016] For the result files after parallel transcoding, parse each index file and generate the final index file.

[0017] Furthermore, the calculation formula for sub-stream transcoding is: video resolution width * video resolution height * video frame rate.

[0018] Furthermore, a subset static partitioning algorithm is used to partition the subsets to obtain the static parallel transcoding number; the subset static partitioning algorithm is as follows:

[0019] S11. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding calculation amount;

[0020] S12, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0021] S13, select the next sub-stream in sequence;

[0022] S14, determine whether the next sub-flow exists; if so, execute step S15; if not, execute step S16;

[0023] S15. Add the transcoding computation amount of the substream to the computation amount sum, and sequentially add the substreams to the subset; determine whether the computation amount sum is greater than or equal to the transcoding computation amount threshold; if so, divide the substream into a new subset and execute step S12; if not, execute step S13;

[0024] S16. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end.

[0025] Furthermore, the subset dynamic partitioning algorithm is as follows:

[0026] S21. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding computational effort; the number of dynamic parallel transcodings is used as the total number of remaining segments;

[0027] S22. Calculate the lower limit of the remaining average value = (the total amount of remaining calculations / the total number of remaining divisions) * Ratio; Ratio is a variable;

[0028] S23, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0029] S24, select the next sub-stream in reverse order;

[0030] S25. Determine whether the next sub-flow exists; if so, execute step S26; if not, execute step S28;

[0031] S26. Add the transcoding computational cost of the substream to the computational cost sum, and sequentially add the substreams to the subset; determine whether the computational cost sum is greater than or equal to the lower limit of the remaining average value; if so, divide the substream into a new subset, reduce the total number of remaining partitions by one, and execute step S27; if not, execute step S24;

[0032] S27, determine whether the total number of remaining partitions is 1; if so, take the remaining sub-stream as the last subset; if not, execute step S22;

[0033] S28. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end;

[0034] Among them, each value of the variable Ratio corresponds to obtaining a set partition.

[0035] Furthermore, Ratio takes multiple values, corresponding to obtaining multiple set partitions;

[0036] The computational amount of all subsets corresponding to each set partitioning constitutes a computational amount series. The volatility of the series is obtained by calculating the variance. The set partitioning with the smallest volatility, that is, the smallest variance, is the parallel transcoding set partitioning.

[0037] Furthermore, the audio and video parameters of the reference substream are as follows:

[0038] The video encoding format is the same as the video encoding format of the original first sub-stream, the video resolution is 2*2, and the video frame rate is the same as the video frame rate of the original first sub-stream;

[0039] The audio coding format is the same as the audio coding format of the original first sub-stream, the audio sampling rate is the same as the audio sampling rate of the original first sub-stream, and the number of audio channels is at least 1.

[0040] Furthermore, the result files after parallel transcoding are divided into two categories: audio and video media slice files and index files;

[0041] The audio and video media slice files of each sub-stream are directly copied; the multiple index files generated are re-parsed and then the final index file is generated.

[0042] A system for adaptive code stream parallel transcoding based on sub-stream division, comprising:

[0043] The parallel transcoding number calculation module is used to evaluate the transcoding computational load of each substream in the adaptive bitstream; obtain a transcoding computational load threshold, and divide the substreams or the accumulated multiple substream sets whose transcoding computational load is greater than or equal to the threshold into a subset, where the total number of subsets is the static parallel transcoding number; and is also used to obtain a sub-transcoding load threshold, and the number of transcoding machines whose transcoding load is less than the sub-transcoding load threshold is the dynamic parallel transcoding number; if the dynamic parallel transcoding number is greater than or equal to the static parallel transcoding number, then the final parallel transcoding number is the static parallel transcoding number, and the parallel transcoding set partition is the set partition corresponding to the static parallel transcoding number; if the dynamic parallel transcoding number is less than the static parallel transcoding number, then the final parallel transcoding number is the dynamic parallel transcoding number, and the subset is re-divided according to the dynamic parallel transcoding number and the subset dynamic partitioning algorithm to obtain the parallel transcoding set partition;

[0044] The parallel adaptive bitstream construction module is used to construct a reference substream with the minimum transcoding computational complexity based on the core parameters that affect audio and video timestamps: video frame rate and audio sampling rate, and add the reference substream as the first substream to the subset divided by the parallel transcoding set;

[0045] Distributed parallel transcoding is used to select a number of transcoding machines equal to the final number of parallel transcoding machines for parallel transcoding;

[0046] The transcoding result structure is used to parse each index file and generate the final index file for the result file after parallel transcoding.

[0047] Furthermore, the parallel transcoding number calculation module uses a subset static partitioning algorithm to partition the subset to obtain a static parallel transcoding number; the subset static partitioning algorithm is as follows:

[0048] S11. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding calculation amount;

[0049] S12, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0050] S13, select the next sub-stream in sequence;

[0051] S14, determine whether the next sub-flow exists; if so, execute step S15; if not, execute step S16;

[0052] S15. Add the transcoding computation amount of the substream to the computation amount sum, and sequentially add the substreams to the subset; determine whether the computation amount sum is greater than or equal to the transcoding computation amount threshold; if so, divide the substream into a new subset and execute step S12; if not, execute step S13;

[0053] S16. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end.

[0054] Furthermore, the subset dynamic partitioning algorithm in the parallel transcoding number calculation module is as follows:

[0055] S21. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding computational effort; the number of dynamic parallel transcodings is used as the total number of remaining segments;

[0056] S22. Calculate the lower limit of the remaining average value = (the total amount of remaining calculations / the total number of remaining divisions) * Ratio; Ratio is a variable;

[0057] S23, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0058] S24, select the next sub-stream in reverse order;

[0059] S25. Determine whether the next sub-flow exists; if so, execute step S26; if not, execute step S28;

[0060] S26. Add the transcoding computational cost of the substream to the computational cost sum, and sequentially add the substreams to the subset; determine whether the computational cost sum is greater than or equal to the lower limit of the remaining average value; if so, divide the substream into a new subset, reduce the total number of remaining partitions by one, and execute step S27; if not, execute step S24;

[0061] S27, determine whether the total number of remaining partitions is 1; if so, take the remaining sub-stream as the last subset; if not, execute step S22;

[0062] S28. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end;

[0063] Among them, each value of the variable Ratio corresponds to a set partitioning; when Ratio takes multiple values, multiple set partitionings are obtained. The computational amount of all subsets corresponding to each set partitioning constitutes a computational amount series, and the volatility of the series is obtained by calculating the variance. The set partitioning with the smallest volatility, that is, the smallest variance, is the parallel transcoding set partitioning.

[0064] Compared with the prior art, the present invention has the following advantages and beneficial effects:

[0065] The present invention can realize the division of a complete adaptive code stream task into static and dynamic subsets, the construction of audio and video timestamp reference substreams, and the multi-channel subsets with reference substreams, and then select the most idle transcoder in the transcoding cluster to perform transcoding in parallel, thereby greatly shortening the transcoding time, effectively utilizing the idle transcoder resources within the transcoding cluster, and accurately aligning the audio and video timestamps of all substreams; compared with a complete one-time execution, the overall execution time is greatly shortened, and the audio and video timestamps of each result file are exactly the same as those of a complete one-time execution. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 This is a system block diagram of the adaptive code stream parallel transcoding based on sub-stream division of the present invention;

[0067] Figure 2 is a flow chart of the subset static partitioning algorithm of the present invention;

[0068] Figure 3 is a flow chart of the single subset dynamic partitioning algorithm of the present invention;

[0069] Figure 4 It is a flow chart of selecting the optimal dynamic partitioning of the present invention. DETAILED DESCRIPTION

[0070] In order to make the objectives, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely for the purpose of explaining the present invention and are not intended to limit the present invention. In addition, the technical features involved in the various embodiments of the present invention described below may be combined with each other as long as they do not conflict with each other.

[0071] In order to utilize multiple transcoders to simultaneously perform distributed transcoding operations on an adaptive bitstream task, and to ensure that the audio and video timestamps of the result files of each substream on the multiple transcoders are all aligned, the present invention addresses these two problems from the following aspects: dividing the adaptive bitstream task, introducing a transcoding reference substream to ensure the alignment of the audio and video timestamps of each channel, merging the result files of each channel, parsing the index file, and generating a new index file. Through the collaboration of the above modules, the distributed parallel execution of the adaptive bitstream is completed together, and the audio and video timestamps of all substreams are accurately aligned. Compared with a complete one-time execution, the overall execution time is greatly shortened, and the audio and video timestamps of each result file are exactly the same as those of a complete one-time execution.

[0072] The system of the present invention for adaptive code stream parallel transcoding based on sub-stream division is as follows: Figure 1 As shown, including:

[0073] 1. Parallel transcoding calculation module

[0074] 1.1 Transcoding calculation formula

[0075] The present invention requires evaluating the transcoding computational cost of each sub-stream in the adaptive bitstream. The sub-stream transcoding computational cost formula is: video resolution width * video resolution height * video frame rate.

[0076] The following uses "adaptive bitstream containing six sub-streams: smooth, standard definition, high definition, full high definition, 2K, and 4K" as an example to show the transcoding computational workload results. The transcoding computational workload results are shown in Table 1.

[0077] Table 1 Transcoding calculation results of the adaptive code stream of six sub-streams

[0078]

[0079]

[0080] 1.2 Subset static partitioning algorithm

[0081] Assume that the transcoding computation threshold specification for the parallel transcoding division of sub-stream sets configured in the system is: high-definition 1280*720 frame rate 30fps, that is, the division threshold is 27648000, which means that sub-streams or accumulated sub-stream sets greater than or equal to this threshold can participate in the parallel execution of the present invention as a single channel (this threshold reflects the vertical transcoding performance of the transcoder in the transcoding cluster. The stronger the performance, the higher the threshold can be configured). The detailed process of the subset static division algorithm is as follows: Figure 2 As shown, the steps are as follows:

[0082] S11. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding calculation amount;

[0083] S12, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0084] S13, select the next sub-stream in sequence;

[0085] S14, determine whether the next sub-flow exists; if so, execute step S15; if not, execute step S16;

[0086] S15. Add the transcoding computation amount of the substream to the computation amount sum, and sequentially add the substreams to the subset; determine whether the computation amount sum is greater than or equal to the transcoding computation amount threshold; if so, divide the substream into a new subset and execute step S12; if not, execute step S13;

[0087] S16. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end.

[0088] Using this static partitioning algorithm, the adaptive bitstream can be partitioned into the following subsets:

[0089] Subset 1: Substream 1 + Substream 2 + Substream 3, the total transcoding computation is: 45388800

[0090] Subset 2: Substream 4, transcoding computational cost: 49766400

[0091] Subset 3: Substream 5, transcoding computational cost: 81100800

[0092] Subset 4: Substream 6, transcoding computational cost: 165,888,000

[0093] There are 4 subsets in total, and the total number of subsets is the number of static parallel transcoding.

[0094] 1.3. Get the number of dynamic parallel transcoding

[0095] The number of dynamic parallel transcoding is determined by the load of the transcoding cluster at that time. Assuming that the system-configured transcoding load threshold is less than 80%, the number of transcoding machines in the cluster with a transcoding load less than 80% is the number of dynamic parallel transcoding.

[0096] 1.4. Calculate the final number of parallel transcoding

[0097] The final number of parallel transcoding is equal to the smaller value of the static parallel transcoding number or the dynamic parallel transcoding number.

[0098] If the number of dynamic parallel transcoding is greater than or equal to the number of static parallel transcoding, then the final number of parallel transcoding is the static number of parallel transcoding, and the parallel transcoding set partitioning is the set partitioning when calculating the static number of parallel transcoding, that is, the partitioning is performed according to the subset static partitioning algorithm.

[0099] If the number of dynamic parallel transcoding is less than the number of static parallel transcoding, then the final number of parallel transcoding is the dynamic number of parallel transcoding, and the final parallel transcoding set needs to be repartitioned according to the following: subset dynamic partitioning algorithm.

[0100] 1.5 Dynamic Subset Partitioning Algorithm

[0101] like Figure 3As shown in the figure, the dynamic algorithm differs significantly from the static algorithm in the following two points: First, the dynamic algorithm traverses the sub-stream set in reverse order, that is, traverses the sub-streams from the direction of high transcoding computation to low transcoding computation; second, the dynamic algorithm is called multiple times, and the Ratio in the flowchart is the variable called multiple times. For example, the value of the variable starts from 0.95 and decreases by 0.05 each time until it reaches 0.8 (in actual application, the starting and ending values ​​and the change step size can be adjusted), resulting in up to four different partitioning methods. The steps of the subset dynamic partitioning algorithm are as follows:

[0102] S21. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding computational effort; the number of dynamic parallel transcodings is used as the total number of remaining segments;

[0103] S22. Calculate the lower limit of the remaining average value = (the total amount of remaining calculations / the total number of remaining divisions) * Ratio; Ratio is a variable that can be called multiple times;

[0104] S23, the calculated amount and the sum are set to 0, and the subset content is cleared;

[0105] S24, select the next sub-stream in reverse order;

[0106] S25. Determine whether the next sub-flow exists; if so, execute step S26; if not, execute step S28;

[0107] S26. Add the transcoding computational cost of the substream to the computational cost sum, and sequentially add the substreams to the subset; determine whether the computational cost sum is greater than or equal to the lower limit of the remaining average value; if so, divide the substream into a new subset, reduce the total number of remaining partitions by one, and execute step S27; if not, execute step S24;

[0108] S27, determine whether the total number of remaining partitions is 1; if so, take the remaining sub-stream as the last subset; if not, execute step S22;

[0109] S28. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end.

[0110] Assuming the number of dynamic parallel transcoding is 3, which is also the final number of parallel transcoding, the adaptive bitstream of the example is executed four times with different ratios, and the following subset division is made:

[0111] Ratio=0.95 is divided into:

[0112] Subset 1: Substream 1 + Substream 2 + Substream 3, the total transcoding computation is 45388800;

[0113] Subset 2: Substream 4 + Substream 5, transcoding computational cost: 130,867,200;

[0114] Subset 3: Substream 6, transcoding computational effort: 165,888,000.

[0115] Ratio=0.9 is divided into:

[0116] Subset 1: Substream 1 + Substream 2 + Substream 3 + Substream 4, the total transcoding computation is 95155200;

[0117] Subset 2: Substream 5, transcoding computational cost: 81100800;

[0118] Subset 3: Substream 6, transcoding computational effort: 165,888,000.

[0119] The division results of Ratio=0.85 and Ratio=0.8 are consistent with Ratio=0.9.

[0120] In summary, after trying to execute the dynamic algorithm four times, we obtained two different partitioning results. For a specific partition, the computational cost of all subsets constitutes a computational cost sequence. For example, the partition with Ratio = 0.95 corresponds to the sequence: {45388800, 130867200, 165888000}. The following mainly uses the method of calculating variance to obtain the volatility of this sequence. For all possible dynamic partition combinations, the partition with the minimum volatility, that is, the minimum variance, is the final optimal dynamic partition, such as Figure 4 As shown:

[0121] Finally, by calculating the variance of each partition, the variance is minimized, that is, the optimal partition is:

[0122] Subset 1: Substream 1 + Substream 2 + Substream 3 + Substream 4, the total transcoding computation is 95155200;

[0123] Subset 2: Substream 5, transcoding computational cost: 81100800;

[0124] Subset 3: Substream 6, transcoding computational effort: 165,888,000.

[0125] 2. Parallel adaptive bitstream construction module

[0126] By observing the result file of a complete adaptive bitstream execution, the following conclusions can be drawn:

[0127] 1) The video start timestamps of all sub-streams are aligned to the video start timestamp of the first sub-stream;

[0128] 2) The video start timestamp of the first sub-stream is related to the frame rate. The higher the frame rate, the smaller the start timestamp.

[0129] 3) The second audio frame timestamps of all sub-streams are aligned with the video start timestamp of the first sub-stream;

[0130] 4) The audio start timestamps of all substreams are related to the sampling rate. The higher the sampling rate, the larger the start timestamp.

[0131] Therefore, the first sub-stream of the original adaptive bitstream is used as the reference bitstream for the entire adaptive bitstream, providing a reference for audio and video timestamps. The key video parameter is the frame rate, and the key audio parameter is the sampling rate.

[0132] For subset 1, since the first stream is substream 1, the audio and video timestamps of all other streams in subset 1 are automatically aligned to substream 1. For other subsets that do not include substream 1, a reference stream must be introduced as the first stream. A feasible but inefficient approach is to directly introduce the original substream 1 as the first stream of subsequent subsets. This can achieve audio and video timestamp alignment, but the encoding parameters of the original substream 1 are high, and the encoding computational complexity is not negligible, thus affecting transcoding efficiency. The best approach is to construct a reference substream that minimizes the transcoding computational complexity based on the core parameters that influence audio and video timestamps: video frame rate and audio sampling rate. The audio and video parameters of the reference substream are shown in Table 2.

[0133] Table 2 Audio and video parameters of the reference substream

[0134]

[0135]

[0136] On the basis of the optimal dynamic partitioning, for the subsets other than the one containing the original first sub-stream, the new subset partitioning after adding the reference sub-stream as the first sub-stream is shown in Table 3.

[0137] Table 3 New partitioning table after adding reference sub-flow

[0138]

[0139] 3. Distributed parallel transcoding

[0140] Based on the new subset division, after selecting three transcoders for parallel transcoding, the audio and video timestamps of the target sub-stream are aligned with the original first sub-stream.

[0141] 4. Transcoding result construction module

[0142] The resulting files from parallel execution are divided into two categories: audio and video media slice files and index files. For example, the HLS encapsulation format corresponds to a two-level .m3u8 index file, and the MPEG-DASH encapsulation format corresponds to a .mpd index file. The audio and video media slice files for each sub-stream have already been transcoded using the target audio and video parameters, so they can be copied directly.

[0143] It is necessary to continue re-parsing the multiple index files generated by parallel execution, and then generate the final index file. Parse and rewrite the .m3u8 and .mpd index files. There are already a large number of implementations, such as open source algorithms that can be used.

[0144] In summary, the present invention can realize the division of a complete adaptive task into static and dynamic subsets, the construction of audio and video timestamp reference substreams, and the multi-channel subsets with reference substreams. Then, the idlest transcoder in the transcoding cluster is selected to perform transcoding in parallel, thereby greatly shortening the transcoding time and effectively utilizing the idle transcoding machine resources within the transcoding cluster.

[0145] It will be easily understood by those skilled in the art that the above are merely preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A method for adaptive code stream parallel transcoding based on sub-stream division, characterized in that: The following steps are involved: (1) Calculation of parallel transcoding number Evaluate the transcoding computational effort of each substream in the adaptive bitstream. Obtain a transcoding computational effort threshold and use a static subset partitioning algorithm to partition the substreams. The total number of substreams is the static parallel transcoding number. The static subset partitioning algorithm is as follows: S11. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding calculation amount; S12, the calculated amount and the sum are set to 0, and the subset content is cleared; S13, select the next sub-stream in sequence; S14, determine whether the next sub-flow exists; if so, execute step S15; if not, execute step S16; S15. Add the transcoding computation amount of the substream to the computation amount sum, and sequentially add the substreams to the subset; determine whether the computation amount sum is greater than or equal to the transcoding computation amount threshold; if so, divide the substream into a new subset and execute step S12; if not, execute step S13; S16. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end; Get the sub-threshold value for transcoding load. The number of transcoding machines with a transcoding load less than the sub-threshold value is the number of dynamic parallel transcoding machines. If the number of dynamic parallel transcoding is greater than or equal to the number of static parallel transcoding, the final number of parallel transcoding is the static number of parallel transcoding, and the parallel transcoding set partition is the set partition corresponding to the static number of parallel transcoding. If the number of dynamic parallel transcoding is less than the static number of parallel transcoding, the final number of parallel transcoding is the dynamic number of parallel transcoding, and the subset is re-partitioned according to the dynamic number of parallel transcoding and the subset dynamic partitioning algorithm to obtain the parallel transcoding set partition. The subset dynamic partitioning algorithm is as follows: S21. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding computational effort; the number of dynamic parallel transcodings is used as the total number of remaining segments; S22. Calculate the lower limit of the remaining average value = (the total amount of remaining calculations / the total number of remaining divisions) * Ratio; Ratio is a variable; S23, the calculated amount and the sum are set to 0, and the subset content is cleared; S24, select the next sub-stream in reverse order; S25. Determine whether the next sub-flow exists; if so, execute step S26; if not, execute step S28; S26. Add the transcoding computational cost of the substream to the computational cost sum, and sequentially add the substreams to the subset; determine whether the computational cost sum is greater than or equal to the lower limit of the remaining average value; if so, divide the substream into a new subset, reduce the total number of remaining partitions by one, and execute step S27; if not, execute step S24; S27, determine whether the total number of remaining partitions is 1; if so, take the remaining sub-stream as the last subset; if not, execute step S22; S28. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end; Each time the variable Ratio takes a value, a corresponding set partition is obtained; when Ratio takes multiple values, multiple set partitions are obtained. The computational load of all subsets corresponding to each set partition constitutes a computational load sequence, and the volatility of the sequence is obtained by calculating the variance. The set partition with the smallest volatility, that is, the smallest variance, is the parallel transcoding set partition. (2) Parallel Adaptive Bitstream Construction Based on the core parameters that affect audio and video timestamps: video frame rate and audio sampling rate, a reference substream is constructed and added as the first substream to the subset of the parallel transcoding set. The audio and video parameters of the reference substream are as follows: The video encoding format is the same as the video encoding format of the original first sub-stream, the video resolution is 2*2, and the video frame rate is the same as the video frame rate of the original first sub-stream; The audio coding format is the same as the audio coding format of the original first sub-stream, the audio sampling rate is the same as the audio sampling rate of the original first sub-stream, and the number of audio channels is at least 1; (3) Distributed parallel transcoding Select transcoding machines with the same number as the final number of parallel transcoding machines to perform parallel transcoding; (4) Transcoding result construction For the result file after parallel transcoding, parse each index file and generate the final index file, specifically: The result files after parallel transcoding are divided into two categories: audio and video media slice files and index files; The audio and video media slice files of each sub-stream are directly copied; the multiple index files generated are re-parsed and then the final index file is generated.

2. The method for adaptive code stream parallel transcoding based on sub-stream division according to claim 1, characterized in that: The calculation formula for sub-stream transcoding is: video resolution width * video resolution height * video frame rate.

3. A system for adaptive code stream parallel transcoding based on sub-stream division, characterized in that: The method for implementing the adaptive code stream parallel transcoding based on sub-stream division according to claim 1 or 2 comprises: The parallel transcoding number calculation module is used to evaluate the transcoding computational amount of each substream in the adaptive bitstream; obtain a transcoding computational amount threshold, and divide the substreams whose transcoding computational amount is greater than or equal to the threshold or a set of multiple substreams whose cumulative transcoding computational amount is greater than or equal to the threshold into a subset, where the total number of subsets is the static parallel transcoding number; and is also used to obtain a sub-transcoding load threshold, and the number of transcoding machines whose transcoding load is less than the sub-transcoding load threshold, which is the dynamic parallel transcoding number; if the dynamic parallel transcoding number is greater than or equal to the static parallel transcoding number, then the final parallel transcoding number is the static parallel transcoding number, and the parallel transcoding set partition is the set partition corresponding to the static parallel transcoding number; if the dynamic parallel transcoding number is less than the static parallel transcoding number, then the final parallel transcoding number is the dynamic parallel transcoding number, and the subset is re-divided according to the dynamic parallel transcoding number and the subset dynamic partitioning algorithm to obtain the parallel transcoding set partition; The parallel adaptive bitstream construction module is used to construct a reference substream based on the core parameters that affect audio and video timestamps: video frame rate and audio sampling rate, and add the reference substream as the first substream to the subset divided by the parallel transcoding set; Distributed parallel transcoding is used to select a number of transcoding machines equal to the final number of parallel transcoding machines for parallel transcoding; The transcoding result structure is used to parse each index file and generate the final index file for the result file after parallel transcoding.

4. The system for adaptive code stream parallel transcoding based on sub-stream division according to claim 3, characterized in that: The parallel transcoding number calculation module uses a subset static partitioning algorithm to divide the subset to obtain the static parallel transcoding number; the subset static partitioning algorithm is as follows: S11. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding calculation amount; S12, the calculated amount and the sum are set to 0, and the subset content is cleared; S13, select the next sub-stream in sequence; S14, determine whether the next sub-flow exists; if so, execute step S15; If not, proceed to step S16; S15. Add the transcoding computation amount of the substream to the computation amount sum, and sequentially add the substreams to the subset; determine whether the computation amount sum is greater than or equal to the transcoding computation amount threshold; if so, divide the substream into a new subset and execute step S12; If not, proceed to step S13; S16. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end.

5. The system for adaptive code stream parallel transcoding based on sub-stream division according to claim 3, characterized in that: The subset dynamic partitioning algorithm in the parallel transcoding number calculation module is as follows: S21. Sort the sub-streams in the adaptive bitstream in ascending order according to the transcoding computational effort; the number of dynamic parallel transcodings is used as the total number of remaining segments; S22. Calculate the lower limit of the remaining average value = (the total amount of remaining calculations / the total number of remaining divisions) * Ratio; Ratio is a variable; S23, the calculated amount and the sum are set to 0, and the subset content is cleared; S24, select the next sub-stream in reverse order; S25. Determine whether the next sub-flow exists; if so, proceed to step S26; If not, proceed to step S28; S26. Add the transcoding computational cost of the substream to the computational cost sum, and sequentially add the substreams to the subset; determine whether the computational cost sum is greater than or equal to the lower limit of the remaining average value; if so, divide the substream into a new subset, reduce the total number of remaining partitions by one, and execute step S27; if not, execute step S24; S27, determine whether the total number of remaining partitions is 1; if so, take the remaining sub-stream as the last subset; if not, execute step S22; S28. Determine whether the subset content is non-empty; if so, divide it to obtain a new subset; if not, end; Among them, each value of the variable Ratio corresponds to a set partitioning; when Ratio takes multiple values, multiple set partitionings are obtained. The computational amount of all subsets corresponding to each set partitioning constitutes a computational amount series, and the volatility of the series is obtained by calculating the variance. The set partitioning with the smallest volatility, that is, the smallest variance, is the parallel transcoding set partitioning.

Citation Information

Patent Citations

  • Method of converting compound protocol in multimedia broadcasting network

    CN101179737A

  • Transcoding control method and device and electronic equipment

    CN112543373A