CN109862403A - Self-adaption code rate switching method, device, electronic equipment and storage medium - Google Patents
Self-adaption code rate switching method, device, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN109862403A CN109862403A CN201910125263.8A CN201910125263A CN109862403A CN 109862403 A CN109862403 A CN 109862403A CN 201910125263 A CN201910125263 A CN 201910125263A CN 109862403 A CN109862403 A CN 109862403A
- Authority
- CN
- China
- Prior art keywords
- capability value
- currently playing
- difference
- code rate
- frame
- 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.)
- Granted
Links
Landscapes
- Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)
Abstract
The present invention provides a kind of self-adaption code rate switching method, device, electronic equipment and storage medium, which comprises determines that the size relation of the current code rate of current network bandwidth and currently playing video meets the first switching condition;The first capability value for characterizing the caching progress of the currently playing video is obtained, and characterizes the second capability value of the playback progress of the currently playing video;Judge whether first capability value and the difference of second capability value meet the second switching condition;When to be, it is switched to and plays the currently playing video with the matched target bit rate of the current network bandwidth.By judging whether first capability value and the difference of second capability value meet the second switching condition, to determine whether to carry out code rate switching, guarantee the smooth playing of video while making full use of bandwidth.
Description
Technical field
The present invention relates to data processing fields, in particular to a kind of self-adaption code rate switching method, device, electronics
Equipment and storage medium.
Background technique
It is had the following problems when playing video according to the technology of network self-adapting code rate at present:
Due to the unstability of network state, just automatically switches code rate there are network jitter, may lead
It causes to play not smooth, blank screen, user experience is bad.
Summary of the invention
In consideration of it, the embodiment of the present invention is designed to provide a kind of self-adaption code rate switching method, device, electronic equipment
And storage medium guarantees the smooth playing of video while realizing self-adaption code rate switching.
In a first aspect, the embodiment of the present invention provides a kind of switching method of self-adaption code rate, which comprises determination is worked as
The current code rate size of preceding network bandwidth and currently playing video meets the first switching condition;It obtains and characterizes the currently playing view
First capability value of the caching progress of frequency, and the second capability value of the characterization currently playing video playing progress;Described in judgement
Whether the difference of the first capability value and second capability value meets the second switching condition;When to be, by the current code rate
It is switched to the matched target bit rate of the current network bandwidth and plays the currently playing video.Determining current network band
When the current code rate size of wide and currently playing video meets the first switching condition, first capability value and described second are judged
Whether the difference of capability value meets the second switching condition, when to be, is switched to and the matched target of the current network bandwidth
Code rate plays the currently playing video, in the case where there is network jitter, guarantees the smooth playing of video, passes through judgement
Whether the difference of first capability value and second capability value meets the second switching condition, to determine whether switching code rate,
While effectively utilizing bandwidth, guarantee that video playing is smooth.
Based in a first aspect, the currently playing video includes multiple isochronous surfaces, each in a kind of possible design
Isochronous surface includes multiple frames, and the current code rate is switched to the matched target bit rate of the current network bandwidth and is played
The currently playing video, comprising: judge based on the target bit rate download the currently playing video latest frame whether
For key frame, the first judging result is obtained;When first judging result, which is, is, described former code will be worked as at the latest frame
Rate is switched to the target bit rate to play the currently playing video.Based on the switchover policy switched at key frame,
Facilitate decoding, guarantees that video playing is smooth.
Based in a first aspect, judging described currently the broadcasting based on target bit rate downloading in a kind of possible design
Whether the latest frame for putting video is key frame, before obtaining the first judging result, the method also includes: it obtains and is worked as based on described
The current time slice for the currently playing video that preceding code rate plays;Based on the target bit rate, cut from the current time
The first frame of piece starts to download the currently playing video.Based on the target bit rate, first be sliced from the current time
Frame starts to download the currently playing video, guarantees to be switched in time in the case where playing smooth and matches with current network bandwidth
Code rate.
Based in a first aspect, judging the currently playing view downloaded based on target bit rate in a kind of possible design
Whether the latest frame of frequency is key frame, comprising: obtains the current of the currently playing video played based on the current code rate
Frame;After judging whether the latest frame for the currently playing video downloaded based on the target bit rate is the present frame
Frame obtains the second judging result;When second judging result, which is, is, judge whether the latest frame is key frame.It is based on
The switchover policy switched at key frame facilitates decoding, guarantees that video playing is smooth.
Based in a first aspect, in a kind of possible design, judging first capability value and second capability value
Whether difference meets the second switching condition, comprising: first capability value is subtracted second capability value, obtains capacity difference
Value;If the difference of the current network bandwidth and the current code rate is greater than the first preset difference value, whether the capacity difference is judged
Greater than the first preset value, when the capacity difference is greater than first preset value, first capability value and described the are characterized
The difference of two capability values meets second switching condition.By this way, can guarantee in the case where there is network jitter
The smooth playing of video.
Based in a first aspect, first capability value is subtracted second capability value, is obtained in a kind of possible design
After taking capacity difference, the method also includes: if the difference of the target bit rate and the current network bandwidth is greater than second in advance
If difference, whether the capacity difference is judged less than the second preset value, when the capacity difference is less than second preset value,
The difference for characterizing first capability value and second capability value meets second switching condition.By this way, then
It can guarantee the smooth playing of video in the case where there is network jitter.
Second aspect, the embodiment of the present invention provide a kind of switching device of self-adaption code rate, and described device comprises determining that list
Member, for determining that the current code rate size of current network bandwidth and currently playing video meets the first switching condition;Procurement of reserve capacity
Unit characterizes first capability value for currently broadcasting video cache progress for obtaining, and the characterization currently playing video
Playback progress the second capability value;Capacity judging unit, for judging first capability value and second capability value
Whether difference meets the second switching condition;Switch unit, it is matched with the current network bandwidth for being switched to when to be
Target bit rate plays the currently playing video.
Based on second aspect, in a kind of possible design, the currently playing video includes multiple isochronous surfaces, each
Isochronous surface includes multiple frames, and the switch unit includes: key frame judging unit, for judging based under the target bit rate
Whether the latest frame of the currently playing video carried is key frame, obtains the first judging result;Switching subelement, in institute
Stating the first judging result is when being, to be switched to the target bit rate at the latest frame to play the currently playing video.
Based on second aspect, in a kind of possible design, described device further include: isochronous surface acquiring unit is used for
Obtain the current time slice of the currently playing video played based on the current code rate;Download unit, for being based on institute
Target bit rate is stated, downloads the currently playing video since the first frame that the current time is sliced.
Based on second aspect, in a kind of possible design, the key frame judging unit is also used to, and is obtained based on described
The present frame for the currently playing video that current code rate plays;And judge to download based on the target bit rate described current
Whether the latest frame for playing video is frame after the present frame, obtains the second judging result;And in second judgement
It as a result is when being, to judge whether the latest frame is key frame.
Based on second aspect, in a kind of possible design, the capacity judging unit is also used to first capacity
Value subtracts second capability value, obtains capacity difference;And if the difference of the current network bandwidth and the current code rate is big
In the first preset difference value, judge whether the capacity difference is greater than the first preset value, is greater than described first in the capacity difference
When preset value, the difference for characterizing first capability value and second capability value meets second switching condition.
Based on second aspect, in a kind of possible design, described device further include: capacity judgment sub-unit, if described
The difference of target bit rate and the current network bandwidth is greater than the second preset difference value, judges whether the capacity difference is pre- less than second
If value, when the capacity difference is less than second preset value, first capability value and second capability value are characterized
Difference meets second switching condition.
The third aspect, the embodiment of the present invention provide a kind of storage medium, are stored with computer program in the storage medium,
When the computer program is run on computers, so that the computer executes method described in first aspect.
Other features and advantages of the present invention will be illustrated in subsequent specification, also, partly be become from specification
It is clear that by implementing understanding of the embodiment of the present invention.The objectives and other advantages of the invention can be by written theory
Specifically noted structure is achieved and obtained in bright book, claims and attached drawing.
Detailed description of the invention
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below will be to needed in the embodiment attached
Figure is briefly described, it should be understood that the following drawings illustrates only certain embodiments of the present invention, therefore is not construed as pair
The restriction of range for those of ordinary skill in the art without creative efforts, can also be according to this
A little attached drawings obtain other relevant attached drawings.
Fig. 1 is the structural schematic diagram of electronic equipment provided in an embodiment of the present invention;
Fig. 2 is the flow diagram for the self-adaption code rate switching method that first embodiment of the invention provides;
Fig. 3 is the structural schematic diagram for the self-adaption code rate switching device that second embodiment of the invention provides.
Icon: 100- electronic equipment;110- memory;120- storage control;130- processor;140- Peripheral Interface;
150- input-output unit;160- audio unit;170- display unit;410- determination unit;420- acquiring unit;430- capacity
Judging unit;440- switch unit.
Specific embodiment
Below in conjunction with attached drawing in the embodiment of the present invention, technical solution in the embodiment of the present invention carries out clear, complete
Ground description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Usually exist
The component of the embodiment of the present invention described and illustrated in attached drawing can be arranged and be designed with a variety of different configurations herein.Cause
This, is not intended to limit claimed invention to the detailed description of the embodiment of the present invention provided in the accompanying drawings below
Range, but it is merely representative of selected embodiment of the invention.Based on the embodiment of the present invention, those skilled in the art are not doing
Every other embodiment obtained under the premise of creative work out, shall fall within the protection scope of the present invention.
It should also be noted that similar label and letter indicate similar terms in following attached drawing, therefore, once a certain Xiang Yi
It is defined in a attached drawing, does not then need that it is further defined and explained in subsequent attached drawing.Meanwhile of the invention
In description, term " first ", " second " etc. are only used for distinguishing description, are not understood to indicate or imply relative importance.
The embodiment of the present invention provides the structural schematic diagram of a kind of electronic equipment 100, and the electronic equipment 100 can be individual
Computer (personal computer, PC), tablet computer, smart phone, personal digital assistant (personal digital
Assistant, PDA) etc..
As shown in Figure 1, the electronic equipment 100 may include: self-adaption code rate switching device, memory 110, storage control
Device 120 processed, processor 130, Peripheral Interface 140, input-output unit 150, audio unit 160, display unit 170.
The memory 110, storage control 120, processor 130, Peripheral Interface 140, input-output unit 150, sound
Frequency unit 160 and each element of display unit 170 are directly or indirectly electrically connected between each other, with realize data transmission or
Interaction.It is electrically connected for example, these elements can be realized between each other by one or more communication bus or signal wire.The matter
The displaying device for measuring testing result includes that at least one can be stored in the storage in the form of software or firmware (firmware)
In device 110 or the software function module that is solidificated in the operating device (operating system, OS) of client device.It is described
Processor 130 is used to execute the executable module stored in memory 110, such as the self-adaption code rate switching device includes
Software function module or computer program.
Wherein, memory 110 may be, but not limited to, random access memory (Random Access Memory,
RAM), read-only memory (Read Only Memory, ROM), programmable read only memory (Programmable Read-Only
Memory, PROM), erasable read-only memory (Erasable Programmable Read-Only Memory, EPROM),
Electricallyerasable ROM (EEROM) (Electric Erasable Programmable Read-Only Memory, EEPROM) etc..
Wherein, memory 110 is for storing program, and the processor 130 executes described program after receiving and executing instruction, aforementioned
Method performed by the electronic equipment 100 for the flow definition that any embodiment of the embodiment of the present invention discloses can be applied to processor
In 130, or realized by processor 130.
Processor 130 may be a kind of IC chip, the processing capacity with signal.Above-mentioned processor 130 can
To be general processor, including central processing unit (Central Processing Unit, abbreviation CPU), network processing unit
(Network Processor, abbreviation NP) etc.;Can also be digital signal processor (DSP), specific integrated circuit (ASIC),
Field programmable gate array (FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hard
Part component.It may be implemented or execute disclosed each method, step and the logic diagram in the embodiment of the present invention.General processor
It can be microprocessor or the processor be also possible to any conventional processor etc..
Various input/output devices are couple processor 130 and memory 110 by the Peripheral Interface 140.Some
In embodiment, Peripheral Interface 140, processor 130 and storage control 120 can be realized in one single chip.Other one
In a little examples, they can be realized by independent chip respectively.
Input-output unit 150 is used to be supplied to the interaction that user input data realizes user and electronic equipment 100.It is described
Input-output unit 150 may be, but not limited to, mouse and keyboard etc..
Audio unit 160 provides a user audio interface, may include one or more microphones, one or more raises
Sound device and voicefrequency circuit.
Display unit 170 provides an interactive interface (such as user interface) between electronic equipment 100 and user
Or it is referred to for display image data to user.In the present embodiment, the display unit 170 can be liquid crystal display or touching
Control display.It can be the touching of the capacitance type touch control screen or resistance-type of support single-point and multi-point touch operation if touch control display
Control screen etc..Single-point and multi-point touch operation is supported to refer to that touch control display can sense on the touch control display one or more
The touch control operation generated simultaneously at a position, and the touch control operation that this is sensed transfers to processor 130 to be calculated and handled.
First embodiment
Referring to figure 2., Fig. 2 is a kind of process of the method for self-adaption code rate switching that first embodiment of the invention provides
Figure, the method are applied to electronic equipment 100 as shown in Figure 1, process shown in Fig. 2 will be described in detail below, institute
The method of stating includes:
S100: determine that the current code rate size of current network bandwidth and currently playing video meets the first switching condition.
Code rate is also bit rate, indicates that the video data after compressed encoding is per second and needs with how many a bits come table
Show, i.e., the image of display per second is carried out compressed data volume, the unit generally used is that kbps i.e. kilobit is per second.Code rate is got over
Height, the loss of image quality is with regard to smaller, and obtained picture is just closer to raw frames.
Network bandwidth refers to the data volume that can be transmitted within the unit time (generally referred to as 1 second).Network and high speed are public
Road is similar, and bandwidth is bigger, and just the lane of similar highway is more, and the traffic capacity is stronger.Network bandwidth is as measurement network
One important indicator of feature.
It is understood that current code rate is higher, the network bandwidth needed is higher, if current network bandwidth can not be supported
Current code rate then may cause video pictures delay or lose.
Therefore, in video website play video when, in order to realize code rate adaptive switching while, guarantee view
The smoothness that frequency plays, therefore, it is necessary to obtain the current code rate size of current network bandwidth and currently playing video in real time, and judges
Whether the current network bandwidth matches with the current code rate, in the present embodiment, the current network bandwidth with it is described
When the absolute value of the difference of current code rate meets preset value, determine that the current network bandwidth and the current code rate meet first and cut
Change condition.Wherein, the preset difference value can be 10,20,25,80,100 etc., and in the present embodiment, the preset difference value is
25.It is described to judge whether the current network bandwidth is equal to the current code rate as an implementation, determine it is described
When the current network bandwidth and the unequal current code rate, determine that the current network bandwidth and the current code rate meet
First switching condition.It is described when the current network bandwidth is equal with the current code rate determining, determine the current net
Network bandwidth and the current code rate are unsatisfactory for the first switching condition.
For example, example 1, in current network bandwidth 1024kbps, current code rate is 720kbps, therefore, the current net
Network bandwidth and the current code rate mismatch, and determine that the current network bandwidth and the current code rate meet the first switching item
Part needs for current code rate to be switched to code rate more higher than the current code rate, i.e., with the matched code of the current network bandwidth
Rate;Example 2, in current network bandwidth 780kbps, current code rate is 1028kbps, and therefore, the current network bandwidth is worked as with described
Preceding code rate mismatches, and determines that the current network bandwidth and the current code rate meet the first switching condition, needs that former code will be worked as
Rate is switched to code rate more lower than the current code rate, i.e., with the matched code rate of the current network bandwidth.Example 3, in current net
Network bandwidth 1024kbps, current code rate are 1024kbps, and therefore, the current network bandwidth is matched with the current code rate, really
The fixed current network bandwidth and the current code rate are unsatisfactory for the first switching condition, switch without code rate.What the one of value mentioned
Be when meeting the first switching condition, code rate switching will not be carried out at once, but, continue to execute S200.
S200: obtaining the first capability value for characterizing the caching progress of the currently playing video, and characterizes and described currently broadcast
Put the second capability value of the playback progress of video.
When determining that the current code rate size of current network bandwidth and currently playing video meets the first switching condition, current
When broadcasting video is A video, the first capability value of characterization A video cache progress, and the second of characterization A video playing progress are obtained
Capability value.In the present embodiment, first capability value and second capability value can be indicated with the time, for example, A video
Total duration is 30 minutes, and at current time, A video has been cached 10 minutes, and A video played 5 minutes, and therefore, first holds
Magnitude is 10 minutes, and the second capability value is 5 minutes, in other embodiments, first capability value and second capability value
It can be indicated with time ratios, i.e. the first capability value is 1/3, and the second capability value is 1/6.
S300: judge whether the difference of first capability value and second capability value meets the second switching item.
As an implementation, S300 includes:
First capability value is subtracted into second capability value, obtains capacity difference.
For example, being 10 minutes in the first capability value, the second capability value is 5 minutes, first capability value is subtracted described
Second capability value, obtaining capacity difference is 5 minutes.
If the difference of the current network bandwidth and the current code rate is greater than the first preset difference value, the capacity difference is judged
Whether be greater than first preset value, when the capacity difference is greater than the first preset value, characterize first capability value and
The difference of second capability value meets second switching condition.
By this way, it can be avoided in the case where there is network jitter with regard to random switching code rate, then guarantee video
Smooth playing, avoid the waste of network bandwidth.
Wherein, first preset difference value can be 0,10,20,100,200 etc., and in the present embodiment, described first is pre-
If difference is 100, for example, the current network bandwidth is 1024kbps, when current code rate is 724kbps, the current net
The difference of network bandwidth and the current code rate is 1024kbps-724kbps=300, is greater than the first preset difference value due to 300,
It determines that the difference of the current network bandwidth and the current code rate is greater than the first preset difference value, judges whether the capacity difference is big
In first preset value, wherein first preset value can be 2 minutes, 3 minutes, 5 minutes, 6 minutes etc., in this implementation
In example, first preset value is 3 minutes, since the capacity difference is 5 minutes, the capacity difference (5 minutes) is big
In the first preset value (3 minutes), the difference for characterizing first capability value and second capability value meets second switching
Condition.As an implementation, when the capacity difference is less than equal to the first preset value, first capability value is characterized
It is unsatisfactory for second switching condition with the difference of second capability value, is switched without code rate.
As an implementation, first capability value is being subtracted into second capability value, obtain capacity difference it
Afterwards, the method also includes:
If the difference of the current code rate and the current network bandwidth is greater than the second preset difference value, the capacity difference is judged
Whether less than the second preset value, when the capacity difference is less than the second preset value, first capability value and described the are characterized
The difference of two capability values meets second switching condition.
By this way, it can be avoided in the case where there is network jitter with regard to random switching code rate, then guarantee video
Smooth playing, avoid the waste of network bandwidth.
Wherein, second preset difference value can be 0,10,20,100,200 etc., wherein second preset difference value can
With equal with first preset difference value, second preset difference value can also be differed with first preset difference value, in this reality
It applies in example, second preset difference value is 100, for example, being 800kbps in the current network bandwidth, current code rate is
When 1028kbps, the difference of the current code rate and the current network bandwidth is 1028kbps-800kbps=228kbps, due to
228kbps is greater than the second preset difference value 100, accordingly, it is determined that the difference of the current code rate and the current network bandwidth is greater than the
Whether two preset difference values judge the capacity difference less than the second preset value, wherein second preset value can be 1 minute,
2 minutes, 3 minutes, 5 minutes etc., in the present embodiment, second preset value was 1 minute, if the capacity difference is 1 minute,
Therefore, the capacity difference (1 minute) characterizes first capability value and described second and holds less than the second preset value (2 minutes)
The difference of magnitude meets second switching condition.As an implementation, it is greater than in the capacity difference equal to second
When preset value, the difference for characterizing first capability value and second capability value is unsatisfactory for second switching condition, not into
The switching of row code rate.
S400: it when to be, is switched to the matched target bit rate of the current network bandwidth to play and described currently broadcast
Put video.
Wherein, the currently playing video includes multiple isochronous surfaces, and each isochronous surface includes multiple frames, for example, A is regarded
Frequency total duration is 20 minutes, is 20 isochronous surfaces by A video slicing, and each isochronous surface is 1 minute, each isochronous surface packet
Include 20 frames, wherein with no restriction, the number for the frame for including in each isochronous surface does not limit the division mode of isochronous surface
System, S400 include:
S410: the current time slice of the currently playing video played based on the current code rate is obtained.
For example, when currently playing video is A video, current time A video has been broadcast when current code rate is 720kbps
It is put into the 10th minute the 5th frame, the current time slice is the 10th isochronous surface.At current time, A video has been broadcast
When being put into the 15th minute the 4th frame, the current time slice is the 15th isochronous surface.
As an implementation, the current time of the currently playing video played based on the current code rate is obtained
The present frame of slice.For example, at current time, when A video has been played to the 15th minute the 4th frame, the current time
The present frame of slice is the 4th frame of the 15th isochronous surface.
S420: being based on the target bit rate, downloads since the first frame that the current time is sliced described currently playing
Video.
When current code rate is 720kbps, and target bit rate is 1080kbps, the current time slice is the 10th time
When slice, it is based on target bit rate 1080kbps, A video is downloaded since the first frame of the 10th isochronous surface.
By this way, can guarantee to be switched in time and the matched code of current network bandwidth in the case where playing smooth
Rate.
As an implementation, it is based on the target bit rate, is downloaded since the present frame that the current time is sliced
The currently playing video.
When current code rate is 720kbps, and target bit rate is 1080kbps, the present frame of current time slice is the
4th frame of 15 isochronous surfaces is based on target bit rate 1080kbps, and A is downloaded since the 4th frame of the 15th isochronous surface
Video.
S430: whether the latest frame for judging the currently playing video downloaded based on the target bit rate is key frame,
Obtain the first judging result.
For example, being downloaded based on the target bit rate to A video, at current time, the 15th isochronous surface is downloaded to
The 10th frame when, the latest frame be the 15th isochronous surface the 10th frame, judge whether the 10th frame is key frame, is obtained
Take the first judging result.
As an implementation, S430 includes:
Obtain the present frame of the currently playing video played based on the current code rate.
For example, current code rate is 720kbps at current time, when A video has been played to the 15th minute the 4th frame,
The present frame is the 4th frame of the 15th isochronous surface.
Judge based on the target bit rate download the currently playing video latest frame whether be the present frame it
Frame afterwards obtains the second judging result.
When it is the frame after the present frame that second judging result, which characterizes the latest frame, the latest frame is judged
It whether is key frame.
As an implementation, when second judging result is no, it is described current for characterizing the latest frame not
Therefore frame after frame switches without code rate.
Example 1, in the 12nd frame that the present frame is the 15th isochronous surface, the latest frame is the 15th isochronous surface
10th frame, therefore, the latest frame are the frame after the present frame, are switched without code rate.
Example 2, in the 13rd frame that the present frame is the 15th isochronous surface, the latest frame is the 15th isochronous surface
14th frame, therefore, the latest frame is the frame after the present frame.
S440: when first judging result, which is, is, the target bit rate is switched at the latest frame to play
The currently playing video.
Frame after the latest frame is the present frame, and when stating latest frame is for key frame, described newest
The current code rate is switched to the target bit rate to play the currently playing video at frame.
As an implementation, when first judging result is no, switch without code rate.
Based on the switchover policy switched at key frame, guarantee normal decoding, then guarantees in video playing smoothness
In the case of, can be switched in time with the matched code rate of current network bandwidth, and can be avoided in the feelings for network jitter occur
With regard to random switching code rate under condition.
For example, the latest frame is the 15th isochronous surface in the 13rd frame that the present frame is the 15th isochronous surface
The 15th frame, therefore, the latest frame is the frame after the present frame, and the 15th frame is key frame, therefore, the 15th
The current code rate is switched to the target bit rate to play the currently playing video at frame, it is to be understood that
After 15 frames and the 15th frame, played out with the video data downloaded based on the target bit rate.
As an implementation, the frame after second judging result characterizes the latest frame to be the present frame
When, the current code rate is switched to the matched target bit rate of the current network bandwidth and plays the currently playing view
Frequently.
By the above-mentioned means, can be avoided in the case where there is network jitter with regard to random switching code rate, then guarantee view
The smooth playing of frequency avoids the waste of network bandwidth.
When based on real-time stream media protocol (HTTP Live Streaming, HLS) realize self-adaption code rate switching when
It waits, in order to guarantee in the case where playing smoothness, suitable code rate can be switched to as soon as possible, therefore, use and be based on closing
The switchover policy of key frame.HLS protocol requires each timeslice to start with key frame, while requiring decoder that can pass through I
The metadata information that frame carries reinitializes decoder, is decoded at key frame, just can guarantee the normal of subsequent frame
Decoding.
The configuration of MediaC13odec decoder
In the buffer data of hypertext transfer protocol (HyperText Transfer Protoco, HTTP) download module
After reaching threshold value, audio unit 160 and video unit 170 start to play video.Decoding play mainly have the following three steps:
1. electronic equipment 100 reads the text of the isochronous surface of the video of downloading when the video to buffer area is decoded
Part head obtains the format information (coded format, resolution ratio, code rate) of video, initializes further according to the format information corresponding
Decoder.
2. electronic equipment 100 extracts video data from buffer area, and the video data transmission is solved to decoder
Code.
3. finally by the display unit 170 of decoded content transmission electron equipment 100, and it is aobvious by display unit 170
Show video pictures.160 sound intermediate frequency of audio unit play thread independently of video playing thread, but need synchronization video timestamp and
The timestamp of audio frame achievees the effect that audio-visual synchronization.
Second embodiment
Referring to figure 3., Fig. 3 is a kind of structural frames for self-adaption code rate switching device that second embodiment of the invention provides
Figure.Described device is stored in electronic equipment 100 as described in Figure 1, will be illustrated below to structural block diagram shown in Fig. 3, institute
Showing device includes:
Determination unit 410, for determining that the current code rate size of current network bandwidth and currently playing video meets first
Switching condition;
Capacity acquisition unit 420, for obtaining the first capability value for characterizing the caching progress of the currently playing video, and
Characterize the second capability value of the playback progress of the currently playing video;
Capacity judging unit 430, for judging whether first capability value and the difference of second capability value meet
Second switching condition;
Switch unit 440 is played for when to be, being switched to the matched target bit rate of the current network bandwidth
The currently playing video.
As an implementation, the currently playing video includes multiple isochronous surfaces, and each isochronous surface includes more
A frame, switch unit 440 include: key frame judging unit, for judging described currently the broadcasting based on target bit rate downloading
Whether the latest frame for putting video is key frame, obtains the first judging result;Switching subelement, in first judging result
When to be, the target bit rate is switched at the latest frame to play the currently playing video.
As an implementation, described device further include: isochronous surface acquiring unit, for obtaining based on described current
The current time slice for the currently playing video that code rate plays;Download unit, for being based on the target bit rate, from described
The first frame of current time slice starts to download the currently playing video.
As an implementation, the key frame judging unit is also used to, and is obtained based on the current code rate broadcasting
The present frame of the currently playing video;And judge the newest of the currently playing video downloaded based on the target bit rate
Whether frame is frame after the present frame, obtains the second judging result;And when second judging result, which is, is, judgement
Whether the latest frame is key frame.
As an implementation, capacity judging unit 430 is also used to subtract first capability value described second and holds
Magnitude obtains capacity difference;And if the difference of the current network bandwidth and the current code rate is greater than the first preset difference value, sentences
Whether the capacity difference of breaking is greater than the first preset value, when the capacity difference is greater than first preset value, described in characterization
The difference of first capability value and second capability value meets second switching condition.
As an implementation, described device further include: capacity judgment sub-unit, if the target bit rate is worked as with described
The difference of preceding network bandwidth is greater than the second preset difference value, judges the capacity difference whether less than the second preset value, in the capacity
When difference is less than second preset value, the difference for characterizing first capability value and second capability value meets described second
Switching condition.
The present embodiment realizes the process of respective function to each functional unit of self-adaption code rate switching device, refers to above-mentioned
Content described in embodiment illustrated in fig. 2, details are not described herein again.
In addition, it is stored with computer program in the storage medium the embodiment of the invention also provides a kind of storage medium,
When the computer program is run on computers, so that the computer executes any one of present invention embodiment and is provided
Self-adaption code rate switching method.
In conclusion self-adaption code rate switching method, device, electronic equipment and storage that various embodiments of the present invention propose are situated between
Matter, which comprises determine that the current code rate size of current network bandwidth and currently playing video meets the first switching condition;
The first capability value for characterizing the currently playing video cache progress is obtained, and characterizes the currently playing video playing progress
Second capability value;Judge whether first capability value and the difference of second capability value meet the second switching condition;For
When being, the current code rate is switched to the matched target bit rate of the current network bandwidth and plays the currently playing view
Frequently.When the current code rate size for determining current network bandwidth and currently playing video meets the first switching condition, described in judgement
Whether the difference of the first capability value and second capability value meets the second switching condition, when to be, by the current code rate
It is switched to the matched target bit rate of the current network bandwidth and plays the currently playing video, when to be no, without
Code rate switching then can be avoided in the case where there is network jitter with regard to random switching code rate, then guarantee the smoothness of video
It plays, avoids the waste of network bandwidth.
In embodiment provided herein, it should be understood that disclosed device and method, it can also be by other
Mode realize.The apparatus embodiments described above are merely exemplary, for example, the flow chart and block diagram in attached drawing are shown
Device, the architectural framework in the cards of method and computer program product, function of multiple embodiments according to the present invention
And operation.In this regard, each box in flowchart or block diagram can represent one of a module, section or code
Point, a part of the module, section or code includes one or more for implementing the specified logical function executable
Instruction.It should also be noted that function marked in the box can also be attached to be different from some implementations as replacement
The sequence marked in figure occurs.For example, two continuous boxes can actually be basically executed in parallel, they sometimes may be used
To execute in the opposite order, this depends on the function involved.It is also noted that each of block diagram and or flow chart
The combination of box in box and block diagram and or flow chart can be based on the defined function of execution or the dedicated of movement
The device of hardware is realized, or can be realized using a combination of dedicated hardware and computer instructions.
In addition, each functional module in each embodiment of the present invention can integrate one independent portion of formation together
Point, it is also possible to modules individualism, an independent part can also be integrated to form with two or more modules.
Claims (10)
1. a kind of self-adaption code rate switching method, which is characterized in that the described method includes:
Determine that the size relation of the current code rate of current network bandwidth and currently playing video meets the first switching condition;
The first capability value for characterizing the caching progress of the currently playing video is obtained, and characterizes broadcasting for the currently playing video
Second capability value of degree of putting into;
Judge whether first capability value and the difference of second capability value meet the second switching condition;
When to be, it is switched to and plays the currently playing video with the matched target bit rate of the current network bandwidth.
2. the method according to claim 1, wherein the currently playing video includes multiple isochronous surfaces, often
A isochronous surface includes multiple frames, be switched to the matched target bit rate of the current network bandwidth play it is described currently playing
Video, comprising:
Whether the latest frame for judging the currently playing video downloaded based on the target bit rate is key frame, obtains first and sentences
Disconnected result;
When first judging result, which is, is, the target bit rate is switched at the latest frame to play and described currently broadcast
Put video.
3. according to the method described in claim 2, it is characterized in that, judging described currently the broadcasting based on target bit rate downloading
Whether the latest frame for putting video is key frame, before obtaining the first judging result, the method also includes:
Obtain the current time slice of the currently playing video played based on the current code rate;
Based on the target bit rate, the currently playing video is downloaded since the first frame that the current time is sliced.
4. according to the method described in claim 2, it is characterized in that, judging described currently the broadcasting based on target bit rate downloading
Whether the latest frame for putting video is key frame, comprising:
Obtain the present frame of the currently playing video played based on the current code rate;
After judging whether the latest frame for the currently playing video downloaded based on the target bit rate is the present frame
Frame obtains the second judging result;
When second judging result, which is, is, judge whether the latest frame is key frame.
5. the method according to claim 1, wherein judging first capability value and second capability value
Whether difference meets the second switching condition, comprising:
First capability value is subtracted into second capability value, obtains capacity difference;
If the difference of the current network bandwidth and the current code rate is greater than the first preset difference value, whether the capacity difference is judged
Greater than the first preset value, when the capacity difference is greater than first preset value, first capability value and described the are characterized
The difference of two capability values meets second switching condition.
6. according to the method described in claim 3, it is characterized in that, first capability value is subtracted second capability value,
After obtaining capacity difference, the method also includes:
If the difference of the target bit rate and the current network bandwidth is greater than the second preset difference value, whether the capacity difference is judged
Less than the second preset value, when the capacity difference is less than second preset value, first capability value and described the are characterized
The difference of two capability values meets second switching condition.
7. a kind of self-adaption code rate switching device, which is characterized in that described device includes:
Determination unit, for determining that the current code rate size of current network bandwidth and currently playing video meets the first switching item
Part;
Capacity acquisition unit, for obtaining the first capability value for characterizing the caching progress for currently broadcasting video, and characterization institute
State the second capability value of the playback progress of currently playing video;
Capacity judging unit, for judging whether first capability value and the difference of second capability value meet the second switching
Condition;
Switch unit plays described work as when to be, being switched to the matched target bit rate of the current network bandwidth
Preceding broadcasting video.
8. device according to claim 7, which is characterized in that the currently playing video includes multiple isochronous surfaces, often
A isochronous surface includes multiple frames, and the switch unit includes:
Key frame judging unit, whether the latest frame of the currently playing video for judging to download based on the target bit rate
For key frame, the first judging result is obtained;
Switching subelement, for being switched to the target bit rate at the latest frame when first judging result, which is, is
To play the currently playing video.
9. a kind of electronic equipment, which is characterized in that including processor and the memory being connected to the processor, the storage
Computer program is stored in device, when the computer program is run by the processor, so that the electronic equipment right of execution
Benefit requires method described in any one of 1-6.
10. a kind of storage medium, which is characterized in that computer program is stored in the storage medium, when the computer journey
When sequence is run on computers, so that the computer executes the method as described in any one of claim 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910125263.8A CN109862403B (en) | 2019-02-19 | 2019-02-19 | Adaptive code rate switching method and device, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910125263.8A CN109862403B (en) | 2019-02-19 | 2019-02-19 | Adaptive code rate switching method and device, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109862403A true CN109862403A (en) | 2019-06-07 |
CN109862403B CN109862403B (en) | 2021-07-27 |
Family
ID=66898311
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910125263.8A Active CN109862403B (en) | 2019-02-19 | 2019-02-19 | Adaptive code rate switching method and device, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109862403B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110267100A (en) * | 2019-07-12 | 2019-09-20 | 北京达佳互联信息技术有限公司 | Code rate switching method, device, electronic equipment and the storage medium of FLV video |
CN110430453A (en) * | 2019-08-28 | 2019-11-08 | 咪咕视讯科技有限公司 | Video multi-code-rate switching processing method and device, electronic equipment and storage medium |
CN110636346A (en) * | 2019-09-19 | 2019-12-31 | 北京达佳互联信息技术有限公司 | Code rate self-adaptive switching method and device, electronic equipment and storage medium |
CN110933517A (en) * | 2019-11-30 | 2020-03-27 | 咪咕视讯科技有限公司 | Code rate switching method, client and computer readable storage medium |
CN112087646A (en) * | 2020-08-26 | 2020-12-15 | 腾讯科技(深圳)有限公司 | Video playing method and device, computer equipment and storage medium |
CN112822521A (en) * | 2020-12-30 | 2021-05-18 | 百果园技术(新加坡)有限公司 | Code rate control method, device and equipment for audio and video transmission and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2046044A1 (en) * | 2007-10-01 | 2009-04-08 | Cabot Communications Ltd | A method and apparatus for streaming digital media content and a communication system |
CN101771492A (en) * | 2008-12-29 | 2010-07-07 | 华为技术有限公司 | Method and device for adjusting streaming media bit rate |
CN103002272A (en) * | 2011-09-15 | 2013-03-27 | 上海聚力传媒技术有限公司 | Method, device and equipment for switching code rate of audio and video information |
CN103561283A (en) * | 2013-10-30 | 2014-02-05 | 乐视致新电子科技(天津)有限公司 | Method and device for code rate switch of smart television |
CN108055250A (en) * | 2017-12-01 | 2018-05-18 | 暴风集团股份有限公司 | Video play device, method and terminal |
CN108924667A (en) * | 2018-08-03 | 2018-11-30 | 阳雨哲 | A kind of maximized available bandwidth adaptive video fragment request method of support QoE |
-
2019
- 2019-02-19 CN CN201910125263.8A patent/CN109862403B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP2046044A1 (en) * | 2007-10-01 | 2009-04-08 | Cabot Communications Ltd | A method and apparatus for streaming digital media content and a communication system |
CN101771492A (en) * | 2008-12-29 | 2010-07-07 | 华为技术有限公司 | Method and device for adjusting streaming media bit rate |
CN103002272A (en) * | 2011-09-15 | 2013-03-27 | 上海聚力传媒技术有限公司 | Method, device and equipment for switching code rate of audio and video information |
CN103561283A (en) * | 2013-10-30 | 2014-02-05 | 乐视致新电子科技(天津)有限公司 | Method and device for code rate switch of smart television |
CN108055250A (en) * | 2017-12-01 | 2018-05-18 | 暴风集团股份有限公司 | Video play device, method and terminal |
CN108924667A (en) * | 2018-08-03 | 2018-11-30 | 阳雨哲 | A kind of maximized available bandwidth adaptive video fragment request method of support QoE |
Cited By (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110267100A (en) * | 2019-07-12 | 2019-09-20 | 北京达佳互联信息技术有限公司 | Code rate switching method, device, electronic equipment and the storage medium of FLV video |
CN110267100B (en) * | 2019-07-12 | 2022-01-25 | 北京达佳互联信息技术有限公司 | Code rate switching method and device for FLV (flash video), electronic equipment and storage medium |
CN110430453A (en) * | 2019-08-28 | 2019-11-08 | 咪咕视讯科技有限公司 | Video multi-code-rate switching processing method and device, electronic equipment and storage medium |
CN110636346A (en) * | 2019-09-19 | 2019-12-31 | 北京达佳互联信息技术有限公司 | Code rate self-adaptive switching method and device, electronic equipment and storage medium |
CN110636346B (en) * | 2019-09-19 | 2021-08-03 | 北京达佳互联信息技术有限公司 | Code rate self-adaptive switching method and device, electronic equipment and storage medium |
CN110933517A (en) * | 2019-11-30 | 2020-03-27 | 咪咕视讯科技有限公司 | Code rate switching method, client and computer readable storage medium |
CN110933517B (en) * | 2019-11-30 | 2022-04-29 | 咪咕视讯科技有限公司 | Code rate switching method, client and computer readable storage medium |
CN112087646A (en) * | 2020-08-26 | 2020-12-15 | 腾讯科技(深圳)有限公司 | Video playing method and device, computer equipment and storage medium |
CN112822521A (en) * | 2020-12-30 | 2021-05-18 | 百果园技术(新加坡)有限公司 | Code rate control method, device and equipment for audio and video transmission and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109862403B (en) | 2021-07-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109862403A (en) | Self-adaption code rate switching method, device, electronic equipment and storage medium | |
JP7195426B2 (en) | Display page interaction control method and apparatus | |
KR101146926B1 (en) | Method Of Providing Key Frames Of Video In Mobile Terminal | |
CN104581388B (en) | The processing method of broadcast state, apparatus and system | |
CN112771881B (en) | Bullet screen processing method and device, electronic equipment and computer readable storage medium | |
CN112087633A (en) | Video decoding method, device and storage medium | |
CN105191321A (en) | Distribution control system, distribution control method, and computer-readable storage medium | |
CN104080006B (en) | A kind of video process apparatus and method | |
CN106899894B (en) | The adaptive stream media method, apparatus and server of dynamic optimization | |
CN107333163A (en) | A kind of method for processing video frequency and device, a kind of terminal and storage medium | |
CN110087141A (en) | Method of transmitting video data, device, client and server | |
WO2016150273A1 (en) | Video playing method, mobile terminal and system | |
CN108366299A (en) | A kind of media playing method and device | |
CN105100912A (en) | Streaming media processing method and streaming media processing apparatus | |
US20140362291A1 (en) | Method and apparatus for processing a video signal | |
CN108156500B (en) | Multimedia data time correction method, computer device and computer readable storage medium | |
CN109195010A (en) | Code rate adjusting method and device | |
CN113821188A (en) | Method and device for adjusting audio playing speed, electronic equipment and storage medium | |
KR100764441B1 (en) | Method for Processing Segmented Object of Object Based Mobile Brocasting in Mobile Communication Terminal and Mobile Communication Terminal therefor | |
CN106921886A (en) | The multimedia data playing method and device of a kind of terminal | |
CN102202039A (en) | Network video previewing method and program-storing computer-readable recording medium | |
US20040083488A1 (en) | Receiving apparatus, data communication system, and method for data communication | |
CN111182316A (en) | Stream switching method and device of media resource, storage medium and electronic device | |
EP3522525B1 (en) | Method and apparatus for processing video playing | |
JP2004354677A (en) | Information processing device, method therefor, program therefor, recording medium recorded with he program, and reproducing device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |