CN103475934B - The Video coding flow control method that a kind of network-oriented is live - Google Patents
The Video coding flow control method that a kind of network-oriented is live Download PDFInfo
- Publication number
- CN103475934B CN103475934B CN201310418457.XA CN201310418457A CN103475934B CN 103475934 B CN103475934 B CN 103475934B CN 201310418457 A CN201310418457 A CN 201310418457A CN 103475934 B CN103475934 B CN 103475934B
- Authority
- CN
- China
- Prior art keywords
- video
- frame
- coding
- data
- live
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Landscapes
- Compression Or Coding Systems Of Tv Signals (AREA)
Abstract
The Video coding flow control method that a kind of network-oriented is live, including: play end parameter setting step: the duration playing end initial buffer district reception video data is preset as M, is preset as W by playing the minimum reception bandwidth of end;Initialize coding step: after live coding starts, set up simulated cushioned district according to default M, W;Coding step: in an encoding process, periodically prediction is just in size of data and the size of data of frame to be encoded of coded frame;The state of video sequence in calculating simulation buffering area, and adjust quantization parameter and make the data volume non-NULL of video sequence in simulated cushioned district, then proceed by next code;Coded data distributing step: while performing coding step, direct or indirect distributes coded data to broadcasting end;Video playback step: construct decoder at described broadcasting end, starts to receive live at any time, commences play out video, make the bandwidth of the reception live TV stream of described broadcasting end be not less than W simultaneously after receiving data and reach the video data volume of duration M.
Description
Technical field
The present invention is about a kind of video fluidics, specifically, is the Video coding live about a kind of network-oriented
Flow control method and system.
Background technology
It is known that the form of Video service is commonly divided into download, program request, live etc..Download, demand (telecommunication) service feature is
Being sent to established video data play end and play back, live broadcast service is then during video data produces in real time,
Send to playing end and play back.
Video service can be based on multiple transmission network, such as traditional DVB-C, DMB-T etc., based on internet in recent years regards
The business that is taken in small doses at short intervals progressively increases, and the video player on internet is usually the flash play control that PC browser is embedded, and ios operates
The control that system is built-in, open source software VLC etc..
Stream control is the important step of Video coding, and its effect is typically the video after ensureing coding and transmission, decoded model
Match, and the video quality having had.Video flowing control main models includes HRD, VBV, ABR etc. at present.
HRD (Hypothetical Reference Decoder) model, i.e. hypothetical reference decoding buffer model, including:
Encoded picture buffer (CPB), instantaneous decoding process, decoded picture buffer (DPB) and output.
The major parameter of HRD model is defined as follows table:
hrd_parameters(){ | C | Descriptor |
cpb_cnt_minusl | 0 | ue(v) |
bit_rate_scale | 0 | u(4) |
cpb_size_scale | 0 | u(4) |
for(SchedSelIdx=0;SchedSelIdx <=cpb_cnt_minus1;SchedSelIdx++){ | ||
bit_rate_value_minus1[SchedSelIdx] | 0 | ue(v) |
cpb_size_value_minus1[SchedSelIdx] | 0 | ue(v) |
cbr_flag[SchedSelIdx] | 0 | u(1) |
} | ||
initial_cpb_removal_delay_length_minus1 | 0 | u(5) |
cpb_removal_delay_length_minusl | 0 | u(5) |
dpb_output_delay_length_minus1 | 0 | u(5) |
time_offset_length | 0 | u(5) |
} |
Cpb_cnt_minus1+1 specifies the number of the CPB standard that can select, and codomain scope [0,31], when in SPS
Not specifying cpb_cnt_minus1, giving tacit consent to this value is 0.Bit_rate_scale and bit_rate_value_minus1
[SchedSeIdx] together, it is intended that the maximum input bit rate of SchedSelIdx CPB.
Together with cpb_size_scale with cpb_size_value_minus1 [SchedSelIdx], it is intended that
The CPBSize of SchedSelIdx CPB.
HRD model AUn represents the n-th access unit (access unit, AU) in decoding order, opens from AU0
Begin.HRD requires to verify code stream according to the following rules:
Combination to each BitRate and CPBSize, is required for verifying.The parameter of HRD model, according to
SchedSelIdx, initial_cpb_removal_delay [Sched SelIdx], BitRate [SchedSelIdx] and
CpbSize [SchedSelIdx] determines.During checking code stream compatibility, following condition need to be met:
1. for AUn, n > 0, define Δ tg,90(n)=90000*(tR, n(n)-taf(n-1))
Initial_cpb_removal_delay [SchedSelIdx] needs to meet:
1) if cbr_flag [SchedSelIdx] is equal to 0, then
initial_cpb_removal_delay[SchedSelIdx]<=Ceil(Δtg,90(n))。
2) otherwise (that is, when cbr_flag [SchedSelIdx] is equal to 1), Floor (Δ tg,90(n))<=initial_
cpb_removal_delay[SchedSelIdx]<=Ceil(Δtg,90(n))。
Noting: when any one-frame video data removes from CPB, in CPB, remaining bit number depends on initializing HRD
Buffering period SEI message.Encoder must account for this point, and it is any to guarantee no matter decoder selects
One buffering period SEI message initializes HRD, and the code stream of encoder output all can meet required pact
Bundle condition.
2.CPB overflow represents that the total bit number in CPB has exceeded CPBSize, CPB never should overflow.
3.CPB underflow represents for some AUn, tr,n(n)<taf(n).When low_delay_hrd_flag is equal to 0,
CPB never should underflow.
The subject matter of HRD model is:
(1) HRD need to provide corresponding initial buffer requirement to each coding AU, and player need to read this information from video flowing
And just commence play out after being an actually-received the data volume mated with initial buffer requirement;
(2) need the decoding time (remove time) of dynamic calculation each frame/field during HRD coding, solve simultaneously
Code device also needs to control the decoding time of each frame/field data by this value;
By above-mentioned 2 contents it can be seen that HRD model adds the complexity of decoding end, current internet is common
The video players such as flash, ios, VLC are not easy to realize the support to this encoding model.
For above-mentioned (2nd) point, also add the complexity of coding side, simultaneously because to remove time in HRD model
The adjustment of numerical value, also can make video playback fluency be affected, and the program that particularly motion amplitude is bigger, such as physical culture, joy
Happy etc..
In practical business, VBV (Video Buffer Verifier, video buffer verifier) model is more used,
Its basic characteristics be the initial buffer of player be fixing data volume (vbv buffer size): VBV model regulation player
During startup, from the beginning of the first frame data, by speed R (n)=Rmax, to VBV buffer fillings data, filling process continues vbv_
The delay second, vbv_delay is defined in picture header, and now decoding process starts.
But at present the major video player (flash player, VLC) of internet be generally based on buffered data time
Between, i.e. buffering area the first frame data and the time difference of last frame data rather than data volume (i.e. how many bit), at the beginning of arranging
Beginning buffering area, i.e. the time tolerance of the video data of buffering area commences play out after reaching setting value again.Use VBV model
User is when live broadcast service, if calculate the buffer time of buffering area by vbv buffer size/vbv bitrate, and
Being set to initial transmission duration, also cannot ensure smoothness, because in practical business, the bandwidth of code stream is non-constant, so
Player is buffered, by the vbv buffer size/vbv bitrate time, the video sequence obtained, and its data volume cannot ensure
Equal to vbv buffersize.If the strictest restriction vbv buffer size, it is possible to the possibility of card is greatly reduced,
But coding quality also can be greatly reduced.
HRD, VBV model more of towards tradition broadcasting and TV business, in actual application its decoding end frequently be ASIC core
The schemes such as sheet.
In Video coding, more use also has ABR (Average Bit Rate, mean bit rate) Flow Control Model, ABR
Model does not has strict definition, and concrete methods of realizing is the most different, it is common that the most strictly limit the fluctuation range of code stream, but stream controls mesh
Mark is so that the average bit rate of video is drawn close to given target bit rate, and ABR model is usually used in the program of not face transmission and compiles/turn
Code.
Summary of the invention
The present invention provides the Video coding flow control method that a kind of network-oriented is live, ensures that internet video is live with this
Fluency.
To achieve these goals, the embodiment of the present invention provides the Video coding flow control method that a kind of network-oriented is live,
This Video coding flow control method includes:
Play end parameter setting step: the duration playing end initial buffer district reception video data is preset as M, will play
Minimum reception bandwidth is held to be preset as W;
Initialize coding step: after live coding starts, set up simulated cushioned district according to default M, W.
Coding step: in an encoding process, periodically prediction is just at size of data and the number of frame to be encoded of coded frame
According to size;Calculate the state of video sequence in described simulated cushioned district, and adjust quantization parameter and make in described simulated cushioned district
The data volume non-NULL of video sequence, then proceeds by next code;
Coded data distributing step: while performing described coding step, direct or indirect divides to described broadcasting end
Send out coded data;
Video playback step: construct decoder at described broadcasting end, can put at any time and start to receive live, receive
Data commence play out video after reaching the video data volume of duration M, make the bandwidth receiving live TV stream of described broadcasting end not simultaneously
Less than W.
In one embodiment, described method also includes: in initializing coding step, reaches described M at coding duration
After, the video data of coding is put into described simulated cushioned district, the data volume of the video sequence in simulated cushioned district will be introduced into
It is defined as SN, now, SN=0.
In one embodiment, described method also includes: in initializing coding step, the average bandwidth arranging video is
A, and with A for target bandwidth, encode by ABR model.
In one embodiment, described method also includes: in the encoding step, with A for target bandwidth, based on ABR model
Calculate quantization parameter, adjust quantization parameter according to simulated cushioned district numerical value the most again.
In one embodiment, described method also includes: in the encoding step, after each frame Video coding completes, it was predicted that
Just in size of data and the size of data of frame to be encoded of coded frame;Calculate the state of video sequence in described simulated cushioned district,
And adjust quantization parameter and make the data volume non-NULL of video sequence in described simulated cushioned district, then proceed by next code;
Further, described coding step also includes:
Step 1: after the i-th frame coding, by live limited data transmission model calculate live under the conditions of described mould
Intend buffer state;Limited data transmission model: video sequence is when transmission, and transmission process should meet transmission data volume and be less than
Transmission bandwidth limits, and the difference of currently transmitted video time stamp video time stamp initial with transmission, after deducting transmission process time,
It is not to be exceeded a predetermined constant.
Described limited data transmission model is:
SNi=SNi-1+Fi,
If SNi> Di* W, then SNi-=Di* W,
Otherwise SNi=0;
Wherein, SNiFor being introduced into the data volume of the i-th frame video sequence in described simulated cushioned district, FiFor i-th frame of video
Size of data;The duration that i-th frame of video is corresponding:Unit is the second;During the DTS of i-th frame of video
Between stamp for DTSi。
Further, described prediction is just in size of data and the size of data of frame to be encoded of coded frame;Calculate described mould
Intend the state of video sequence in buffering area, and adjust quantization parameter and make the data volume of video sequence in described simulated cushioned district non-
Sky, including:
Step 2: set frame of video F to be encodedi+a+1The value of intermediate parameters q of quantization parameter:
According to q calculating quantization parameter:
Wherein, a is the quantity of current encoder system in parallel coded frame, and usual span is between 4-8;B is 10~30
Between constant, the sequence of frames of video length of presentation code forecast analysis, the present embodiment is set to 20;From the 1st frame to the i-th frame one
The accumulation size of data of i frame is σ altogetheri=σi-1+Fi。
Step 3: based on qi+1To qi+a, video residual error and Video coding historical information predict just in the size of coded frame:
Fi+1、Fi+2、......、Fi+a;
Step 4: δ is seti+a+1=0;
Wherein, δ represents the degree that q adjusts.
Step 5: with qi+a+1+δi+a+1* Δ is prediction q value, it was predicted that frame to be encoded: Fi+a+1、Fi+a+2、……、Fi+a+b;
Step 6: according to limited data transmission model SN 'i+a+b=SNi+Fi+1+Fi+2+…+Fi+a+bIf, Then Otherwise SN 'i+a+b=0;DB′i+a+b=
M-SN′i+a+b/ W;As DB 'i+a+bDuring > 0, recalculate quantization parameter So
After carry out the coding of subsequent frame.
Wherein, time a length of DB of video sequence in buffering area is simulated after i-th coding video frames completesi, it was predicted that i-th
Coding video frames completes time a length of DB ' of rear video sequencei。
In one embodiment, in described i-th frame coding step, as described DB 'i+a+b<=0, then δi+a+1+=1;If δi+a+1
< Max Δ/Δ, performs above-mentioned steps 5 and step 6 again.
Wherein, Max Δ is pre-set constant, and the q representing the most maximum adjusts amplitude, can be set to 20, and Δ is normal
Amount, represents the minimum of a value of q change, can be set to 0.05.
Further, if δi+a+1>=Max Δ/Δ, provides the underflow prompting of simulated cushioned district, assignment δ simultaneouslyi+a+1=Max Δ/
Δ, then recalculates quantization parameterThen the volume of subsequent frame is carried out
Code.
In one embodiment, in described coding step, as described DB 'i+a+b<=0, then define δi+a+1It is mapped to
DB′i+a+bFunction be: y=f (x);Y implication is δi+a+1During=x, the DB ' calculated by preceding methodi+a+bValue, x is integer;
Definition P-1 rank multinomial: y=g (x)=t0+t1*x+t2*x2+…+tp-1*xp-1, carry out approach f (x) with g (x);P
For predicting the target order of fitting function, for constant, 5 < P < Max Δs/Δ.
Y=g (x) is calculated sample point, and is fitted: make x=0,1,2 ..., P-1, calculate y=y0, y1, y2..., yp-1,
At y=y0, y1, y2..., yp-1Calculating during, if for the first time y occurringk> 0, then make δi+a+1=k, recalculates quantization parameterThen the coding of subsequent frame is carried out;
Otherwise, if all yk<=0, by x=0,1,2 ..., P-1, and the y=y of correspondence0, y1, y2..., yp-1, as
Reference sample point, carries out least square fitting, draws each term coefficient of polynomial function: t0, t1, t2..., tp-1;
Seek minimum integer x,Inequality g (x) > 0 is set up;
By Newton-decline method to equation g (x)=t0+t1*x+t2*x2+…+tp-1*xp-1=0 is iterated solving, wherein with
X=P is iterative initial value, and 1 is iteration precision, and concentrates at solution of equation, chooses minimum of a value x of satisfied following 2 conditionsroot:
1) in intervalIn;
2) first derivative g ' (the x)=t to g (x)1+t2*2x+…+tp-1*(p-1)*xp-2, and second dervative g of g (x) "
(x)=t2*2+t3*3x+…+tp-1*(p-1)*(p-2)*xp-3, meet: g ' (xroot) ≠ 0 or g " (xroot)>0;
If there is not the x meeting conditionroot, then buffer underflow prompting, assignment δ simultaneously are giveni+a+1=Max Δ/Δ, so
After recalculate quantization parameter Then the coding of subsequent frame is carried out.
Further, if there is xroot, then:
If g ' is (xroot) > 0, then make δi+a+1=INT(xroot)+1;If g ' is (xroot) < 0, then make δi+a+1=INT(xroot);If g '
(xroot)=0, then g " (xroot) > 0, make δi+a+1=INT(xroot);
Recalculate quantization parameter Then the volume of subsequent frame is carried out
Code;
Wherein, INT (x) represents the maximum integer being not more than x.
In one embodiment, described method also includes, in video playback step, to flash player, by arranging
The member property NetConnection::bufferTime of NetConnection class specifies flash play control commencing play out
Before, need to cache the video data of M duration, specifically include:
Varnc:NetConnection=new NetConnection;
Var flvbuftime:Number=stage.loaderInfo.parameters [" buftime "];
Nc.bufferTime=flvbuftime, flvbuftime are M.
Having the beneficial effects that of the embodiment of the present invention:
Stream control target is combined with average bandwidth, i.e. ensures to play the smooth of end, also ensure that average discharge is less than
Expection, can control to distribute the flow cost of link.
Owing to invention defines data volume SN of the video sequence being introduced into simulated cushioned district, every frame video need not be recorded
Specifying information, this specifying information is including but not limited to the timestamp of every frame video, byte number, frame type etc., it is only necessary to record is not
The byte number in the simulated cushioned district sent, can calculate the duration of video in simulated cushioned district.
By the Video coding flow control method of the present invention, coding side is without using HRD and VBV model, not changing broadcasting end
The decoding time, can realize play end smooth broadcasting.
Employing limited data transmission model is to adapt to towards video real-time live broadcast business, as used traditional mode,
Then during reality is live, owing to coding side data are to produce in real time, therefore can cause sending data volume not enough, Jin Eryu
Simulation process produces deviation, and causes the risk of actual appearance card.
The Video coding flow control method of the present invention simplifies flow control algorithm, particularly without being decoded counting again of time
Calculate, it is simple to the realization of coding side, the video simultaneously playing end also can be play by video time stamp, it is ensured that result of broadcast.
The Video coding flow control method of the present invention uses the time span of buffers video data rather than data volume is as initially
Buffering foundation, it is easy to the realization of internet main flow player, and need not be able to use the strictest while ensureing fluency
Stream control limits, and then ensure that video quality.
The invention can ensure that broadcasting end random time point after live coding starts starts to receive video flowing, all can ensure
Smooth playing.
The Flow Control Model of the present invention does not consider that the overflow that conventional flow control model considers limits, and simplifies flow control procedure.
Accompanying drawing explanation
In order to be illustrated more clearly that the embodiment of the present invention or technical scheme of the prior art, embodiment will be described below
The accompanying drawing used required in is briefly described, it should be apparent that, the accompanying drawing in describing below is only some of the present invention
Embodiment, for those of ordinary skill in the art, on the premise of not paying creative work, it is also possible to according to these
Accompanying drawing obtains other accompanying drawing.
Fig. 1 is the Video coding flow control method flow chart that embodiment of the present invention network-oriented is live;
Fig. 2 is the method flow diagram after the embodiment of the present invention every frame Video coding.
Detailed description of the invention
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Describe, it is clear that described embodiment is only a part of embodiment of the present invention rather than whole embodiments wholely.Based on
Embodiment in the present invention, it is every other that those of ordinary skill in the art are obtained under not making creative work premise
Embodiment, broadly falls into the scope of protection of the invention.
As it is shown in figure 1, the embodiment of the present invention provides the Video coding flow control method that a kind of network-oriented is live, this video is compiled
Code flow control method includes:
S101: play end parameter setting step: the duration playing end initial buffer district reception video data is preset as M,
It is preset as W by playing the minimum reception bandwidth of end;
S102: initialize coding step: after live coding starts, set up simulated cushioned district according to default M, W;
S103: coding step: in an encoding process, periodically prediction is just at size of data and the frame to be encoded of coded frame
Size of data;Calculate the state of video sequence in described simulated cushioned district, and adjust quantization parameter and make described simulated cushioned
In district, the data volume non-NULL of video sequence, then proceeds by next code;
S104: coded data distributing step: while performing coding step, direct or indirect divides to described broadcasting end
Send out coded data;
S105: video playback step: construct decoder at described broadcasting end, reaches the video counts of duration M in reception data
Commence play out video according to after amount, make the bandwidth receiving live TV stream of described broadcasting end be not less than W simultaneously.
By the flow process of Fig. 1, in the embodiment of the present invention, the duration of end initial buffer district reception video data will be play
And play the minimum reception bandwidth of end, video frame rate is preset as respectively M and W;Simulated cushioned district is set up according to default M, W;Week
The prediction of phase property just video sequence in the size of data of coded frame and the size of data of frame to be encoded calculating simulation buffering area
State, adjust quantization parameter make the data volume non-NULL of video sequence in described simulated cushioned district;Performing described coding step
Distribute coded data to described broadcasting end while Zhou, and playing end structure decoder, reach regarding of duration M in receiving data
Frequently commence play out video after data volume, and make the bandwidth receiving live TV stream of broadcasting end be not less than W.Play end simple structure,
Need not rely on HRD, VBV model, need not change the decoding time playing end, Flow Control Model limits regardless of overflow, sets up mould
Intend also need not recording during buffering area the specifying information of every frame video, it is only necessary to the byte number in the simulated cushioned district that record does not sends, i.e.
The live smoothness of internet video can be realized.
When S101 is embodied as, before live beginning, need to arrange following two parameters: play end initial buffer district and receive
The duration M of video data and broadcasting minimum reception bandwidth W of end.It is preferred that coding average bandwidth A can also be arranged.
When S102 is embodied as, after live coding starts, set up simulated cushioned district according to default M, W, and when coding
After length reaches described M, being put into by the video data of coding in described simulated cushioned district B, now in B, video sequence duration DB is
M, is defined as SN by the data volume being introduced into the video sequence in simulated cushioned district, now, and SN=0.Due to this step defines into
Enter data volume SN of the video sequence in simulated cushioned district, the specifying information of every frame video need not be recorded, this specifying information comprise but
It is not limited to the timestamp of every frame video, byte number, frame type etc., it is only necessary to the byte number in the simulated cushioned district that record does not sends, i.e.
The duration of video in simulated cushioned district can be calculated.
In this step, initial simulated cushioned district is set to the video sequence with M duration, rather than a fixing video
Data volume.In this step, it is also possible to the average bandwidth arranging video is A, and with A for target bandwidth, compiles by ABR model
Code.
After S102 completes, tri-steps of S103, S104 and S105 can be entered, from the flow chart of Fig. 1 it can be seen that
Tri-steps of S103, S104 and S105 do not have sequencing, and this three steps are described separately below:
In S103, after each frame Video coding completes, need prediction just at size of data and the frame to be encoded of coded frame
Size of data, the state of video sequence in calculating simulation buffering area, and adjust quantization parameter and make in described simulated cushioned district
The data volume non-NULL of video sequence, the most just carries out next code.
Concrete, when adjusting quantization parameter, with A for target bandwidth, first calculate quantization parameter by ABR model, the most again
Quantization parameter is adjusted according to simulated cushioned district numerical value.Stream control target is combined with average bandwidth, i.e. ensures smooth, also ensure
Average discharge, less than expection, can control to distribute the flow cost of link.
During as in figure 2 it is shown, S103 is embodied as, coding step can also include:
S201: after the i-th frame coding, by live limited data transmission model calculate live under the conditions of simulated cushioned
Zone state, limited data transmission model: video sequence is when transmission, and transmission process should meet transmission data volume less than transmission belt
Tolerance system, and the difference of currently transmitted video time stamp video time stamp initial with transmission, after deducting transmission process time, should not surpass
Cross a predetermined constant.This limited data transmission model is:
SNi=SNi-1+Fi,
If SNi> Di* W, then SNi-=Di* W,
Otherwise SNi=0;
Wherein, SNiFor being introduced into the data volume of the i-th frame video sequence in described simulated cushioned district, FiFor i-th frame of video
Size of data;The duration that i-th frame of video is corresponding:Unit is the second;The DTS time of i-th frame of video
Stamp is DTSi。
Due to the fact that employing limited data transmission model, be adapted to towards video real-time live broadcast business.As used biography
The mode of system, then, during reality is live, owing to coding side data are to produce in real time, therefore can produce data volume not
Foot, and then produce deviation with simulation process, and cause the risk of actual appearance card.Therefore, the drawing of limited data transmission model
Enter to solve the above-mentioned problems in the prior art.
After S201, it was predicted that just in size of data and the size of data of frame to be encoded of coded frame, as in figure 2 it is shown, in advance
Survey just in size of data and the size of data of frame to be encoded of coded frame, calculate the shape of video sequence in described simulated cushioned district
State, and adjust quantization parameter and make the data volume non-NULL of video sequence in described simulated cushioned district, specifically include S202, S203,
S204 and S205:
S202: need by abr mode, sets frame of video F to be encodedi+a+1Q value:
According to q calculating quantization parameter:
Wherein, a is the quantity of current encoder system in parallel coded frame, and usual span is between 4-8;B is 10~30
Between constant, the sequence of frames of video length of presentation code forecast analysis, the present embodiment is set to 20;From the 1st frame to the i-th frame one
The accumulation size of data of i frame is σ altogetheri=σi-1+Fi。
S203: based on qi+1To qi+a, video residual error and Video coding historical information predict just at the size of coded frame: Fi+1、
Fi+2、......、Fi+a;
S204: δ is seti+a+1=0。
Wherein, δ represents the degree that q adjusts.
S205: with qi+a+1+δi+a+1* Δ is prediction q value, it was predicted that frame to be encoded: Fi+a+1、Fi+a+2、......、Fi+a+b。
As in figure 2 it is shown, in S103, the duration of video sequence in calculating simulation buffering area, specifically include:
S206: after drawing, according to S203 and S205, the prediction size that i+1 arrives these frames of i+a+b, passes according to finite data
Defeated model SN'i+a+b=SNi+Fi+1+Fi+2+…+Fi+a+bIf,ThenOtherwise SN'i+a+b=0;DB′i+a+b=M-SN'i+a+b/W。
As in figure 2 it is shown, in S103, in calculating simulation buffering area after the duration of video sequence, also include:
S207: judge DB 'i+a+bWhether > 0 sets up, if it is, enter S208;If DB 'i+a+b<=0, then, and δi+a+1+=1;
Judge δi+a+1With the size (S210) of Max Δ/Δ, if δi+a+1< Max Δ/Δ, then with qi+a+1+δi+a+1* Δ is prediction q value, in advance
Survey frame to be encoded: Fi+a+1、Fi+a+2、......、Fi+a+b;According to limited data transmission model SN 'i+a+b=SNi+Fi+1+Fi+2+…+
Fi+a+bIf, Then Otherwise SN 'i+a+b=0;
DB′i+a+b=M-SN′i+a+b/W;As DB 'i+a+bDuring > 0, recalculate quantization parameter Then the coding of subsequent frame is carried out.
If δi+a+1>=Max Δ/Δ, then enter S209, then jump to S208.Wherein, Max Δ is pre-set normal
Amount, the q representing the most maximum adjusts amplitude, and Δ is constant, represents the minimum of a value of q change.
S208: recalculate the quantization parameter of frame of video Then open
Begin the actual coding of a new frame, repeats S103 afterwards.
S209: provide buffer underflow prompting, represents that this code stream exists pause possible, assignment δ simultaneouslyi+a+1=MaxΔ/Δ。
S210: judge δi+a+1Size with Max Δ/Δ.
In a preferred embodiment, in order to reduce amount of calculation, S207, S209 can be amended as follows:
As DB 'i+a+b> 0, enters S208;
As described DB 'i+a+b<=0, then define δi+a+1It is mapped to DB 'i+a+bFunction be: y=f (x);Y implication is δi+a+1=x
Time, through the DB ' that S205 and S206 calculatesi+a+bValue, wherein, x implication is δi+a+1, x is integer.
From S205 and S206, when x is the biggest, it was predicted that q value is the biggest, from H.264 coding criterion, it was predicted that to be encoded
Frame Fi+a+1、Fi+a+2、......、Fi+a+bThe least, SN'i+a+bThe least, therefore DB 'i+a+bThe biggest, i.e. y is the biggest.Namely
Say that function y=f (x) is monotonically increasing function.
For reducing amount of calculation, rapid solving meets DB 'i+a+bThe minimum δ of > 0i+a+1, definition P-1 rank multinomial: y=g (x)=
t0+t1*x+t2*x2+…+tp-1*xp-1, carry out approach f (x) with g (x);
To y=g (x), calculate sample point, and be fitted: make x=0,1,2 ..., P-1, calculate y=y0, y1, y2...,
yp-1, at y=y0, y1, y2..., yp-1Calculating during, if for the first time y occurringk> 0, then make δi+a+1=k, enters S208, weight
Newly calculate quantization parameter Then carrying out i+1 frame coding, wherein, x contains
Justice is δi+a+1, x is integer, and P is the target order of prediction fitting function, for constant, 5 < P < Max Δs/Δ.
Otherwise, if all yk<=0, by x=0,1,2 ..., P-1, and the y=y of correspondence0, y1, y2..., yp-1, as
Reference sample point, carries out least square fitting, draws each term coefficient of polynomial function: t0, t1, t2..., tp-1;
For calculating target, find the δ of minimumi+a+1So that DB 'i+a+b> 0, and meetPermissible
Mathematical description is:
Seek minimum integer x,Inequality g (x) > 0 is set up;
After obtaining approximating function g (x) of f (x), calculate target and be further simplified as: seek minimum integer x,Inequality g (x) > 0 is set up.
The method solved according to unitary inequality of higher degree, the disaggregation space of inequality g (x) > 0 is by the solution of equation g (x)=0
Collection, sign of inequality direction and g (x) first derivative at equattion root determines, first to g (x)=0 equation solution.
Then, by Newton-decline method to equation g (x)=t0+t1*x+t2*x2+…+tp-1*xp-1=0 is iterated solving
(wherein with x=P as iterative initial value, 1 is iteration precision), and concentrate at solution of equation, choose the minimum of a value of satisfied following 2 conditions
xroot:
1) in intervalIn;
2) first derivative g to g (x) ' (x)=t1+t2*2x+…+tp-1*(p-1)*xp-2, and second dervative g of g (x) "
(x)=t2*2+t3*3x+…+tp-1*(p-1)*(p-2)*xp-3, meet: g ' (xroot) ≠ 0 or g " (xroot)>0;
If there is not the x meeting conditionroot, then buffer underflow prompting, assignment δ simultaneously are giveni+a+1=Max Δ/Δ, so
Rear entrance S208 recalculates quantization parameterThen i+1 frame volume is carried out
Code.
If there is the x meeting conditionroot, then:
If g ' is (xroot) > 0, then make δi+a+1=INT(xroot)+1;If g ' is (xroot) < 0, then make δi+a+1=INT(xroot);If g '
(xroot)=0, then g " (xroot) > 0, make δi+a+1=INT(xroot);Quantization parameter is recalculated subsequently into S208Then i+1 frame coding is carried out;Wherein, INT (x) represents no more than x
Maximum integer.
S104 performs while S103 performs, the actual video data produced by coding, to playing end distribution, so that broadcasting
Put end and play video.
Broadcasting end can receive live video stream to be carried out while performing S103, S104, when S105 is embodied as, plays end
Structure decoder so that it is when receiving live at any time, just should open after reception data reach the video data volume of duration M
Beginning to play video, player removes video data by the DTS timestamp of video from buffering area and decodes, and the most also should ensure that broadcasting
The bandwidth receiving live TV stream of end is not less than fixed value W.
S105, in video playback step, can use flash play control, to flash player, with qi+a+1+
δi+a+1* △ is prediction q value, it was predicted that frame to be encoded: Fi+a+1、Fi+a+2、......、Fi+a+bStep in, by arrange
The member property NetConnection::bufferTime of NetConnection class specifies flash play control commencing play out
Before, need to cache the video data of M duration, specifically include:
By in M assignment to bufferTime:
Varnc:NetConnection=new NetConnection;
Var flvbuftime:Number=stage.loaderInfo.parameters [" buftime "];
Nc.bufferTime=flvbuftime, flvbuftime are M.
After as above step, it is ensured that when broadcasting end puts reception live video at any time, all can ensure that buffering area is non-
Sky, gets final product smooth playing.
It addition, the present invention is also equipped with following technique effect:
By the Video coding flow control method of the present invention, coding side is without using HRD model, not changing and play the decoding of end
Time, can realize playing the smooth broadcasting of end.
The Video coding flow control method of the present invention simplifies flow control algorithm, particularly without being decoded counting again of time
Calculate, it is simple to the realization of coding side, the video simultaneously playing end also can be play by video time stamp, it is ensured that result of broadcast.
The Video coding flow control method of the present invention uses the time span of buffers video data rather than data volume is as initially
Buffering foundation, it is easy to the realization of internet main flow player.
The Flow Control Model of the present invention does not consider that overflow limits, and simplifies flow control procedure.
One of ordinary skill in the art will appreciate that all or part of step realizing in above-described embodiment method can be led to
Program of crossing completes to instruct relevant hardware, and this program can be stored in a computer read/write memory medium, such as
ROM/RAM, magnetic disc, CD etc..
Particular embodiments described above, has been carried out the purpose of the present invention, technical scheme and beneficial effect the most in detail
Describe in detail bright, be it should be understood that the specific embodiment that the foregoing is only the present invention, the guarantor being not intended to limit the present invention
Protect scope, all within the spirit and principles in the present invention, any modification, equivalent substitution and improvement etc. done, should be included in this
Within the protection domain of invention.
Claims (12)
1. the Video coding flow control method that a network-oriented is live, it is characterised in that described Video coding flow control method includes:
Play end parameter setting step: the duration playing end initial buffer district and receiving video data is preset as M, by broadcasting end
Low reception bandwidth is preset as W;
Initialize coding step: after live coding starts, set up simulated cushioned district according to default M, W;
Coding step: in an encoding process, periodically prediction are just big in the size of data of coded frame and the data of frame to be encoded
Little;Calculate the state of video sequence in described simulated cushioned district, and adjust quantization parameter and make video in described simulated cushioned district
The data volume non-NULL of sequence, then proceeds by next code;Wherein calculate the state of video sequence in described simulated cushioned district
Method as follows:
Step 1: after the i-th frame coding, by live limited data transmission model calculate live under the conditions of described simulation delay
Rush zone state;Described limited data transmission model is:
SNi=SNi-1+Fi,
If SNi> Di* W, then SNi-=Di* W,
Otherwise SNi=0;Wherein, FiFor the size of data of i-th frame of video, the duration that i-th frame of video is corresponding:The DTS timestamp of i-th frame of video is DTSi, SNiIt is to be introduced into described simulation after the i-th frame encodes to delay
Rush the data volume of the video sequence in district;
Coded data distributing step: while performing described coding step, direct or indirect compiles to the distribution of described broadcasting end
Code data;
Video playback step: construct decoder at described broadcasting end, starts to receive live at any time, reaches in reception data
After the video data volume of duration M, commence play out video, make the bandwidth receiving live TV stream of described broadcasting end be not less than W simultaneously.
Method the most according to claim 1, it is characterised in that described method also includes: in initializing coding step,
After coding duration reaches described M, the video data of coding is put into described simulated cushioned district, simulated cushioned district will be introduced into
The data volume of video sequence be defined as SN, now, SN=0.
Method the most according to claim 1, it is characterised in that described method also includes: in initializing coding step,
The average bandwidth arranging video is A, and with A for target bandwidth, encodes by ABR model.
Method the most according to claim 1, it is characterised in that described method also includes: in the encoding step, presets and regards
The average bandwidth of frequency is A, with A for target bandwidth, first calculates quantization parameter by ABR model, the most again according to simulated cushioned district
Numerical value adjusts quantization parameter.
Method the most according to claim 1, it is characterised in that described prediction is just in the size of data of coded frame and to be encoded
The size of data of frame, calculates the state of video sequence in described simulated cushioned district, and adjusts quantization parameter described simulation is delayed
Rush the data volume non-NULL of video sequence in district, including:
Step 2: set frame of video F to be encodedi+a+1The value of intermediate parameters q of quantization parameter:
According to q calculating quantization parameter:
Step 3: based on qi+1To qi+a, video residual error and Video coding historical information predict just at the size of coded frame: Fi+1、
Fi+2、……、Fi+a;
Step 4: δ is seti+a+1=0;
Step 5: with qi+a+1+δi+a+1* Δ is prediction q value, it was predicted that frame to be encoded: Fi+a+1、Fi+a+2、……、Fi+a+b;
Wherein, Δ is constant, represents the minimum of a value of q change, Fi+a+bBe the size of data of the i-th+a+b frame of video, from the 1st frame to
The accumulation size of data of the i-th frame i frame altogether is σi=σi-1+Fi, a is the quantity of current encoder system in parallel coded frame, and b represents volume
The sequence of frames of video length of code forecast analysis, δ represents the degree that q adjusts, and A is the average bandwidth of pre-setting video.
Method the most according to claim 5, it is characterised in that the shape of video sequence in the described simulated cushioned district of described calculating
State, and adjust quantization parameter and make the data volume non-NULL of video sequence in described simulated cushioned district, sequel after then proceeding by
Code, also includes:
Step 6: according to limited data transmission model: SN 'i+a+b=SNi+Fi+1+Fi+2+…+Fi+a+bIf,ThenOtherwise SN 'i+a+b=0;DB′i+a+b
=M-SN 'i+a+b/W;As DB 'i+a+b> 0 time, recalculate quantization parameter
Then the coding of subsequent frame is carried out;
Wherein, time a length of DB of video sequence in buffering area is simulated after i-th coding video frames completesi, it was predicted that i-th video
Frame has encoded time a length of DB ' of rear video sequencei。
Method the most according to claim 6, it is characterised in that in described coding step, as described DB 'i+a+B≤0, then
δi+a+1+=1;
If δi+a+1< Max Δ/Δ, performs step 5 and step 6;
Wherein, Max Δ is pre-set constant, and the q representing the most maximum adjusts amplitude.
Method the most according to claim 7, it is characterised in that if δi+a+1>=Max Δ/Δ, provides simulated cushioned district underflow and carries
Show, simultaneously assignment δi+a+1=Max Δ/Δ, then recalculates quantization parameter
Then the coding of subsequent frame is carried out.
Method the most according to claim 6, it is characterised in that in described coding step, as described DB 'i+a+b≤ 0, then
Definition δi+a+1It is mapped to DB 'i+a+bFunction be: y=f (x);Y implication is δi+a+1During=x, the DB ' calculatedi+a+bValue;
Definition P-1 rank multinomial: y=g (x)=t0+t1*x+t2*x2+…+tp-1*xp-1, carry out approach f (x) with g (x);
Y=g (x) is calculated sample point, and is fitted: make x=0,1,2 ..., P-1, calculate y=y0, y1, y2..., yp-1,
Y=y0, y1, y2..., yp-1Calculating during, if for the first time y occurringk> 0, then make δi+a+1=k, recalculates quantization parameter
QPi+a+1=12+6*Then i+1 frame coding is carried out;
Wherein, x implication is δi+a+1, x is integer, and P is the target order of prediction fitting function, for constant, 5 < P < Max Δs/Δ.
Method the most according to claim 9, it is characterised in that if all yk<=0, by x=0,1,2 ..., P-1, and
Corresponding y=y0, y1, y2..., yp-1, as reference sample point, carry out least square fitting, draw each of polynomial function
Term coefficient: t0, t1, t2..., tp-1;
Seek minimum integer x,Inequality g (x) > 0 is set up;
By Newton-decline method to equation g (x)=t0+t1*x+t2*x2+…+tp-1*xp-1=0 is iterated solving, wherein with x=
P is iterative initial value, and 1 is iteration precision, and concentrates at solution of equation, chooses minimum of a value x of satisfied following 2 conditionsroot:
A) in intervalIn;
B) first derivative g to g (x) ' (x)=t1+t2*2x+…+tp-1*(p-1)*xp-2, and second dervative g of g (x) " (x)=
t2*2+t3*3x+…+tp-1*(p-1)*(p-2)*xp-3, meet: g ' (xroot) ≠ 0 or g " (xroot) > 0;
If there is not the x meeting conditionroot, then buffer underflow prompting, assignment δ simultaneously are giveni+a+1=Max Δ/Δ, then weighs
Newly calculate quantization parameterThen i+1 frame coding is carried out.
11. methods according to claim 10, it is characterised in that if there is xroot, then:
If g ' is (xroot) > 0, then make δi+a+1=INT (xroot)+1;If g ' is (xroot) < 0, then make δi+a+1=INT (xroot);If g '
(xroot)=0, then g " (xroot) > 0, make δi+a+1=INT (xroot);
Recalculate quantization parameterThen i+1 frame coding is carried out;
Wherein, INT (x) represents the maximum integer being not more than x.
12. methods according to claim 1, it is characterised in that described method also includes, in video playback step,
To flash player, specify by arranging the member property NetConnection::bufferTime of NetConnection class
Flash play control, before commencing play out, needs to cache the video data of M duration, specifically includes:
By in M assignment to bufferTime:
Varnc:NetConnection=new NetConnection;
Var flvbuftime:Number=stage.loaderInfo.parameters [" buftime "];
Nc.bufferTime=flvbuftime, flvbuftime are M.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310418457.XA CN103475934B (en) | 2013-09-13 | 2013-09-13 | The Video coding flow control method that a kind of network-oriented is live |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310418457.XA CN103475934B (en) | 2013-09-13 | 2013-09-13 | The Video coding flow control method that a kind of network-oriented is live |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103475934A CN103475934A (en) | 2013-12-25 |
CN103475934B true CN103475934B (en) | 2016-08-31 |
Family
ID=49800609
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310418457.XA Active CN103475934B (en) | 2013-09-13 | 2013-09-13 | The Video coding flow control method that a kind of network-oriented is live |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103475934B (en) |
Families Citing this family (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105245801A (en) * | 2015-09-24 | 2016-01-13 | 天脉聚源(北京)科技有限公司 | Method for transmitting interactive signals of interactive television system |
CN109218741B (en) * | 2017-07-04 | 2021-10-22 | 阿里巴巴集团控股有限公司 | Live broadcast control method and device |
EP3742739B1 (en) * | 2019-05-22 | 2021-04-14 | Axis AB | Method and devices for encoding and streaming a video sequence over a plurality of network connections |
CN112533033B (en) * | 2020-11-25 | 2022-12-02 | 上海太罗信息科技有限公司 | Information distribution system |
CN112752148A (en) * | 2020-12-28 | 2021-05-04 | 北京百度网讯科技有限公司 | Method, device and equipment for optimizing video playing and storage medium |
CN113380220B (en) * | 2021-06-10 | 2024-05-14 | 深圳市同行者科技有限公司 | Speech synthesis coding method and device |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101795415B (en) * | 2010-04-22 | 2012-02-08 | 杭州华三通信技术有限公司 | Method and device for controlling code rate in video coding |
US8660178B2 (en) * | 2010-07-01 | 2014-02-25 | Broadcom Corporation | Method and system for multi-layer rate control for a multi-codec system |
CN102724510B (en) * | 2012-06-21 | 2014-05-28 | 中科开元信息技术(北京)有限公司 | Code rate control algorithm based on fullness degree of virtual encoding buffer area |
CN102761741B (en) * | 2012-06-26 | 2014-04-02 | 中国科学技术大学 | Video encoding code rate control system and method on basis of caches at encoding and decoding ends |
CN103051897B (en) * | 2012-12-26 | 2016-02-24 | 南京信息工程大学 | A kind of H264 code rate controlling method for video coding |
-
2013
- 2013-09-13 CN CN201310418457.XA patent/CN103475934B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN103475934A (en) | 2013-12-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103475934B (en) | The Video coding flow control method that a kind of network-oriented is live | |
CN1848964B (en) | Generalized reference decoder for image or video processing | |
JP5444047B2 (en) | Image coding method | |
CN102246531B (en) | Multiplexed video streaming | |
CN103354618B (en) | HLS-based multi-scenario streaming media adaptive live broadcast method | |
KR101309935B1 (en) | Method of splicing encoded multimedia data streams | |
CN102318345B (en) | Moving image encoding apparatus and moving image encoding method | |
EP2589223B1 (en) | Video streaming | |
CN104159109B (en) | Bit rate control method and system based on VBR Video coding | |
US20060075446A1 (en) | Methods and systems for presentation of media obtained from a media stream | |
CN108353198B (en) | Method and apparatus for providing power saving media content | |
CN102761741B (en) | Video encoding code rate control system and method on basis of caches at encoding and decoding ends | |
US20060239563A1 (en) | Method and device for compressed domain video editing | |
WO1999066734A1 (en) | Video encoder and encoding method with buffer control | |
CN103096048B (en) | A kind of scalable video quantization parameter defining method and device | |
US8724710B2 (en) | Method and apparatus for video encoding with hypothetical reference decoder compliant bit allocation | |
CN103841456A (en) | Webcast data buffering method | |
CN102724502B (en) | The control method of code check and device in a kind of Video coding | |
CN102695058B (en) | Vast-scale buffering policy-based audio/video code stream control method | |
WO2010021665A1 (en) | Hypothetical reference decoder | |
JP2018533272A (en) | Method, system, and device for reproducing power-saving media content | |
CN107040788B (en) | A kind of video-frequency compression method and device | |
CN103596012B (en) | Interframe macro block type selecting method used in real-time AVS-based video frame rate transcoding | |
JP2009171339A (en) | Apparatus, method and program for encoding moving image | |
Crabtree et al. | Equitable quality video streaming |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant |