Summary of the invention
The embodiment of the present invention provides a kind of transcoding distribution method and device, code-transferring method and equipment, for improving transcoding efficiency.
A kind of transcoding distribution method, is applied to the user side in cloud platform, comprises the following steps:
Obtain the transcoding performance value of the transcoding complexity treating each video segment of transcoding and each computing equipment forming described cloud platform;
According to formula
obtain each described computing equipment and respectively carried out to the described video segment distributed the first average time needed for transcoding; Wherein f
*for described first average time, m for the total quantity of computing equipment described in described cloud platform, n be the total quantity of the described video segment needing to carry out transcoding, c
ibe the described transcoding complexity of i-th video segment, p
jfor the described transcoding performance value of a jth computing equipment, t
overheadfor video segment mean value start-up time;
Judge whether the transcoding time needed for the first video segment is on the first computing equipment is greater than described first average time;
When judged result is no, described first video segment is assigned on described first computing equipment and carries out transcoding.
A kind of code-transferring method, is applied to the user side in cloud platform, comprises the following steps:
To treat that the video of transcoding carries out cutting, obtain each video segment treating transcoding;
According to described transcoding distribution method, each described video segment is distributed;
The described video segment distributed carries out after transcoding completes, obtaining the video segment after transcoding, being treated to the video after transcoding by each computing equipment in described cloud platform.
A kind of transcoding distributor, is applied to the user side in cloud platform, comprises:
First acquisition module, for obtaining the transcoding complexity of each video segment treating transcoding and forming the transcoding performance value of each computing equipment of described cloud platform;
Second acquisition module, for according to formula
obtain each described computing equipment and respectively carried out to the described video segment distributed the first average time needed for transcoding; Wherein f
*for described first average time, m for the total quantity of computing equipment described in described cloud platform, n be the total quantity of the described video segment needing to carry out transcoding, c
ibe the described transcoding complexity of i-th video segment, p
jfor the described transcoding performance value of a jth computing equipment, t
overheadfor video segment mean value start-up time; Judge module, for judging whether the first video segment transcoding time required on the first computing equipment is greater than described first average time;
Distribution module, during for being no when judged result, being assigned to described first video segment on described first computing equipment and carrying out transcoding.
A kind of transcoding device, is applied to the user side in cloud platform, comprises:
Cutting module, for treating that the video of transcoding carries out cutting, obtains each video segment treating transcoding;
Transcoding distributor, for distributing each described video segment;
Processing module, to be undertaken the described video segment distributed after transcoding completes, obtaining the video segment after transcoding, being treated to the video after transcoding for each computing equipment in described cloud platform.
Code-transferring method in the embodiment of the present invention is the transcoding performance value obtaining the transcoding complexity treating each video segment of transcoding and each computing equipment forming 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 carried out to the described video segment distributed the first average time needed for transcoding; Judge whether the transcoding time needed for the first video segment is on the first computing equipment is greater than described first average time; When judged result is no, described first video segment is assigned on described first computing equipment and carries out transcoding.Obtain each described computing equipment according to the transcoding complexity of each video segment obtained and the transcoding performance value of each computing equipment and respectively carried out to the described video segment distributed the first average time needed for 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, thus according to the self-characteristic of each video segment and each computing equipment, each video segment is assigned on different computing equipments, save the transcoding time, improve transcoding efficiency.
Embodiment
Transcoding distribution method in the embodiment of the present invention is the transcoding performance value obtaining the transcoding complexity treating each video segment of transcoding and each computing equipment forming 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 carried out to the described video segment distributed the first average time needed for transcoding; Judge whether the transcoding time needed for the first video segment is on the first computing equipment is greater than described first average time; When judged result is no, described first video segment is assigned on described first computing equipment and carries out transcoding.Obtain each described computing equipment according to the transcoding complexity of each video segment obtained and the transcoding performance value of each computing equipment and respectively carried out to the described video segment distributed the first average time needed for 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, thus according to the self-characteristic of each video segment and each computing equipment, each video segment is assigned on different computing equipments, save the transcoding time, improve transcoding efficiency.
See Fig. 1, the transcoding distributor in the embodiment of the present invention comprises the first acquisition module 101, second acquisition module 102, judge module 103 and distribution module 104.Device described in the embodiment of the present invention can be applied to the user side in cloud platform, namely can be arranged in arbitrary the computing equipment forming cloud platform.The performance forming each computing equipment in the computing equipment of cloud platform can be the same or different.
First acquisition module 101 is for obtaining the transcoding complexity of each video segment treating transcoding and forming the transcoding performance value of each computing equipment of described cloud platform.
First, the first acquisition module 101 needs to obtain some for calculating the parameter of scheduling, and described parameter at least comprises the transcoding complexity of each video segment and forms the transcoding performance value of each computing equipment of described cloud platform.When in the computing equipment forming cloud platform, the performance of each computing equipment is different, the first acquisition module 101 needs the transcoding performance value obtaining each computing equipment forming described cloud platform.First acquisition module 101 can obtain from cutting module 105 video segment segmented, and then can estimate the transcoding complexity of each video segment.Suppose the video segment after having n cutting, be designated as respectively V=(1,2 ..., n), wherein n be 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 forming cloud platform to server request simultaneously, from the described transcoding historical record of each computing equipment, the first acquisition module 101 can estimate the transcoding performance value of different 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 forming cloud platform, or can be served as by special computing equipment.Suppose there is m platform computing equipment, m be more than or equal to 1 integer, their transcoding performance value can be designated as respectively P=(p1, p2 ..., pn).Each video segment can be estimated as the start-up time of task on different computing equipment simultaneously, and video segment mean value start-up time can be obtained the start-up time on different computing equipment according to each video segment, this video segment mean value start-up time can be designated as t
overhead.Or each video segment is generally more or less the same the start-up time on different computing equipment, even can ignore its difference, therefore also can in all start-up times optional one as t
overhead.The transcoding time needed for video segment is directly proportional to the transcoding complexity of video segment itself, be inversely proportional to the transcoding performance value of computing equipment, therefore can obtain i-th fragment on jth platform Work machine, perform transcoding time needed for transcoding, can be called for the first transcoding time, can t be used
ijrepresent, wherein i, j are the integer being not less than 1:
Second acquisition module 102 carries out the first average time needed for transcoding to the described video segment distributed respectively for obtaining each described computing equipment according to the described transcoding performance value of the described transcoding complexity of each video segment, each computing equipment.
Can according to the t obtained
ijcalculate the average time that all video segments carry out needed for transcoding on its computing equipment be assigned with, namely each described computing equipment carries out the average time needed for transcoding to the described video segment distributed respectively, can be called for the first average time:
Then in this, as reference, the transcoding time needed for every platform computing equipment is allowed to try not to exceed this first average time.F can be used
jrepresent the transcoding time needed for jth platform computing equipment, because every platform computing equipment carries out to video segment the process that transcoding is all serial, that is, a computing equipment once can only carry out transcoding to a video segment, and transcoding can not be carried out to multiple video segment, therefore f simultaneously
jthe transcoding time sum needed for all video segments be assigned on this computing equipment should be equaled.Time initial, the transcoding time of giving tacit consent to all computing equipments is zero, then starts to distribute video segment.
Judge module 103 is for judging whether the first video segment transcoding time required on the first computing equipment is greater than described first average time.
First judge module 103 needs needing each video segment of transcoding to sort by its transcoding complexity, to sort from big to small in the embodiment of the present invention, the size of each computing equipment by its transcoding performance value can be sorted from big to small simultaneously.Can obtain two queues after sequence, be video segment queue to be allocated respectively, and computing equipment queue to be selected.When distributing, the best computing equipment of transcoding performance value can be selected as current pending computing equipment from computing equipment queue to be selected, the computing equipment that computing equipment queue to be selected described in being namely positioned at is the most forward.Then from described video segment queue to be allocated, select the video segment that transcoding complexity is maximum, the video segment being namely positioned at described video segment queue to be allocated the most forward distributes.Judge module 103 can judge described current pending computing equipment perform 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.
When distribution module 104 is for being no when judged result, described first video segment is assigned on described first computing equipment and carries out transcoding.
When also namely supposing that distribution i-th video segment (or being called the first video segment) is upper to jth platform computing equipment (or being called the first computing equipment), if:
f
j+t
ij≤f
*(3)
Then distribution module 104 determines described first video segment to be assigned on described first computing equipment.
When the first round distributes, the transcoding time needed for each computing equipment can be made as far as possible close to described first average time (but being not more than described first average time).Such as, have 5 video segments in video segment queue to be allocated, have 3 computing equipments in computing equipment queue to be selected, described first average time is 5 seconds.After first video segment is distributed to First computing equipment, judge module 103 determines that the transcoding time needed for First computing equipment is 2 seconds, distribution module 104 determines this first video segment to distribute to this First computing equipment, judge module 103 judges whether this transcoding time needed for First computing equipment equals described first average time, because 2<5, then judge module 103 can continue to determine to be distributed to by second video segment the transcoding time after this First computing equipment needed for this First computing equipment again, if the transcoding time after second video segment is distributed to this First computing equipment needed for this First computing equipment is total up to 4.5 seconds, then distribution module 104 can determine this second video segment also to distribute to this First computing equipment, because of 4.5<5, then judge module 103 can continue to determine to be distributed to by the 3rd video segment the transcoding time after this First computing equipment needed for this First computing equipment, if the transcoding time after the 3rd video segment is distributed to this First computing equipment needed for this First computing equipment is 7 seconds, exceed described first average time, then distribution module 104 is determined the 3rd video segment to be distributed to this First computing equipment, can continue to judge whether the 3rd video segment to be distributed to second computing equipment with same step.
After first round distribution terminates, if judge module 103 is by judging to determine to also have unappropriated video segment in video segment queue to be allocated, then judge module 103 can according to each different video segment, obtain every platform computing equipment and add the transcoding time required after this video segment, namely every platform computing equipment is traveled through for each remaining video segment, obtain different computing equipment and add the transcoding time required after this video segment, therefrom select the computing equipment that the required transcoding time is minimum, this video segment is assigned in this computing equipment by notice distribution module 104.Such as, in video segment queue to be allocated, residue has 3 video segments, 5 computing equipments are had in cloud platform (computing equipment queue namely to be selected), then when distribution first remaining video fragment, judge module 103 can obtain it respectively and be assigned to the transcoding time that in these five computing equipments, rear five computing equipments need respectively, if judge module 103 determines that second computing equipment adds that the transcoding time required after this first remaining video fragment is minimum, then distribution module 104 is determined this first remaining video fragment allocation in this second computing equipment.And then continue to distribute other remaining video fragment according to same steps, until video segment queue to be allocated is empty.
In first round assigning process, if judge module 103 defines the video segment transcoding time be assigned in which computing equipment needed for this computing equipment and is all greater than described first average time, then this video segment can be assigned in the computing equipment adding required transcoding minimal time after this video segment by distribution module 104 when the first round distributes, or can first skip this video segment when the first round distributes, it is not processed, until the first round distribute terminate after distribution module 104 be assigned in the computing equipment adding required transcoding minimal time after this video segment again, to save the transcoding time as far as possible.
As shown in Figure 2, the embodiment of the present invention also provides a kind of transcoding device, and it can also comprise cutting module 105 and processing module 106 except comprising described transcoding distributor.
Cutting module 105, for treating that the video of transcoding carries out cutting, obtains each video segment treating transcoding.Cutting module 105 is responsible for from this locality stores, obtain the original video data treating transcoding, is then at least two video segments that independently can carry out transcoding by its cutting.In order to ensure the independence of data between video segment, need to guarantee to carry out cutting between image sets (Group of pictures, GOP).Rely on for there being reference frame between GOP, need the GOP adding a redundancy after video segment, this assures between two video segments can absolute coding, and also can guarantee the video after obtaining complete transcoding when finally being merged by the video segment after transcoding.
The described video segment distributed to carry out after transcoding completes, obtaining the video segment after transcoding, being treated to the video after transcoding for each computing equipment in described cloud platform by processing module 106.Described processing mode can be merge.After each computing equipment all completes the transcoding of all video segments, processing module 106 obtains the video segment after each transcoding from described server, then can merge in order.Wherein, cutting module 105, by after the video of transcoding carries out cutting, can be numbered the video segment after each cutting, so that the video segment after transcoding can merge according to number order by processing module 106.For the fragment of redundancy that with the addition of a GOP, there will be the repetition of a GOP when former and later two fragments merge, the GOP of redundancy at this moment can be adopted as output.
Adopt described transcoding device to complete transcoding task, the transcoding time can be saved, improve transcoding efficiency.
The embodiment of the present invention also provides a kind of server, and it can be positioned at the network side of cloud platform.The result announcement server that distribution module 104 can will be distributed, gives corresponding computing equipment by network in charge by corresponding video fragment allocation, notifies that corresponding computing equipment carries out transcoding.Announcement server after each computing equipment transcoding completes, the video segment after transcoding can be sent to processing module 106 by server after the equal transcoding of each computing equipment completes, and carries out merging treatment by processing module 106.Wherein, cutting module 105 can be stored in local virtual storage region after being video segment by video slicing, the every platform computing equipment forming cloud platform can have a virtual storage region, and it can form a cloud platform virtual storage region, can by server unified management.After each video segment distributes by module 104 to be allocated, different video fragment allocation is given corresponding computing equipment according to allocation result by server, the video segment that computing equipment sends according to server carries out transcoding, after transcoding, the video segment after transcoding is put into virtual storage region, and announcement server, then by server, the video segment after transcoding is sent to described transcoding distributor.
Transcoding distribution method in the embodiment of the present invention and code-transferring method is introduced below by way of specific embodiment.
See Fig. 3, the concrete grammar flow process that embodiment of the present invention transit code distributes is as follows:
Step 301: the transcoding performance value obtaining each computing equipment needing the transcoding complexity of each video segment carrying out transcoding and form 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 carried out to the described video segment distributed the first average time needed for transcoding.
Step 303: judge whether the transcoding time needed for the first video segment is on the first computing equipment is greater than described first average time.When judged result is for being, because sorting to each video segment and each computing equipment before, therefore the transcoding time that the computing equipment after can determining performs needed for described first video segment also can be greater than described first average time, then temporarily first can not process described first video segment, this first video segment can be skipped and first process next video segment, this first video segment of reprocessing after the first round, distribution terminated, be assigned in transcoding time required after adding this transcoding time needed for the first video segment minimum computing equipment, or also can directly process this first video segment when the first round distributes, be assigned in transcoding time required after adding this transcoding time needed for the first video segment minimum computing equipment.
Step 304: when judged result is no, is assigned to described first video segment on described first computing equipment and carries out transcoding.
See Fig. 4, the specific implementation flow process of embodiment of the present invention transit code method is as follows:
Step 401: will treat that the video of transcoding carries out cutting, obtains each video segment treating transcoding.
Step 402: each described video segment is distributed according to described transcoding distribution method.
Step 403: the described video segment distributed carries out after transcoding completes, obtaining the video segment after transcoding, being treated to the video after transcoding by each computing equipment in described cloud platform.
Code-transferring method in the embodiment of the present invention is the transcoding performance value obtaining the transcoding complexity treating each video segment of transcoding and each computing equipment forming 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 carried out to the described video segment distributed the first average time needed for transcoding; Judge whether the transcoding time needed for the first video segment is on the first computing equipment is greater than described first average time; When judged result is no, described first video segment is assigned on described first computing equipment and carries out transcoding.Obtain each described computing equipment according to the transcoding complexity of each video segment obtained and the transcoding performance value of each computing equipment and respectively carried out to the described video segment distributed the first average time needed for 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, thus according to the self-characteristic of each video segment and each computing equipment, each video segment is assigned on different computing equipments, save the transcoding time, improve transcoding efficiency.By the technical scheme of the embodiment of the present invention, allow the video segment of more complicated can be dispatched on the better computing equipment of Performance Ratio, like this, these computing equipments can obtain relatively less video segment number, thus reduce their task start time.
Those skilled in the art should understand, embodiments of the invention can be provided as method, system or computer program.Therefore, the present invention can adopt the form of complete hardware embodiment, completely software implementation or the embodiment in conjunction with software and hardware aspect.And the present invention can adopt in one or more form wherein including the upper computer program implemented of computer-usable storage medium (including but not limited to magnetic disc store and optical memory etc.) of computer usable program code.
The present invention describes with reference to according to the flow chart of the method for the embodiment of the present invention, equipment (system) and computer program and/or block diagram.Should understand can by the combination of the flow process in each flow process in computer program instructions realization flow figure and/or block diagram and/or square frame and flow chart and/or block diagram and/or square frame.These computer program instructions can being provided to the processor of all-purpose computer, special-purpose computer, Embedded Processor or other programmable data processing device to produce a machine, making the instruction performed by the processor of computer or other programmable data processing device produce device for realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be stored in can in the computer-readable memory that works in a specific way of vectoring computer or other programmable data processing device, the instruction making to be stored in this computer-readable memory produces the manufacture comprising command device, and this command device realizes the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
These computer program instructions also can be loaded in computer or other programmable data processing device, make on computer or other programmable devices, to perform sequence of operations step to produce computer implemented process, thus the instruction performed on computer or other programmable devices is provided for the step realizing the function of specifying in flow chart flow process or multiple flow process and/or block diagram square frame or multiple square frame.
Obviously, those skilled in the art can carry out various change and modification to the present invention and not depart from the spirit and scope of the present invention.Like this, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.