Summary of the invention
The embodiment of the invention provides a kind of transcoding distribution method and device, and code-transferring method and equipment are used for improving transcoding efficiency.
A kind of transcoding distribution method is applied to the user's side in the cloud platform, may further comprise the steps:
Acquisition treat transcoding each video segment the transcoding complexity and constitute the transcoding performance value of each computing equipment of described cloud platform;
Obtain each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding;
Judge first video segment on first computing equipment required transcoding time whether greater than described first average time;
When judged result for not the time, described first video segment is assigned on described first computing equipment carries out transcoding.
A kind of code-transferring method is applied to the user's side in the cloud platform, may further comprise the steps:
The video for the treatment of transcoding is carried out cutting, obtain to treat each video segment of transcoding;
According to described transcoding distribution method each described video segment is distributed;
The described video segment that each computing equipment in described cloud platform will distribute carries out after transcoding finishes, and obtains the video segment behind the transcoding, and it is treated to video behind the transcoding.
A kind of transcoding distributor is applied to the user's side in the cloud platform, comprising:
First acquisition module, be used for to obtain to treat transcoding each video segment the transcoding complexity and constitute the transcoding performance value of each computing equipment of described cloud platform;
Second acquisition module obtains each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding;
Judge module, be used for judging first video segment on first computing equipment required transcoding time whether greater than described first average time;
Distribution module, be used for when judged result when denying, described first video segment is assigned on described first computing equipment carries out transcoding.
A kind of transcoding equipment is applied to the user's side in the cloud platform, comprising:
The cutting module is used for treating that the video of transcoding carries out cutting, obtains to treat each video segment of transcoding;
The transcoding distributor is used for each described video segment is distributed;
Processing module is used for described video segment that each computing equipment at described cloud platform will distribute and carries out after transcoding finishes, and the video segment behind the acquisition transcoding is treated to video behind the transcoding with it.
Code-transferring method in the embodiment of the invention is for the transcoding complexity of each video segment of obtaining to treat transcoding and constitute the transcoding performance value of each computing equipment of described cloud platform; Obtain each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding; Judge first video segment on first computing equipment required transcoding time whether greater than described first average time; When judged result for not the time, described first video segment is assigned on described first computing equipment carries out transcoding.Obtain each described computing equipment according to the transcoding performance value of the transcoding complexity of each video segment that obtains and each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding, when the transcoding time of a video segment on a computing equipment is not more than described first average time, this video segment is assigned on this computing equipment, thereby the self-characteristic according to each video segment and each computing equipment is assigned to each video segment on the different computing equipments, save the transcoding time, improve transcoding efficiency.
Embodiment
Transcoding distribution method in the embodiment of the invention is for the transcoding complexity of each video segment of obtaining to treat transcoding and constitute the transcoding performance value of each computing equipment of described cloud platform; Obtain each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding; Judge first video segment on first computing equipment required transcoding time whether greater than described first average time; When judged result for not the time, described first video segment is assigned on described first computing equipment carries out transcoding.Obtain each described computing equipment according to the transcoding performance value of the transcoding complexity of each video segment that obtains and each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding, when the transcoding time of a video segment on a computing equipment is not more than described first average time, this video segment is assigned on this computing equipment, thereby the self-characteristic according to each video segment and each computing equipment is assigned to each video segment on the different computing equipments, save the transcoding time, improve transcoding efficiency.
Referring to Fig. 1, the transcoding distributor in the embodiment of the invention comprises first acquisition module 101, second acquisition module 102, judge module 103 and distribution module 104.Device can be applied to the user's side in the cloud platform described in the embodiment of the invention, namely can be arranged in arbitrary the computing equipment that constitutes the cloud platform.The performance of each computing equipment can be the same or different in the computing equipment of formation cloud platform.
First acquisition module 101 be used for obtaining treating transcoding each video segment the transcoding complexity and constitute the transcoding performance value of each computing equipment of described cloud platform.
At first, first acquisition module 101 need obtain some parameters that are used for calculating scheduling, and described parameter comprises the transcoding complexity of each video segment at least and constitutes the transcoding performance value of each computing equipment of described cloud platform.In the computing equipment that constitutes the cloud platform performance of each computing equipment not simultaneously, first acquisition module 101 needs to obtain to constitute the transcoding performance value of each computing equipment of described cloud platform.First acquisition module 101 can obtain the video segment that segments from cutting module 105, can estimate the transcoding complexity of each video segment then.Suppose to have n the video segment after the cutting, be designated as respectively V=(1,2 ..., n), wherein n is not less than 2 integer, their transcoding complexity of acquisition can be designated as respectively C=(c1, c2 ..., cn).First acquisition module 101 can obtain the transcoding historical record of each computing equipment of formation cloud platform to the server request simultaneously, from the described transcoding historical record of each computing equipment, first acquisition module 101 can estimate the transcoding performance value of various computing equipment.Wherein, described server can be the management equipment of cloud platform, and it can be served as by arbitrary computing equipment in the computing equipment that constitutes the cloud platform, perhaps can be served as by special computing equipment.Suppose to have m platform computing equipment, m is the integer more than or equal to 1, their transcoding performance value can be designated as respectively P=(p1, p2 ..., pn).Can estimate simultaneously each video segment as the start-up time of task on various computing equipment, and can obtain video segment mean value start-up time the start-up time on various computing equipment according to each video segment, this video segment mean value start-up time can be designated as t
OverheadPerhaps, each video segment generally is more or less the same the start-up time on various computing equipment, even can ignore its difference, therefore also can choose one wantonly as t in all start-up times
OverheadBecause the required transcoding time of video segment is directly proportional with the transcoding complexity of video segment itself, be inversely proportional to the transcoding performance value of computing equipment, therefore can obtain an i fragment carries out the required transcoding time of transcoding on j platform Work machine, can be called for the first transcoding time, can use t
IjExpression, wherein i, j are and are not less than 1 integer:
The described transcoding performance value that second acquisition module 102 is used for described transcoding complexity, each computing equipment according to each video segment obtains each described computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding.
Can be according to the t that has obtained
IjCalculate all video segments and carry out transcoding required average time at its computing equipment that is assigned with, namely each described computing equipment carries out transcoding required average time to the described video segment that distributes respectively, can be called for first average time:
Then with this as a reference, allow every required transcoding time of computing equipment try not to surpass this first average time.Can use f
jRepresent the transcoding time that j platform computing equipment is required, because every computing equipment carries out the process that transcoding all is serial to video segment, that is, a computing equipment once can only carry out transcoding to a video segment, and can not carry out transcoding to a plurality of video segments simultaneously, so f
jShould equal all and be assigned to the required transcoding time sum of video segment on this computing equipment.When initial, the transcoding time of giving tacit consent to all computing equipments is zero, begins to distribute video segment then.
Judge module 103 be used for judging first video segment on first computing equipment required transcoding time whether greater than described first average time.
At first judge module 103 need sort by its transcoding complexity to each video segment of need transcoding, is example with ordering from big to small in the embodiment of the invention, the size of each computing equipment by its transcoding performance value can be sorted from big to small simultaneously.Can obtain two formations after the ordering, be respectively video segment formation to be allocated, and computing equipment formation to be selected.Carry out the branch timing, can from computing equipment formation to be selected, select the best computing equipment of transcoding performance value as current pending computing equipment, namely be positioned at the most forward computing equipment of computing equipment formation described to be selected.From described video segment formation to be allocated, select the video segment of transcoding complexity maximum then, namely be positioned at the described the most forward video segment of video segment formation to be allocated and distribute.Judge module 103 can judge described current pending computing equipment carry out the transcoding of this video segment after the required transcoding time can not overflow, whether the namely required transcoding deadline is not more than described first average time.
Distribution module 104 be used for when judged result when denying, described first video segment is assigned on described first computing equipment carries out transcoding.
When also namely hypothesis distributes i video segment (or being called first video segment) to go up to j platform computing equipment (or being called first computing equipment), if:
f
j+t
ij≤f
* (3)
Then distribution module 104 is determined described first video segment is assigned on described first computing equipment.
Divide timing in the first round, can make the required transcoding time of each computing equipment as far as possible close to described first average time (but being not more than described first average time).For example, have 5 video segments in video segment formation to be allocated, have 3 computing equipments in computing equipment formation to be selected, be 5 seconds described first average time.After first video segment distributed to first computing equipment, judge module 103 determines that first required transcoding time of computing equipment is 2 seconds, distribution module 104 is determined this first video segment is distributed to this first computing equipment, judge module 103 judges whether the required transcoding time of this first computing equipment equals described first average time, because 2<5, then judge module 103 can continue to determine second video segment distributed to the required transcoding time of this first computing equipment behind this first computing equipment again, if the required transcoding time of this first computing equipment was total up to 4.5 seconds after second video segment distributed to this first computing equipment, then distribution module 104 can be determined this second video segment also distributed to this first computing equipment, because of 4.5<5, then judge module 103 can continue to determine the 3rd video segment distributed to the required transcoding time of this first computing equipment behind this first computing equipment, the required transcoding time of this first computing equipment is 7 seconds behind this first computing equipment if the 3rd video segment distributed to, surpassed described first average time, then distribution module 104 is determined and the 3rd video segment can not be distributed to this first computing equipment, can continue to judge whether and the 3rd video segment can be distributed to second computing equipment with same step.
After first round distribution finishes, if judge module 103 determines to also have unappropriated video segment in video segment formation to be allocated by judgement, then judge module 103 can be according to each different video segment, obtain every computing equipment and add the required transcoding time behind this video segment, namely at every computing equipment of each remaining video segment traversal, obtain various computing equipment and add the required transcoding time behind this video segment, therefrom select required minimum computing equipment of transcoding time, notice distribution module 104 is assigned to this video segment in this computing equipment.For example, residue has 3 video segments in video segment formation to be allocated, have 5 computing equipments in the cloud platform (computing equipment formation namely to be selected), then when distributing first remaining video fragment, judge module 103 can obtain it respectively and be assigned to the transcoding time that back five computing equipments need respectively in these five computing equipments, if judge module 103 is determined second computing equipment and adds that the transcoding time required after this first remaining video fragment is minimum that then distribution module 104 is determined this first remaining video fragment allocation in this second computing equipment.And then according to other remaining video fragment of same steps as continuation distribution, be empty up to video segment formation to be allocated.
In first round assigning process, if judge module 103 defines a video segment and is assigned to the required transcoding time of this computing equipment in which computing equipment all greater than described first average time, then distribution module 104 can divide timing this video segment to be assigned in the computing equipment that adds required transcoding time minimum behind this video segment in the first round, perhaps can divide timing to skip this video segment earlier in the first round, it is not handled, treat that the first round distribute to finish back distribution module 104 and it is assigned in the computing equipment that adds required transcoding time minimum behind this video segment, to save the transcoding time as far as possible again.
As shown in Figure 2, the embodiment of the invention also provides a kind of transcoding equipment, and it can also comprise cutting module 105 and processing module 106 except comprising described transcoding distributor.
Cutting module 105 is used for treating that the video of transcoding carries out cutting, obtains to treat each video segment of transcoding.Cutting module 105 is responsible for obtaining the original video data for the treatment of transcoding from the storage of this locality, is at least two video segments that can independently carry out transcoding with its cutting then.In order to guarantee the independence of data between the video segment, need guarantee that (Group of pictures carries out cutting between GOP) in image sets.For there being reference frame to rely between the GOP, need after video segment, add the GOP of a redundancy, so just having guaranteed between two video segments can absolute coding, and the last video that also can guarantee when the video segment behind the transcoding is merged to obtain behind the complete transcoding.
Processing module 106 is used for described video segment that each computing equipment at described cloud platform will distribute carries out after transcoding finishes, and the video segment behind the acquisition transcoding is treated to video behind the transcoding with it.Described processing mode can be to merge.After each computing equipment was all finished the transcoding of all video segments, processing module 106 was obtained the video segment behind each transcoding from described server, can merge in order then.Wherein, cutting module 105 can be numbered the video segment after each cutting after the video that will treat transcoding carries out cutting, so that processing module 106 can merge according to the video segment of number order after with transcoding.For the fragment of the redundancy of having added a GOP, the repetition of a GOP can appear in former and later two fragments when merging, and at this moment can adopt redundant GOP as output.
Adopt described transcoding equipment to finish the transcoding task, can save the transcoding time, improve transcoding efficiency.
The embodiment of the invention also provides a kind of server, and it can be positioned at the network side of cloud platform.Distribution module 104 can be responsible for the distribution result announcement server to give corresponding computing equipment with the corresponding video fragment allocation by server, notifies corresponding computing equipment to carry out transcoding.Announcement server after each computing equipment transcoding is finished, server can send to processing module 106 with the video segment behind the transcoding after the equal transcoding of each computing equipment is finished, merge processing by processing module 106.Wherein, cutting module 105 can be stored in after video slicing is video segment in the local virtual storage region, every the computing equipment that constitutes the cloud platform can have a virtual storage region, and it can constitute a cloud platform virtual storage region, can be by the server unified management.After module 104 to be allocated is distributed each video segment, server is given corresponding computing equipment according to allocation result with the different video fragment allocation, computing equipment carries out transcoding according to the video segment that server sends, after transcoding finishes the video segment behind the transcoding is put into virtual storage region, and announcement server, send to described transcoding distributor by the video segment of server after with transcoding again.
Below introduce transcoding distribution method and code-transferring method in the embodiment of the invention by specific embodiment.
Referring to Fig. 3, the concrete grammar flow process that embodiment of the invention transit code distributes is as follows:
Step 301: acquisition need carry out transcoding each video segment the transcoding complexity and constitute the transcoding performance value of each computing equipment of described cloud platform.
Step 302: obtain each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding.
Step 303: judge first video segment on first computing equipment required transcoding time whether greater than described first average time.When judged result when being, each video segment and each computing equipment are sorted therefore, therefore the computing equipment after can determining is carried out the required transcoding time of described first video segment also can be greater than described first average time, then can temporarily not handle earlier described first video segment, can skip this first video segment and handle next video segment earlier, distribution is handled this first video segment after finishing again in the first round, it is assigned to adds that the required transcoding of this first video segment is after the time in the minimum computing equipment of required transcoding time, perhaps also can be directly divide timing that this first video segment is handled in the first round, it is assigned to adds that the required transcoding of this first video segment is after the time in the minimum computing equipment of required transcoding time.
Step 304: when judged result for not the time, described first video segment is assigned on described first computing equipment carries out transcoding.
Referring to Fig. 4, the specific implementation flow process of embodiment of the invention transit code method is as follows:
Step 401: the video that will treat transcoding carries out cutting, obtains to treat each video segment of transcoding.
Step 402: each described video segment is distributed according to described transcoding distribution method.
Step 403: the described video segment that each computing equipment in described cloud platform will distribute carries out after transcoding finishes, and obtains the video segment behind the transcoding, and it is treated to video behind the transcoding.
Code-transferring method in the embodiment of the invention is for the transcoding complexity of each video segment of obtaining to treat transcoding and constitute the transcoding performance value of each computing equipment of described cloud platform; Obtain each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding; Judge first video segment on first computing equipment required transcoding time whether greater than described first average time; When judged result for not the time, described first video segment is assigned on described first computing equipment carries out transcoding.Obtain each described computing equipment according to the transcoding performance value of the transcoding complexity of each video segment that obtains and each computing equipment and respectively the described video segment that distributes is carried out first required average time of transcoding, when the transcoding time of a video segment on a computing equipment is not more than described first average time, this video segment is assigned on this computing equipment, thereby the self-characteristic according to each video segment and each computing equipment is assigned to each video segment on the different computing equipments, save the transcoding time, improve transcoding efficiency.By the technical scheme of the embodiment of the invention, allow the video segment of more complicated can be dispatched to performance than on the better computing equipment, like this, these computing equipments can obtain less relatively video segment number, thereby reduce their task start time.
Those skilled in the art should understand that embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt complete hardware embodiment, complete software embodiment or in conjunction with the form of the embodiment of software and hardware aspect.And the present invention can adopt the form of the computer program of implementing in one or more computer-usable storage medium (including but not limited to magnetic disc store and optical memory etc.) that wherein include computer usable program code.
The present invention is that reference is described according to flow chart and/or the block diagram of method, equipment (system) and the computer program of the embodiment of the invention.Should understand can be by the flow process in each flow process in computer program instructions realization flow figure and/or the block diagram and/or square frame and flow chart and/or the block diagram and/or the combination of square frame.Can provide these computer program instructions to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, make the instruction of carrying out by the processor of computer or other programmable data processing device produce to be used for the device of the function that is implemented in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame appointments.
These computer program instructions also can be stored in energy vectoring computer or the computer-readable memory of other programmable data processing device with ad hoc fashion work, make the instruction that is stored in this computer-readable memory produce the manufacture that comprises command device, this command device is implemented in the function of appointment in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame.
These computer program instructions also can be loaded on computer or other programmable data processing device, make and carry out the sequence of operations step producing computer implemented processing at computer or other programmable devices, thereby be provided for being implemented in the step of the function of appointment in flow process of flow chart or a plurality of flow process and/or square frame of block diagram or a plurality of square frame in the instruction that computer or other programmable devices are carried out.
Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, if of the present invention these are revised and modification belongs within the scope of claim of the present invention and equivalent technologies thereof, then the present invention also is intended to comprise these changes and modification interior.