CN105635734B - Adaptive video coding method and device based on video calling scene - Google Patents

Adaptive video coding method and device based on video calling scene Download PDF

Info

Publication number
CN105635734B
CN105635734B CN201410609593.1A CN201410609593A CN105635734B CN 105635734 B CN105635734 B CN 105635734B CN 201410609593 A CN201410609593 A CN 201410609593A CN 105635734 B CN105635734 B CN 105635734B
Authority
CN
China
Prior art keywords
level
frame per
coding
resolution ratio
encoding
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
Application number
CN201410609593.1A
Other languages
Chinese (zh)
Other versions
CN105635734A (en
Inventor
焦华龙
朱华智
邓志国
王磊
陈翔宇
Original Assignee
Zhang Ying Information Technology (shanghai) Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Zhang Ying Information Technology (shanghai) Co Ltd filed Critical Zhang Ying Information Technology (shanghai) Co Ltd
Priority to CN201410609593.1A priority Critical patent/CN105635734B/en
Publication of CN105635734A publication Critical patent/CN105635734A/en
Application granted granted Critical
Publication of CN105635734B publication Critical patent/CN105635734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Compression Or Coding Systems Of Tv Signals (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)

Abstract

A kind of adaptive video coding method based on video calling scene is disclosed, it include: when establishing video calling, the initial network bandwidth under current network environment is detected, and the initial code resolution ratio to match with the network bandwidth detected and frame per second progress Video coding are set;When detecting change of network environment, the further updated network bandwidth under the network environment after detection variation, the resolution ratio that is encoding and frame per second determine updated code distinguishability and frame per second according to the network bandwidth before updated network bandwidth, update and before updating, and carry out subsequent Video coding according to updated code distinguishability and frame per second;According to detect video for the previous period mean error, carry out the adaptive code distinguishability and frame per second adjusted at this time.Adaptive video coding method of the invention can carry out adaptive video coding in continually changing network environment and video pictures content, and realize preferable video definition and fluency.

Description

Adaptive video coding method and device based on video calling scene
Technical field
The present invention relates to technical field of video coding, in particular to a kind of adaptive video based on video calling scene is compiled Code method and device.
Background technique
With universal and wireless communication networks the upgrading of the intelligent mobile communication equipments such as terminal, video is carried out using terminal Call also becomes the more typical application of Intelligent mobile equipment.
The signal and bandwidth of wireless network are the variations for the environment being in user and continually changing, at the same user from The variation of body motion state will also result in the signal of wireless network and the corresponding change of bandwidth, for example, user is when walking Or be sitting in the automobile to jolt and be seated on the seat with tranquiler, the situation of change of the video pictures of Intelligent mobile equipment is also not With.
Frame per second (Frames Per Second) concept: as soon as a frame is exactly secondary static picture, continuous frame forms dynamic It draws, such as TV image.Video sequence is made of continuous frame image, and frame per second refers to the number of image frames for including in per second, can also To be interpreted as the number that graphics processor is refreshed each second, usually indicated with fps.Each frame is all static image, fastly Speed continuously shows that frame just forms the illusion of movement.Frame per second is higher, and frame picture number (fps) per second is more, it is available more Animation smooth, more true to nature, human eye feel that video sequence is more smooth, and visual effect is also better.But the raising of frame per second can significantly Increase the video data volume for needing to transmit, to improve the requirement to network channel bandwidth, while also requiring subscriber terminal equipment With stronger processing capacity and display capabilities.
Code stream (Data Rate) concept: referring to the data traffic that video file uses within the unit time, be also code rate, Be he be in Video coding image quality control in most important part.Under same resolution ratio, the code stream of video file is bigger, pressure Contracting is more smaller than just, and image quality is higher.
Video resolution concept: refer to video imaging product at image size or size, in two groups of imaging numbers In, the former is picture length, and the latter is the width of picture, and what the two multiplication obtained is the pixel of picture.
Newest video compression coding standard is that the MPEG tissue of ISO/IEC and the VCEG of ITU-T organize joint development, Than early stage research and development MPEG and H.263 standard code performance is more preferable, be named as AVC, also referred to as ITU-T H.264 suggest with The standard of the 10th part of MPEG-4, usually referred to as H.264/AVC or H.264.H.264 the algorithm tool of video compression coding standard There is very high code efficiency, this is because H.264 standard includes following technical characterstic:
1, hierarchical design, video coding layer have the function of efficient video frequency content expressing, and network abstraction layer is by institute in network The data needed are packaged and are transmitted;
2, high-precision, multi-mode estimation, support the motion vector of 1/4 or 1/8 pixel precision, multi-mode flexible and Careful division improves greatly the levels of precision of estimation, multi-frame-reference technology;
3, intra prediction function carries out predictive coding algorithm in spatial domain, to obtain more effective compression;
4,4 × 4 pieces of integer transform, due to the size reduction with two transform blocks, the division of moving object is more accurate, in this way Not only transformation calculations amount is smaller, and misses disease difference in the linking of moving object edge and also greatly reduce, in order to improve code rate The amplitude of the ability of control, the variation of quantization step is controlled 125% or so, rather than is changed with constant amplification.In order to strong Colored verisimilitude is adjusted, small amount step-length is used to chromaticity coefficent;
5, unified VLC is quick ynchronization and passes through optimization, and error code can be effectively prevented.
Can the height of video speech quality is depended under these network environments and the continually changing scene of picture situation Realization adaptively switches.Currently, adaptive switching mode in the prior art usually only relies solely on detection network bandwidth Variation realizes changing the frame per second of corresponding encoded, and can not be according to the situation of change and shifting of network environment and video pictures The many factors such as the jitter conditions under dynamic state change the resolution ratio and frame per second of corresponding encoded.
In view of this, be directed to the deficiencies in the prior art, this field need it is a kind of based on video calling scene from Adaptive video coding method and device can be directed to continually changing network environment and video pictures content, adaptively be regarded Frequency encodes, to realize preferable video definition and fluency.
Summary of the invention
The technical problem to be solved by the present invention is to be directed to continually changing network environment and video pictures content, need to carry out Adaptive video coding is proposed a kind of based on the adaptive of video calling scene with realizing preferable video definition and fluency Answer method for video coding and device.
In order to solve the above-mentioned technical problem, the invention discloses a kind of adaptive video codings based on video calling scene Method, comprising:
Step 101, when establishing video calling, the initial network bandwidth under current network environment is detected, and is arranged and examines The initial code resolution ratio and frame per second that the network bandwidth measured matches carry out Video coding;
Step 102, further updated under the network environment after detection variation when detecting change of network environment Network bandwidth, the resolution ratio encoded according to the network bandwidth before updated network bandwidth, update and before updating and frame Rate determines updated code distinguishability and frame per second, carries out subsequent video according to updated code distinguishability and frame per second and compiles Code;
Step 103, according to detect video for the previous period mean error, carry out adaptive adjust at this time Code distinguishability and frame per second, in which:
The mean error of the video for the previous period is that basis is being encoded based on current resolution with frame per second When, the mean value for the quantization step in certain time interval that corresponding network bandwidth obtains;
The adaptive code distinguishability adjusted at this time and frame per second are to be greater than threshold value by error then to downgrade coding point Resolution and frame per second, error are less than threshold value and then increase encoding rate and frame per second.
Preferably, generally 3-6 seconds in certain time interval.
Further, the step 101 includes:
Step 201, it is logical that video is set according to the CPU ability CPU_capacity of mobile device and used encoder Talk about the classification grade level of coding, in which: the CPU_capacity includes dominant frequency and nucleus number;
Step 202, the ratio of width to height that network bandwidth and opposite end picture are detected when starting video calling, according to letter obtained Breath setting is adapted to the initial code resolution ratio and frame per second of encoder, in which: information obtained includes network bandwidth and CPU energy Power, and the CPU ability takes the value Vmin of ability reckling in each communication terminal;
Step 203, it according to the ratio of width to height of obtained recommendation resolution ratio and opposite end screen, cuts out and is connect with opposite end the ratio of width to height Close resolution ratio is encoded.
Further, the step 201 includes:
The CPU ability of the intelligent terminal of apple IOS operating system and the H.264 coding of used process optimization will be run The taxonomical hierarchy of device is configured by one mode of table,
The CPU ability for running the intelligent terminal of Google's Android operation system is mapped to corresponding model by one mode of table Operation apple IOS operating system intelligent terminal CPU ability,
Table one
Further, the step 202 includes:
By two mode of table be arranged the CPU ability of network bandwidth and intelligent terminal with recommend it is corresponding between resolution ratio and frame per second Relationship:
Table two
Further, the step 203 includes:
If parameters are as shown in Table 3:
Table three
Parameter Meaning
target_aspect The ratio of width to height of opposite end picture
recomm_width Width in the resolution ratio of recommendation
recomm_height Height in the resolution ratio of recommendation
new_width New coding is wide
new_height New coding is high
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
* Indicate the mathematical operation of product
The method for determining the ratio of width to height is as follows:
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise, new_width=recomm_width
New_height=recomm_width/target_aspect
If the above-mentioned wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
Further, the step 102 includes:
Step 204, when detecting that network bandwidth changes and is more than threshold range, to the resolution ratio and phase of coding The coding layer grade of pass is updated, to adapt to new Network status.
Further, the step 204 includes:
Classify by table four to coding layer grade
Table four
Resolution ratio Frame per second Level
640x480 15 10
480x320 15 9
320x240 15 8
240x160 15 7
160x120 15 6
160x120 9 5
160x120 5 4
160x120 3 3
120x80 3 2
80x60 3 1
80x60 1 0
If parameters are as shown in Table 5:
Table five
Parameter Meaning
curr_bitrate Current bandwidth
prev_bitrate Bandwidth before
bitrate_change_level The variation level of bandwidth
prev_encoding_level Coding level before
curr_encoding_level New coding level
log Expression takes the mathematical operation of logarithm
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
/ Indicate divided by mathematical operation
* Indicate the mathematical operation of product
+ Indicate the mathematical operation of summation
The method for determining the variation level of bandwidth is as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
If bitrate_change_level > 0
Then, bitrate_change_level=bitrate_change_level*0.8
Otherwise, bitrate_change_level=bitrate_change_level*2.0
The method for determining new coding level is as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, compiled according to resolution ratio corresponding to the coding level newly obtained and frame per second Code.
Further, the step 103 includes:
Step 205, when not changing in Network status, or changing smaller, the level of Video coding is drawn still according to video The continuous automatic adjusument of the case where face:
The average value of 3 seconds quantized value QP before Video coding is calculated in the encoded resolution ratio of current bandwidth and frame per second, And it makes the following judgment:
When average value is less than 24, level curr_encoding_level=prev_encoding_level+1 is encoded;
When average value is greater than 32, level curr_encoding_level=prev_encoding_level-1 is encoded;
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, curr_ is set Encoding_level is 10;
When the coding level curr_encoding_level being calculated is less than 0, minimum setting curr_encoding_ Level is 0.
Preferably, Network status variation it is smaller generally refer to network bandwidth relative to current value variation below 10%.
In order to solve the above-mentioned technical problem, the invention also discloses a kind of, and the adaptive video based on video calling scene is compiled Code device, comprising:
Detection module, control module and coding module, in which:
The detection module, for being detected to network condition and picture situation;
The control module, network condition and picture situation for being detected according to detection module to code distinguishability with Frame per second is calculated;
The coding module encodes video according to the calculated code distinguishability of control module and frame per second;
Wherein:
For the video calling opened under particular network environment, the detection module detects initial bandwidth, the control Initial an experience code distinguishability and frame per second is arranged according to the network bandwidth detected in molding root tuber,
When the detection module detects that network condition changes, the control module is new according to the detection module Obtained bandwidth and before Video coding resolution ratio and frame per second used by bandwidth are detected, a new code distinguishability is calculated And frame per second, the coding module carry out next coding according to new code distinguishability and frame per second,
The mean error of the video of what the detection module detected for the previous period, the control module are flat according to this Equal error carrys out the adaptive code distinguishability and frame per second adjusted at this time, and error is greater than threshold value and then downgrades code distinguishability and frame Rate, error are less than threshold value and then increase encoding rate and frame per second.
Further, the control module is further set according to the CPU ability of mobile device and used encoder Determine the classification grade level of video calling coding;When starting video calling, the detection module detection network bandwidth and opposite end The ratio of width to height of picture, the control module are adapted to the initial code resolution ratio and frame of encoder according to information obtained setting Rate, in which: information obtained includes network bandwidth and CPU ability, and the CPU ability takes ability in each communication terminal minimum The value Vmin of person;The control module is cut out according to the ratio of width to height of the terminal screen of obtained recommendation resolution ratio and opposite end The close resolution ratio with opposite end the ratio of width to height, coding module are encoded according to the resolution ratio;When the detection module detects net When network bandwidth changes and is more than threshold range, the control module is grading to the resolution ratio of coding and relevant coding layer Row update, to adapt to new Network status, do not change in Network status, or variation it is smaller when, the control module according to The case where video pictures, is to the continuous automatic adjusument of the level of Video coding.
Further, the control module includes: configuration parameter as shown in Table 1, and according to the configuration parameter of table one into The following operation of row:
The CPU ability of the intelligent terminal of apple IOS operating system and the H.264 coding of used process optimization will be run The taxonomical hierarchy of device is configured by one mode of table,
The CPU ability for running the intelligent terminal of Google's Android operation system is mapped to corresponding model by one mode of table Operation apple IOS operating system intelligent terminal CPU ability,
Table one
Further, the control module includes: configuration parameter as shown in Table 2, and according to the configuration parameter of table two into The following operation of row:
By two mode of table be arranged the CPU ability of network bandwidth and intelligent terminal with recommend it is corresponding between resolution ratio and frame per second Relationship:
Table two
Further, the coding module includes: configuration parameter as shown in Table 3, and according to the configuration parameter of table three into The following operation of row:
If parameters are as shown in Table 3:
Table three
Parameter Meaning
target_aspect The ratio of width to height of opposite end picture
recomm_width Width in the resolution ratio of recommendation
recomm_height Height in the resolution ratio of recommendation
new_width New coding is wide
new_height New coding is high
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
* Indicate the mathematical operation of product
Determine that the operation of the ratio of width to height is as follows:
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise, new_width=recomm_width
New_height=recomm_width/target_aspect
If the above-mentioned wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
Further, the control module is further used for:
Resolution ratio and relevant coding when detecting that network bandwidth changes and is more than threshold range, to coding Level is updated, to adapt to new Network status.
Further, the coding module includes: the configuration parameter as shown in table four, table five, and according to table four, table five Configuration parameter proceeds as follows:
Classify by table four to coding layer grade
Table four
Resolution ratio Frame per second Level
640x480 15 10
480x320 15 9
320x240 15 8
240x160 15 7
160x120 15 6
160x120 9 5
160x120 5 4
160x120 3 3
120x80 3 2
80x60 3 1
80x60 1 0
If parameters are as shown in Table 5:
Table five
Parameter Meaning
curr_bitrate Current bandwidth
prev_bitrate Bandwidth before
bitrate_change_level The variation level of bandwidth
prev_encoding_level Coding level before
curr_encoding_level New coding level
log Expression takes the mathematical operation of logarithm
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
/ Indicate divided by mathematical operation
* Indicate the mathematical operation of product
+ Indicate the mathematical operation of summation
Determine that the operation of the variation level of bandwidth is as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
If bitrate_change_level > 0
Then, bitrate_change_level=bitrate_change_level*0.8
Otherwise, bitrate_change_level=bitrate_change_level*2.0
Determine that the operation of new coding level is as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, compiled according to resolution ratio corresponding to the coding level newly obtained and frame per second Code.
Further, the control module is further used for:
Do not change in Network status, or when variation is smaller, the case where level of Video coding is still according to video pictures Continuous automatic adjusument:
The average value of 3 seconds quantized value QP before Video coding is calculated in the encoded resolution ratio of current bandwidth and frame per second, And it makes the following judgment:
When average value is less than 24, level curr_encoding_level=prev_encoding_level+1 is encoded;
When average value is greater than 32, level curr_encoding_level=prev_encoding_level-1 is encoded;
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, maximum setting curr_ Encoding_level is 10;
When the coding level curr_encoding_level being calculated is less than 0, minimum setting curr_encoding_ Level is 0.
Adaptive video coding method and device provided by the invention based on video calling scene can constantly change Network environment and video pictures content in the case of carry out adaptive video coding, and realize preferable video definition and smooth Degree.
The additional aspect of the present invention and advantage will be set forth in part in the description, these will become from the following description Obviously, or practice through the invention is recognized.
Detailed description of the invention
Fig. 1 shows the flow diagram of the adaptive video coding method of the invention based on video calling scene;
Fig. 2 shows the detailed process schematic diagrames of the adaptive video coding method of the invention based on video calling scene;
Fig. 3 shows the module diagram of the adaptive video coding device of the invention based on video calling scene.
Specific embodiment
Embodiments of the present invention are described below in detail, the example of the embodiment is shown in the accompanying drawings, wherein from beginning Same or similar element or element with the same or similar functions are indicated to same or similar label eventually.Below by ginseng The embodiment for examining attached drawing description is exemplary, and for explaining only the invention, and is not construed as limiting the claims.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in specification of the invention Diction " comprising " refer to that there are the feature, integer, step, operation, element and/or component, but it is not excluded that in the presence of or addition Other one or more features, integer, step, operation, element, component and/or their group.It should be understood that when we claim member Part is " connected " or when " coupled " to another element, it can be directly connected or coupled to other elements, or there may also be Intermediary element.In addition, " connection " used herein or " coupling " may include being wirelessly connected or coupling.Wording used herein "and/or" includes one or more associated any cells for listing item and all combinations.
Those skilled in the art of the present technique are appreciated that unless otherwise defined, all terms used herein (including technology art Language and scientific term) there is meaning identical with the general understanding of those of ordinary skill in fields of the present invention.Should also Understand, those terms such as defined in the general dictionary, which should be understood that, to be had and the meaning in the context of the prior art The consistent meaning of justice, and unless defined as here, it will not be explained in an idealized or overly formal meaning.
Fig. 1 shows a kind of overall structure signal of ipsec security alliance hardware searching device based on IPv6 of the invention Figure.As shown in Figure 1, the invention discloses a kind of adaptive video coding methods based on video calling scene, comprising: step 101, when establishing video calling, detect the initial network bandwidth under current network environment, and the Netowrk tape for being arranged and detecting The initial code resolution ratio and frame per second that width matches carry out Video coding;Step 102, when detecting change of network environment, into The updated network bandwidth under network environment after the detection variation of one step, according to the net before updated network bandwidth, update The network bandwidth and resolution ratio that is encoding and frame per second determine updated code distinguishability and frame per second before updating, then according to Updated code distinguishability and frame per second carry out subsequent Video coding;Step 103, according to detect for the previous period The mean error of video carrys out the adaptive code distinguishability and frame per second adjusted at this time.Wherein, the view for the previous period The mean error of frequency is according to the timing that when being encoded based on current resolution and frame per second, corresponding network bandwidth is obtained Between interval in quantization step mean value.Wherein, the adaptive code distinguishability adjusted at this time and frame per second are to pass through mistake Difference is greater than threshold value and then downgrades code distinguishability and frame per second, and error is less than threshold value and then increases encoding rate and frame per second.As a kind of implementation Mode, the detection of network bandwidth are one " key frames " by the last video from starting to receive data to completion reception number It is calculated according to the time and received size of data of needs.Wherein, it is described be for the previous period according to different demands come Fixed, when needing very fast adaptation network change, the shorter time can be set, but image quality variation can be very violent, It is unstable;When thinking that frame stabilization is more important, the slightly long regular hour is needed;It is generally set to be spaced for 3-6 seconds.Wherein, institute The mean error for stating video is according to the timing that when being encoded based on current resolution and frame per second, corresponding network bandwidth is obtained Between interval in " quantization step " mean value.Wherein, the threshold value is an experience according to the acceptable degree setting to image quality Value." quantization step " refers in video compress, for realize targeted compression code rate come the data to video come controlled one A numerical value;Generally, the numerical value is bigger, video compress it is more serious, it is bigger with original video error.
Further, the step 101 includes: step 201, according to the CPU ability CPU_capacity of mobile device and Used encoder come set video calling coding classification grade level, in which: the CPU_capacity includes dominant frequency And nucleus number;Step 202, the ratio of width to height that network bandwidth and opposite end picture are detected when starting video calling, according to letter obtained Breath setting is adapted to the initial code resolution ratio and frame per second of encoder, in which: information obtained includes network bandwidth and CPU energy Power, and the CPU ability takes the value Vmin of ability reckling in each communication terminal;Step 203, according to obtained recommendation resolution ratio And the ratio of width to height of opposite end screen, it cuts out the resolution ratio close with opposite end the ratio of width to height and is encoded.
As an implementation, the CPU ability CPU_capacity and used coding according to mobile device Device come set video calling coding classification grade level (step 201), may include: will run apple IOS operating system The CPU ability of intelligent terminal and the taxonomical hierarchy of the used H.264 encoder by optimization are configured by one mode of table.
Table one
As another embodiment, the CPU ability that will run the intelligent terminal of Google's Android operation system presses table one Mode is mapped to the CPU ability of the intelligent terminal of the operation apple IOS operating system of corresponding model.
Step 201, it is logical that video is set according to the CPU ability of mobile device (dominant frequency and nucleus number) and used encoder Talk about the classification grade level of coding;
For example, CPU ability and used process optimization for the different model terminal of apple IOS system are H.264 Encoder, taxonomical hierarchy are as follows:
CPU_Capacity >=IPHONE_5S
Resolution classification level: 640x480,480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
All taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity==IPHONE_5
Resolution classification level: 640x480,480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
For 640x480 resolution ratio, when frame per second is 15, the estimation of 1/2 pixel and the volume of 16x16 to 8x8 are only opened Code block structure, 1/4 pixel and 8x4,4x8 are not turned on 4x4 coding block structure;
Other taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity==IPHONE_4S
Resolution classification level: 480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
For 480x320 resolution ratio, when frame per second is 15, the estimation of 1/2 pixel and the volume of 16x16 to 8x8 are only opened Code block structure, 1/4 pixel and 8x4,4x8 are not turned on 4x4 coding block structure;
Other taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity≤IPHONE_4
Resolution classification level: 240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
All taxonomical hierarchies only open the estimation of 1/2 pixel and the coding block structure of 16x16 to 8x8,1/4 pixel And 8x4,4x8 are not turned on 4x4 coding block structure.
For the different model terminal of each operation Google's Android system, mapped according to the CPU frequency of acquisition and nucleus number To the correspondence model of corresponding IOS system, mapping relations are as follows:
Android CPU >=4 cores and dominant frequency > 1.2G " --- --- " IPHONE_5S
Android CPU >=4 cores and dominant frequency≤1.2G " --- --- " IPHONE_5
Android CPU>=2 cores,<4 cores and dominant frequency>1.2G " --- --- " IPHONE_4S
The core of Android CPU < 2 or dominant frequency≤1.2G " --- --- " IPHONE_4
Step 202, the ratio of width to height that network bandwidth and opposite end picture are detected when starting video calling, according to letter obtained Breath setting is adapted to the initial code resolution ratio and frame per second of encoder, wherein information obtained includes network bandwidth and CPU energy Power, and the CPU ability takes the value Vmin of ability reckling in each communication terminal.
Further, the initial code resolution ratio and frame per second that encoder is adapted to according to information obtained setting (step 202) may include: that the CPU ability of network bandwidth and intelligent terminal is arranged by two mode of table and recommends resolution ratio and frame Corresponding relationship between rate.
Table two
For example, the corresponding relationship between network bandwidth and terminal CPU ability and recommendation resolution ratio and frame per second are as follows:
Bandwidth >=128kbps, CPU_Capacity >=IPHONE_4S, code distinguishability 320x240, frame per second 15, Encoding level is 8;
Bandwidth>=128kbps, CPU_Capacity<IPHONE_4S, code distinguishability 240x160, frame per second 15 are compiled Code layer grade is 7;
128kbps > bandwidth >=64kbps, to all terminals, code distinguishability 240x160, frame per second 15, coding layer Grade is 7;
64kbps > bandwidth >=32kbps, to all terminals, code distinguishability 160x120, frame per second 5 encodes level It is 4;
Bandwidth < 32kbps, to all terminals, code distinguishability 80x60, frame per second 3, coding level is 1.
Further, the ratio of width to height of the basis obtains recommendation resolution ratio and opposite end screen, cuts out wide with opposite end Height is encoded (step 203) than close resolution ratio, may include:
If parameters are as shown in Table 3:
Table three
Parameter Meaning
target_aspect The ratio of width to height of opposite end picture
recomm_width Width in the resolution ratio of recommendation
recomm_height Height in the resolution ratio of recommendation
new_width New coding is wide
new_height New coding is high
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
* Indicate the mathematical operation of product
The method for determining the ratio of width to height is as follows:
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise, new_width=recomm_width
New_height=recomm_width/target_aspect
If the above-mentioned wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
It is further, described that subsequent Video coding (step 102) is carried out according to updated code distinguishability and frame per second, Can also include: step 204, when detecting that network bandwidth changes and is more than threshold range, to the resolution ratio of coding with And relevant coding layer grade is updated, to adapt to new Network status.
As an implementation, the step 204 includes:
Classify by table four to coding layer grade
Table four
Resolution ratio Frame per second Level
640x480 15 10
480x320 15 9
320x240 15 8
240x160 15 7
160x120 15 6
160x120 9 5
160x120 5 4
160x120 3 3
120x80 3 2
80x60 3 1
80x60 1 0
If parameters are as shown in Table 5:
Table five
Parameter Meaning
curr_bitrate Current bandwidth
prev_bitrate Bandwidth before
bitrate_change_level The variation level of bandwidth
prev_encoding_level Coding level before
curr_encoding_level New coding level
log Expression takes the mathematical operation of logarithm
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
/ Indicate divided by mathematical operation
* Indicate the mathematical operation of product
+ Indicate the mathematical operation of summation
The method for determining the variation level of bandwidth is as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
If bitrate_change_level > 0
Then, bitrate_change_level=bitrate_change_level*0.8
Otherwise, bitrate_change_level=bitrate_change_level*2.0
The method for determining new coding level is as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, compiled according to resolution ratio corresponding to the coding level newly obtained and frame per second Code.
Further, the basis detect video for the previous period mean error, carry out adaptive adjusting Code distinguishability and frame per second (step 103) at this time, may include: step 205, do not change in Network status, or variation When smaller, the case where level of Video coding is still according to video pictures continuous automatic adjusument:
The average value of 3 seconds quantized value QP before Video coding is calculated in the encoded resolution ratio of current bandwidth and frame per second, And it makes the following judgment:
When average value is less than 24, level curr_encoding_level=prev_encoding_level+1 is encoded;
When average value is greater than 32, level curr_encoding_level=prev_encoding_level-1 is encoded;
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, curr_ is set Encoding_level is 10;
When the coding level curr_encoding_level being calculated is less than 0, minimum setting curr_encoding_ Level is 0.
Preferably, Network status variation it is smaller generally refer to network bandwidth relative to current value variation below 10%. For example, the interval range that user can be changed with customized Network status.In another example system can be according to Network status according to making by oneself The interval range that Network status changes is arranged in right way of conduct formula.
Adaptive video coding method disclosed by the invention based on video calling scene can be in continually changing network Video coding is carried out in the case of environment and video pictures content and realizes preferable video definition and fluency.
In order to solve the above-mentioned technical problem, the invention also discloses a kind of, and the adaptive video based on video calling scene is compiled Code device, comprising:
Detection module, control module and coding module, in which:
The detection module, for being detected to network condition and picture situation;
The control module, network condition and picture situation for being detected according to detection module to code distinguishability with Frame per second is calculated;
The coding module encodes video according to the calculated code distinguishability of control module and frame per second;
Wherein:
For the video calling opened under particular network environment, the detection module detects initial bandwidth, the control Initial an experience code distinguishability and frame per second is arranged according to the network bandwidth detected in molding root tuber,
When the detection module detects that network condition changes, the control module is new according to the detection module Obtained bandwidth and before Video coding resolution ratio and frame per second used by bandwidth are detected, a new code distinguishability is calculated And frame per second, the coding module carry out next coding according to new code distinguishability and frame per second,
The mean error of the video of what the detection module detected for the previous period, the control module are flat according to this Equal error carrys out the adaptive code distinguishability and frame per second adjusted at this time, and error is greater than threshold value and then downgrades code distinguishability and frame Rate, error are less than threshold value and then increase encoding rate and frame per second.
Further, the control module is further set according to the CPU ability of mobile device and used encoder Determine the classification grade level of video calling coding;When starting video calling, the detection module detection network bandwidth and opposite end The ratio of width to height of picture, the control module are adapted to the initial code resolution ratio and frame of encoder according to information obtained setting Rate, in which: information obtained includes network bandwidth and CPU ability, and the CPU ability takes ability in each communication terminal minimum The value Vmin of person;The control module is cut out according to the ratio of width to height of the terminal screen of obtained recommendation resolution ratio and opposite end The close resolution ratio with opposite end the ratio of width to height, coding module are encoded according to the resolution ratio;When the detection module detects net When network bandwidth changes and is more than threshold range, the control module is grading to the resolution ratio of coding and relevant coding layer Row update, to adapt to new Network status, do not change in Network status, or variation it is smaller when, the control module according to The case where video pictures, is to the continuous automatic adjusument of the level of Video coding.
Further, the control module includes: configuration parameter as shown in Table 1, and according to the configuration parameter of table one into The following operation of row:
The CPU ability of the intelligent terminal of apple IOS operating system and the H.264 coding of used process optimization will be run The taxonomical hierarchy of device is configured by one mode of table,
The CPU ability for running the intelligent terminal of Google's Android operation system is mapped to corresponding model by one mode of table Operation apple IOS operating system intelligent terminal CPU ability,
Table one
.As an implementation, control module is set according to the CPU ability of mobile device and used encoder The classification grade level of video calling coding;
For example, CPU ability and used process optimization for the different model terminal of apple IOS system are H.264 Encoder, taxonomical hierarchy are as follows:
CPU_Capacity >=IPHONE_5S
Resolution classification level: 640x480,480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
All taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity==IPHONE_5
Resolution classification level: 640x480,480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
For 640x480 resolution ratio, when frame per second is 15, the estimation of 1/2 pixel and the volume of 16x16 to 8x8 are only opened Code block structure, 1/4 pixel and 8x4,4x8 are not turned on 4x4 coding block structure;
Other taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity==IPHONE_4S
Resolution classification level: 480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
For 480x320 resolution ratio, when frame per second is 15, the estimation of 1/2 pixel and the volume of 16x16 to 8x8 are only opened Code block structure, 1/4 pixel and 8x4,4x8 are not turned on 4x4 coding block structure;
Other taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4.
CPU_Capacity≤IPHONE_4
Resolution classification level: 240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
All taxonomical hierarchies only open the estimation of 1/2 pixel and the coding block structure of 16x16 to 8x8,1/4 pixel And 8x4,4x8 are not turned on 4x4 coding block structure.
For the different model terminal of each operation Google's Android system, mapped according to the CPU frequency of acquisition and nucleus number To the correspondence model of corresponding IOS system, mapping relations are as follows:
Android CPU >=4 cores and dominant frequency > 1.2G " --- --- " IPHONE_5S
Android CPU >=4 cores and dominant frequency≤1.2G " --- --- " IPHONE_5
Android CPU>=2 cores,<4 cores and dominant frequency>1.2G " --- --- " IPHONE_4S
The core of Android CPU < 2 or dominant frequency≤1.2G " --- --- " IPHONE_4
Further, the control module includes: configuration parameter as shown in Table 2, and according to the configuration parameter of table two into The following operation of row:
By two mode of table be arranged the CPU ability of network bandwidth and intelligent terminal with recommend it is corresponding between resolution ratio and frame per second Relationship:
Table two
As an implementation, when starting video calling, the width of detection module detection network bandwidth and opposite end picture is high Than control module is adapted to the initial code resolution ratio and frame per second of encoder according to information obtained setting, wherein is obtained Information include network bandwidth and CPU ability, and the CPU ability takes the value Vmin of ability reckling in each communication terminal.
Wherein, the corresponding relationship between network bandwidth and terminal CPU ability and recommendation resolution ratio and frame per second are as follows:
Bandwidth >=128kbps, CPU_Capacity >=IPHONE_4S, code distinguishability 320x240, frame per second 15, Encoding level is 8;
Bandwidth>=128kbps, CPU_Capacity<IPHONE_4S, code distinguishability 240x160, frame per second 15 are compiled Code layer grade is 7;
128kbps > bandwidth >=64kbps, to all terminals, code distinguishability 240x160, frame per second 15, coding layer Grade is 7;
64kbps > bandwidth >=32kbps, to all terminals, code distinguishability 160x120, frame per second 5 encodes level It is 4;
Bandwidth < 32kbps, to all terminals, code distinguishability 80x60, frame per second 3, coding level is 1.
Further, the coding module includes: configuration parameter as shown in Table 3, and according to the configuration parameter of table three into The following operation of row:
If parameters are as shown in Table 3:
Table three
Parameter Meaning
target_aspect The ratio of width to height of opposite end picture
recomm_width Width in the resolution ratio of recommendation
recomm_height Height in the resolution ratio of recommendation
new_width New coding is wide
new_height New coding is high
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
* Indicate the mathematical operation of product
Determine that the operation of the ratio of width to height is as follows:
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise, new_width=recomm_width
New_height=recomm_width/target_aspect
If the above-mentioned wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
As an implementation, control module is high according to the width of the terminal screen of obtained recommendation resolution ratio and opposite end Than cutting out the resolution ratio close with opposite end the ratio of width to height, coding module is encoded according to the resolution ratio.
Wherein it is determined that the method for the ratio of width to height is as follows:
If the ratio of width to height of opposite end picture is target_aspect, the high width in the resolution ratio of recommendation is respectively recomm_ Width, recomm_height, new coding width and a height of new_width, new_height,
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise,
New_width=recomm_width
New_height=recomm_width/target_aspect
If the above-mentioned wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
Further, the control module is further used for:
Resolution ratio and relevant coding when detecting that network bandwidth changes and is more than threshold range, to coding Level is updated, to adapt to new Network status.
Further, the coding module includes: the configuration parameter as shown in table four, table five, and according to table four, table five Configuration parameter proceeds as follows:
Classify by table four to coding layer grade
Table four
Resolution ratio Frame per second Level
640x480 15 10
480x320 15 9
320x240 15 8
240x160 15 7
160x120 15 6
160x120 9 5
160x120 5 4
160x120 3 3
120x80 3 2
80x60 3 1
80x60 1 0
If parameters are as shown in Table 5:
Table five
Parameter Meaning
curr_bitrate Current bandwidth
prev_bitrate Bandwidth before
bitrate_change_level The variation level of bandwidth
prev_encoding_level Coding level before
curr_encoding_level New coding level
log Expression takes the mathematical operation of logarithm
= Indicate the logic judgment being equal to
> Indicate the logic judgment being greater than
/ Indicate divided by mathematical operation
* Indicate the mathematical operation of product
+ Indicate the mathematical operation of summation
Determine that the operation of the variation level of bandwidth is as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
If bitrate_change_level > 0
Then, bitrate_change_level=bitrate_change_level*0.8
Otherwise, bitrate_change_level=bitrate_change_level*2.0
Determine that the operation of new coding level is as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, compiled according to resolution ratio corresponding to the coding level newly obtained and frame per second Code.As an implementation, when detection module detects that network bandwidth changes and is more than threshold range, control module Resolution ratio and relevant coding layer grade to coding are updated, to adapt to new Network status;
Wherein, hierarchical classification is encoded are as follows:
Resolution ratio Frame per second Level
640x480 15 10
480x320 15 9
320x240 15 8
240x160 15 7
160x120 15 6
160x120 9 5
160x120 5 4
160x120 3 3
120x80 3 2
80x60 3 1
80x60 1 0
If current bandwidth is curr_bitrate, bandwidth before is prev_bitrate, then the change layer of computation bandwidth The formula of grade are as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
if(bitrate_change_level>0)
Bitrate_change_level=bitrate_change_level*0.8
else
Bitrate_change_level=bitrate_change_level*2.0
If coding level before is prev_encoding_level, new coding level are as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, coding module resolution ratio according to corresponding to the coding level newly obtained and frame per second To be encoded.
Further, the control module is further used for:
Do not change in Network status, or when variation is smaller, the case where level of Video coding is still according to video pictures Continuous automatic adjusument:
The average value of 3 seconds quantized value QP before Video coding is calculated in the encoded resolution ratio of current bandwidth and frame per second, And it makes the following judgment:
When average value is less than 24, level curr_encoding_level=prev_encoding_level+1 is encoded;
When average value is greater than 32, level curr_encoding_level=prev_encoding_level-1 is encoded;
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, maximum setting curr_ Encoding_level is 10;
When the coding level curr_encoding_level being calculated is less than 0, minimum setting curr_encoding_ Level is 0.
As an implementation, when not changing in Network status, or changing smaller, control module is drawn according to video The case where face, is to the continuous automatic adjusument of the level of Video coding: calculate H.264 Video coding at encoded point of current bandwidth When resolution and frame per second, the average value of first 3 seconds quantized value QP encodes level curr_encoding_ when average value is less than 24 Level=prev_encoding_level+1;When average value is greater than 32, level curr_encoding_level=is encoded Prev_encoding_level-1.
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, curr_ is set Encoding_level is 10;When the coding level curr_encoding_level being calculated is less than 0, minimum setting Curr_encoding_level is 0.
Adaptive video coding device disclosed by the invention based on video calling scene can be in continually changing network Video coding is carried out in the case of environment and video pictures content and realizes preferable video definition and fluency.
Specific embodiment 1:
It is assumed that two terminals for carrying out video calling are respectively IPHONE5S (screen width high ratio is 16:9) and Huawei P7 (CPU is 4 core 1.8G dominant frequency, screen width high ratio 16:9), the WIFI network that they upload and download in stable 512kbps Carry out video calling under environment, H.264 encoder with being encoded.
The first step, according to CPU ability and the corresponding relationship of used encoder, the parameter setting of this two terminals are as follows:
Resolution classification level: 640x480,480x320,320x240,240x160,160x120,120x80,80x60
Frame per second taxonomical hierarchy: 15,9,5,3,1
All taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4, The ratio of width to height of both sides video is 16:9 simultaneously.
Second step, according to network bandwidth and the corresponding relationship of terminal CPU ability, the starting of this two terminal videos call is pushed away Recommending resolution ratio is 320x240, frame per second 15;Since the ratio of width to height of 320x240 is not 16:9, determines and use after cutting 320x180 carrys out actual coding, encodes level curr_encoding_level=8.
Third step, due to being sitting in interior when user's communication, picture is more stable;After 3 seconds, H.264 statistics is encoded Average QP less than 24, resolution ratio is automatically adjusted based on the feedback signal as 480x272, encodes level curr_encoding_level=9;After 3 Second, the average QP that H.264 discovery statistics is encoded then adjusts resolution ratio to 640x360, coding layer still less than 24 again Grade curr_encoding_level=10;It is stabilized to end of conversation always later.
Specific embodiment 2:
It is assumed that two terminals for carrying out video calling are respectively IPHONE4S (screen width high ratio is 3:2) and 4 (CPU of millet For 4 core 2.5G dominant frequency, screen width high ratio 16:9), video is carried out under the conditions of their all in a network environment continually changing 3G Call, H.264 encoder with being encoded.
The first step takes the smaller of this two terminal capabilities according to CPU ability and the corresponding relationship of used encoder Person, so parameter setting are as follows: resolution classification level: 480x320,320x240,240x160,160x120,120x80, 80x60, frame per second taxonomical hierarchy: 15,9,5,3,1.
For 480x320 resolution ratio, when frame per second is 15, the estimation of 1/2 pixel and the volume of 16x16 to 8x8 are only opened Code block structure, 1/4 pixel and 8x4,4x8 are not turned on 4x4 coding block structure.
Other taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4. IPHONE4S is encoded according to 16:9 the ratio of width to height of millet 4 simultaneously, and millet 4 is encoded according to the 3:2 of IPHONE4S.
Second step, the network for just starting IPHONE4S is that upload and download bandwidth be respectively 64kbps/128kbps, millet 4 Uploading and downloading bandwidth is respectively 32kbps/64kbps;So encoded bandwidth of IPHONE4S is no more than 64kbps (smaller of IPHONE4S uploading bandwidth and 4 download bandwidth of millet), the encoded bandwidth of millet 4 is no more than 32kbps (smaller of IPHONE4S download bandwidth and 4 uploading bandwidth of millet);It is closed according to network bandwidth and the corresponding of terminal CPU ability System, it is 240x160 that resolution ratio is recommended in the starting of IPHONE4S, and frame per second 15 encodes level curr_encoding_level=7; It is 160x120 that resolution ratio is recommended in the starting of millet 4, and frame per second 5 encodes level curr_encoding_level=4;Due to IPHONE4S will be encoded according to 16:9, so practical start code resolution ratio is 240x144;Millet 4 will be encoded according to 3:2, real Border start code resolution ratio is 160x108.
Third step, since in communication process, the variation of external web environment, the network of IPHONE4S is to upload and download Bandwidth becomes 156kbps/208kbps respectively, and millet 4 uploads and downloads bandwidth becomes 96kbps/120kbps respectively;So The encoded bandwidth of IPHONE4S also becomes no more than 120kbps that (IPHONE4S uploading bandwidth is smaller with 4 download bandwidth of millet Person), the encoded bandwidth of millet 4 becomes no more than 96kbps that (IPHONE4S download bandwidth is smaller with 4 uploading bandwidth of millet Person);
The bitrate_change_level=0.8* of IPHONE4S is calculated according to the formula of the variation level of computation bandwidth Log (120/64)/log (2.0)=0.73 < 1, calculate millet 4 bitrate_change_level=0.8*log (96/32)/ Log (2.0)=1.27 < 2;So IPHONE4S does not need to promote the level of coding, do not change resolution ratio and frame per second;And millet 4 Coding level needs to be promoted a class, curr_encoding_level=5, and resolution ratio becomes 160x108, and frame per second becomes 9.
4th step is seated on the seat since 4 user of millet in video calling becomes stable from the state of walking, though Right network condition does not change, but picture becomes stable;After 3 seconds, it is flat that statistics obtains H.264 encoding for 4 user of millet For equal QP less than 24, coding level promotes one grade of curr_encoding_level=5, and resolution ratio is automatically adjusted based on the feedback signal as 160x108, Frame per second becomes 9;After 3 seconds, discovery 4 user of millet counted the average QP H.264 encoded still less than 24, and coding level is again One grade of curr_encoding_level=6 is promoted, then adjusts resolution ratio again to 240x160;It is stabilized to call always later Terminate.
Those skilled in the art of the present technique are appreciated that the present invention can be related to for executing in operation described herein The equipment of one or more operations.The equipment can specially design and manufacture for required purpose, or also may include Known device in general purpose computer, the general purpose computer are activated or are reconstructed with having the procedure selection being stored in it.This The computer program of sample can be stored in equipment (for example, computer) readable medium or be stored in be referred to suitable for storage electronics It enables and is coupled in any kind of medium of bus respectively, the computer-readable medium is including but not limited to any kind of Disk (including floppy disk, hard disk, CD, CD-ROM and magneto-optic disk), immediately memory (RAM), read-only memory (ROM), electricity can be compiled Journey ROM, electrically erasable ROM (EPROM), electrically erasable ROM (EEPROM), flash memory, magnetic card or light card.It is readable Medium includes for by any mechanism of the readable form storage or transmission information of equipment (for example, computer).For example, readable Medium include immediately memory (RAM), read-only memory (ROM), magnetic disk storage medium, optical storage medium, flash memory device, with The signal (such as carrier wave, infrared signal, digital signal) etc. that electricity, light, sound or other forms are propagated.
Those skilled in the art of the present technique be appreciated that can be realized with computer program instructions these structure charts and/or The combination of each frame and these structure charts and/or the frame in block diagram and/or flow graph in block diagram and/or flow graph.It can be by this The processor that a little computer program instructions are supplied to general purpose computer, special purpose computer or other programmable data processing methods comes Machine is generated, is used for be performed instruction by the processor of computer or other programmable data processing methods and create Realize the method specified in the frame or multiple frames of structure chart and/or block diagram and/or flow graph.
Those skilled in the art of the present technique have been appreciated that in the present invention the various operations crossed by discussion, method, in process Steps, measures, and schemes can be replaced, changed, combined or be deleted.Further, each with having been crossed by discussion in the present invention Kind of operation, method, other steps, measures, and schemes in process may also be alternated, changed, rearranged, decomposed, combined or deleted. Further, in the prior art to have and the step in various operations, method disclosed in the present invention, process, measure, scheme It may also be alternated, changed, rearranged, decomposed, combined or deleted.
The above is only some embodiments of the invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (5)

1. a kind of adaptive video coding method based on video calling scene characterized by comprising
Step 101, when establishing video calling, the initial network bandwidth under current network environment is detected, and is arranged and detects The initial code resolution ratio that matches of network bandwidth and frame per second carry out Video coding;
Step 102, the updated network under network environment when detecting change of network environment, after further detection changes Bandwidth, according to the network bandwidth before updated network bandwidth, update and before updating the resolution ratio that is encoding and frame per second come It determines updated code distinguishability and frame per second, subsequent Video coding is carried out according to updated code distinguishability and frame per second;
Step 103, according to detect video for the previous period mean error, carry out the adaptive coding adjusted at this time Resolution ratio and frame per second, in which:
The mean error of the video for the previous period is basis when being encoded based on current resolution and frame per second, right The mean value for the quantization step in certain time interval that the network bandwidth answered obtains;
The adaptive code distinguishability adjusted at this time and frame per second are to be greater than threshold value by error then to downgrade code distinguishability With frame per second, error is less than threshold value and then increases encoding rate and frame per second;
The step 101 further comprises:
Step 201, the classification grade of video calling coding is set according to the CPU ability of mobile device and used encoder Level, in which: the CPU ability includes dominant frequency and nucleus number;
Step 202, the ratio of width to height that network bandwidth and opposite end picture are detected when starting video calling, sets according to information obtained Set the initial code resolution ratio and frame per second for being adapted to encoder, in which: information obtained includes network bandwidth and CPU ability, And the CPU ability takes the value Vmin of ability reckling in each communication terminal;
Step 203, it according to the ratio of width to height of obtained recommendation resolution ratio and opposite end screen, cuts out close with opposite end the ratio of width to height Resolution ratio is encoded;
The step 102 further comprises:
Step 204, when detecting that network bandwidth changes and is more than threshold range, resolution ratio to coding and relevant Coding layer grade is updated, to adapt to new Network status;
The step 204 further comprises:
Classify to coding layer grade:
Resolution ratio 640x480, frame per second 15, level 10;
Resolution ratio 480x320, frame per second 15, level 9;
Resolution ratio 320x240, frame per second 15, level 8;
Resolution ratio 240x160, frame per second 15, level 7;
Resolution ratio 160x120, frame per second 15, level 6;
Resolution ratio 160x120, frame per second 9, level 5;
Resolution ratio 160x120, frame per second 5, level 4;
Resolution ratio 160x120, frame per second 3, level 3;
Resolution ratio 120x80, frame per second 3, level 2;
Resolution ratio 80x60, frame per second 3, level 1;
Resolution ratio 80x60, frame per second 1, level 0;
The method for determining the variation level of bandwidth is as follows:
Bitrate_change_level=log (curr_bitrate/prev_bitrate)/log (2.0)
If bitrate_change_level > 0
Then, bitrate_change_level=bitrate_change_level*0.8
Otherwise, bitrate_change_level=bitrate_change_level*2.0
The method for determining new coding level is as follows:
Curr_encoding_level=prev_encoding_level+bitrate_change_l evel
After obtaining new coding level, encoded according to resolution ratio corresponding to the coding level newly obtained and frame per second;
Wherein, curr_bitrate indicates current bandwidth, the bandwidth before prev_bitrate expression, bitrate_ Change_level indicates the variation level of bandwidth, the coding level before prev_encoding_level expression, curr_ Encoding_level indicates new coding level, and log indicates to take the mathematical operation of logarithm ,=indicate that the logic being equal to is sentenced It is disconnected, > indicate the logic judgment being greater than ,/indicate divided by mathematical operation, * indicates the mathematical operation of product ,+indicate the number of summation Student movement is calculated.
2. the method according to claim 1, wherein the step 201 further comprises:
The H.264 encoder that the CPU ability and used process that the intelligent terminal of apple IOS operating system will be run optimize Taxonomical hierarchy is configured in the following manner:
The CPU ability of apple IOS operating system be greater than or equal to IPHONE_5S, code distinguishability taxonomical hierarchy be 640x480, 480x320,320x240,240x160,160x120,120x80,80x60, frame per second taxonomical hierarchy are 15,9,5,3,1, Suo Youfen Class hierarchy opens the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4;
The CPU ability of apple IOS operating system be equal to IPHONE_5, code distinguishability taxonomical hierarchy be 640x480,480x320, 320x240,240x160,160x120,120x80,80x60, frame per second taxonomical hierarchy are 15,9,5,3,1, and 640x480 is differentiated When rate and frame per second are 15, the estimation of 1/2 pixel and the coding block structure of 16x16 to 8x8 are only opened, and is not turned on 1/4 picture The estimation and 8x4,4x8 and 4x4 coding block structure of element;Other points other than 640x480 resolution ratio and frame per second are 15 Class hierarchy opens the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4;
The CPU ability of apple IOS operating system be equal to IPHONE_4S, code distinguishability taxonomical hierarchy be 480x320, 320x240,240x160,160x120,120x80,80x60, frame per second taxonomical hierarchy are 15,9,5,3,1, and 480x320 is differentiated When rate and frame per second are 15, the estimation of 1/2 pixel and the coding block structure of 16x16 to 8x8 are only opened, and is not turned on 1/4 picture The estimation and 8x4,4x8 and 4x4 coding block structure of element;Other points other than 480x320 resolution ratio and frame per second are 15 Class hierarchy opens the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4;
The CPU ability of apple IOS operating system be less than or equal to IPHONE_4, code distinguishability taxonomical hierarchy be 240x160, 160x120,120x80,80x60, frame per second taxonomical hierarchy are 15,9,5,3,1, and all taxonomical hierarchies only open the fortune of 1/2 pixel The coding block structure of dynamic estimation and 16x16 to 8x8, and it is not turned on the estimation and 8x4,4x8 and 4x4 encoding block of 1/4 pixel Structure;
The CPU ability for running the intelligent terminal of Google's Android operation system is mapped to the fortune of corresponding model in the following manner The CPU ability of the intelligent terminal of row apple IOS operating system:
The CPU ability of Google's Android operation system is greater than or equal to 4 cores and dominant frequency is greater than 1.2G, code distinguishability classification layer It is secondary be 640x480,480x320,320x240,240x160,160x120,120x80,80x60, frame per second taxonomical hierarchy be 15,9, 5,3,1, all taxonomical hierarchies open the estimation of 1/4 fraction pixel and all coding block structures of 16x16 to 4x4;
The CPU ability of Google's Android operation system is greater than or equal to 4 cores and dominant frequency is less than or equal to 1.2G, code distinguishability Taxonomical hierarchy is 640x480,480x320,320x240,240x160,160x120,120x80,80x60, and frame per second taxonomical hierarchy is 15,9,5,3,1, for 640x480 resolution ratio and when frame per second is 15, only open the estimation and 16x16 to 8x8 of 1/2 pixel Coding block structure, and be not turned on the estimation and 8x4,4x8 and 4x4 coding block structure of 1/4 pixel;In addition to 640x480 points Resolution and frame per second are other taxonomical hierarchies other than 15, open the estimation of 1/4 fraction pixel and the institute of 16x16 to 4x4 There is coding block structure;
The CPU ability of Google's Android operation system is greater than or equal to 2 cores and less than 4 core and dominant frequency is greater than 1.2G, and coding is differentiated Rate taxonomical hierarchy be 480x320,320x240,240x160,160x120,120x80,80x60, frame per second taxonomical hierarchy be 15,9, 5,3,1, for 480x320 resolution ratio and when frame per second is 15, only open the estimation of 1/2 pixel and the coding of 16x16 to 8x8 Block structure, and it is not turned on the estimation and 8x4,4x8 and 4x4 coding block structure of 1/4 pixel;In addition to 480x320 resolution ratio and Frame per second is other taxonomical hierarchies other than 15, opens the estimation of 1/4 fraction pixel and all codings of 16x16 to 4x4 Block structure;
The CPU ability of Google's Android operation system is less than or equal to 1.2G, code distinguishability classification layer less than 2 cores or dominant frequency Secondary is 240x160,160x120,120x80,80x60, and frame per second taxonomical hierarchy is 15,9,5,3,1, and all taxonomical hierarchies are only opened Open the estimation of 1/2 pixel and the coding block structure of 16x16 to 8x8, and be not turned on 1/4 pixel estimation and 8x4, 4x8 and 4x4 coding block structure.
3. according to the method described in claim 2, it is characterized in that, the step 202 further comprises:
The CPU ability pass corresponding between recommendation resolution ratio and frame per second of network bandwidth and intelligent terminal is set in the following manner System:
Bandwidth is greater than or equal to 128kbps, and CPU ability is greater than or equal to IPHONE_4S, code distinguishability 320x240, frame per second It is 15, coding level is 8;
Bandwidth be greater than or equal to 128kbps, CPU ability be less than IPHONE_4S, code distinguishability 240x160, frame per second 15, Encoding level is 7;
Bandwidth is greater than or equal to 64kbps and is less than 128kbps, all types of CPU, code distinguishability 240x160, frame per second It is 15, coding level is 7;
Bandwidth is greater than or equal to 32kbps and is less than 64kbps, all types of CPU, code distinguishability 160x120, and frame per second is 5, coding level is 4;
Bandwidth is less than 32kbps, all types of CPU, code distinguishability 80x60, frame per second 3, and coding level is 1.
4. according to the method described in claim 2, it is characterized in that, the step 203 further comprises:
The method for determining the ratio of width to height is as follows:
If recomm_width > recomm_height*target_aspect
Then, new_width=recomm_height*target_aspect
New_height=recomm_height
Otherwise, new_width=recomm_width
New_height=recomm_width/target_aspect
Wherein, target_aspect indicates the ratio of width to height of opposite end picture, and recomm_width is indicated in the resolution ratio recommended Width, recomm_height indicate that the height in the resolution ratio recommended, new_width indicate that new coding is wide, and new_height is indicated New coding is high ,=indicate the logic judgment being equal to, > indicate that the logic judgment being greater than, * indicate the mathematical operation of product;
If the wide height being calculated is not 16 integral multiple, it is cut to 16 multiple.
5. the method according to claim 1, wherein the step 103 further comprises:
Step 205, when not changing in Network status, or changing smaller, the level of Video coding is still according to video pictures The continuous automatic adjusument of situation:
The average value of 3 seconds quantized value QP, goes forward side by side before Video coding is calculated in the encoded resolution ratio of current bandwidth and frame per second The following judgement of row:
When average value is less than 24, level curr_encoding_level=prev_encoding_level+1 is encoded;
When average value is greater than 32, level curr_encoding_level=prev_encoding_level-1 is encoded;
Wherein, when the coding level curr_encoding_level being calculated is greater than 10, maximum setting curr_ Encoding_level is 10;
When the coding level curr_encoding_level being calculated is less than 0, minimum setting curr_encoding_ Level is 0.
CN201410609593.1A 2014-11-03 2014-11-03 Adaptive video coding method and device based on video calling scene Active CN105635734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410609593.1A CN105635734B (en) 2014-11-03 2014-11-03 Adaptive video coding method and device based on video calling scene

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410609593.1A CN105635734B (en) 2014-11-03 2014-11-03 Adaptive video coding method and device based on video calling scene

Publications (2)

Publication Number Publication Date
CN105635734A CN105635734A (en) 2016-06-01
CN105635734B true CN105635734B (en) 2019-04-12

Family

ID=56050167

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410609593.1A Active CN105635734B (en) 2014-11-03 2014-11-03 Adaptive video coding method and device based on video calling scene

Country Status (1)

Country Link
CN (1) CN105635734B (en)

Families Citing this family (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107547913B (en) * 2016-06-27 2021-06-18 阿里巴巴集团控股有限公司 Video data playing and processing method, client and equipment
CN108093197B (en) * 2016-11-21 2021-06-15 阿里巴巴集团控股有限公司 Method, system and machine-readable medium for information sharing
CN108696772B (en) * 2017-04-11 2021-07-16 苏州谦问万答吧教育科技有限公司 Real-time video transmission method and device
CN109831637A (en) * 2017-11-23 2019-05-31 中兴通讯股份有限公司 Data transmission method, server and system in a kind of video conference
CN109587560A (en) * 2018-11-27 2019-04-05 Oppo广东移动通信有限公司 Method for processing video frequency, device, electronic equipment and storage medium
CN110418177B (en) * 2019-04-19 2021-06-11 腾讯科技(深圳)有限公司 Video encoding method, apparatus, device and storage medium
CN110505503A (en) * 2019-08-08 2019-11-26 武汉兴图新科电子股份有限公司 Audio-video is classified Adaptive Transmission system
CN112533022A (en) * 2019-08-30 2021-03-19 中兴通讯股份有限公司 Cloud set top box transparency superposition method, cloud set top box and storage medium
CN112752058B (en) * 2019-10-31 2022-10-04 华为技术有限公司 Method and device for adjusting attribute of video stream
CN110769271B (en) * 2019-11-11 2021-09-14 广州酷狗计算机科技有限公司 Method and device for adjusting code rate of multi-path code stream
CN113395244B (en) * 2020-03-13 2023-03-24 杭州海康威视数字技术股份有限公司 Code stream control method, device and equipment and storage medium
CN111770335B (en) * 2020-07-08 2024-04-02 西安万像电子科技有限公司 Data coding method and device
CN111741298B (en) * 2020-08-26 2020-12-01 腾讯科技(深圳)有限公司 Video coding method and device, electronic equipment and readable storage medium
CN112637680B (en) * 2020-12-18 2023-03-24 努比亚技术有限公司 Display frame rate processing control method, device and computer readable storage medium
CN112738507A (en) * 2020-12-23 2021-04-30 百果园技术(新加坡)有限公司 Method, device and equipment for determining coding mode and storage medium
CN113473228B (en) * 2021-06-11 2022-12-27 深圳锐取信息技术股份有限公司 Transmission control method, device, storage medium and equipment for 8K recorded and played video
CN113573101B (en) * 2021-07-09 2023-11-28 百果园技术(新加坡)有限公司 Video coding method, device, equipment and storage medium
CN115623216A (en) * 2021-07-15 2023-01-17 广州迈聆信息科技有限公司 Video coding method and device, intelligent equipment and storage medium

Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581970A (en) * 2003-08-13 2005-02-16 华为技术有限公司 Code flow bandwidth equalizing method
CN1668109A (en) * 2004-03-10 2005-09-14 浙江大学 Adaptive video transcoding gateway having multiple transforming functions
CN1678074A (en) * 2004-03-29 2005-10-05 三星电子株式会社 Method and apparatus for generating motion vector in lamina motion evaluation
CN1905674A (en) * 2006-07-31 2007-01-31 大唐微电子技术有限公司 Method for forming fraction precision wavelet reference block
CN101047845A (en) * 2006-03-29 2007-10-03 腾讯科技(深圳)有限公司 Device and method for regulating vedio communication data code ratio
CN101102493A (en) * 2007-08-07 2008-01-09 华亚微电子(上海)有限公司 A method for chip storage applicable motion estimation
CN101146204A (en) * 2006-09-12 2008-03-19 腾讯科技(深圳)有限公司 Quality adjusting method and device for instant communication video
CN101227611A (en) * 2008-01-31 2008-07-23 上海广电(集团)有限公司中央研究院 AVS-based motion estimation apparatus and searching method
CN101365125A (en) * 2008-09-27 2009-02-11 腾讯科技(深圳)有限公司 Multipath video communication method and system
CN101720039A (en) * 2009-09-08 2010-06-02 广东工业大学 Diamond search-based multi-resolution quick motion estimation method
CN102783149A (en) * 2010-02-19 2012-11-14 高通股份有限公司 Adaptive motion resolution for video coding
CN102883157A (en) * 2011-07-12 2013-01-16 浙江大学 Video coding method and video coder
CN103108177A (en) * 2011-11-09 2013-05-15 华为技术有限公司 Image coding method and image coding device
CN103202016A (en) * 2010-10-13 2013-07-10 高通股份有限公司 Adaptive motion vector resolution signaling for video coding
CN103475851A (en) * 2013-09-05 2013-12-25 齐齐哈尔大学 Dynamic encoding device and method based on bandwidth detection
CN103517137A (en) * 2013-09-30 2014-01-15 广州华多网络科技有限公司 Network video transmission method and system, sending/receiving end processing method and device
CN103974060A (en) * 2013-01-31 2014-08-06 华为技术有限公司 Method and device for adjusting video quality

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8467412B2 (en) * 2010-04-14 2013-06-18 Ericsson Television Inc. Adaptive rate shifting for delivery of video services to service groups

Patent Citations (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1581970A (en) * 2003-08-13 2005-02-16 华为技术有限公司 Code flow bandwidth equalizing method
CN1668109A (en) * 2004-03-10 2005-09-14 浙江大学 Adaptive video transcoding gateway having multiple transforming functions
CN1678074A (en) * 2004-03-29 2005-10-05 三星电子株式会社 Method and apparatus for generating motion vector in lamina motion evaluation
CN101047845A (en) * 2006-03-29 2007-10-03 腾讯科技(深圳)有限公司 Device and method for regulating vedio communication data code ratio
CN1905674A (en) * 2006-07-31 2007-01-31 大唐微电子技术有限公司 Method for forming fraction precision wavelet reference block
CN101146204A (en) * 2006-09-12 2008-03-19 腾讯科技(深圳)有限公司 Quality adjusting method and device for instant communication video
CN101102493A (en) * 2007-08-07 2008-01-09 华亚微电子(上海)有限公司 A method for chip storage applicable motion estimation
CN101227611A (en) * 2008-01-31 2008-07-23 上海广电(集团)有限公司中央研究院 AVS-based motion estimation apparatus and searching method
CN101365125A (en) * 2008-09-27 2009-02-11 腾讯科技(深圳)有限公司 Multipath video communication method and system
CN101720039A (en) * 2009-09-08 2010-06-02 广东工业大学 Diamond search-based multi-resolution quick motion estimation method
CN102783149A (en) * 2010-02-19 2012-11-14 高通股份有限公司 Adaptive motion resolution for video coding
CN103202016A (en) * 2010-10-13 2013-07-10 高通股份有限公司 Adaptive motion vector resolution signaling for video coding
CN102883157A (en) * 2011-07-12 2013-01-16 浙江大学 Video coding method and video coder
CN103108177A (en) * 2011-11-09 2013-05-15 华为技术有限公司 Image coding method and image coding device
CN103974060A (en) * 2013-01-31 2014-08-06 华为技术有限公司 Method and device for adjusting video quality
CN103475851A (en) * 2013-09-05 2013-12-25 齐齐哈尔大学 Dynamic encoding device and method based on bandwidth detection
CN103517137A (en) * 2013-09-30 2014-01-15 广州华多网络科技有限公司 Network video transmission method and system, sending/receiving end processing method and device

Also Published As

Publication number Publication date
CN105635734A (en) 2016-06-01

Similar Documents

Publication Publication Date Title
CN105635734B (en) Adaptive video coding method and device based on video calling scene
US11606564B2 (en) Video encoding code rate control method, apparatus, and device, and storage medium
CN101466035B (en) Method for distributing video image set bit based on H.264
CN104704814B (en) It is transmitted in the method and video conferencing system that information is exchanged in video conference
CN110650370B (en) Video coding parameter determination method and device, electronic equipment and storage medium
CN111432207A (en) Perceptual high-definition video coding method based on salient target detection and salient guidance
CN101742294B (en) Method and device for enhancing monitoring video compression ratio
CN111787318A (en) Video code rate control method, device, equipment and storage device
CN102938840A (en) Key frame quantization parameter selecting method applied to multi-viewpoint video coding system
CN101472131A (en) Visual telephone with movement perceptive function and method for enhancing image quality
CN115052150A (en) Video encoding method, video encoding device, electronic equipment and storage medium
CN104052992B (en) A kind of image processing method and electronic equipment
KR20210145719A (en) Additional information for video coding with different compression levels
CN109286818A (en) Video coding apparatus and correspondingly method for video coding
CN112788335B (en) H.264 frame-level code rate control method suitable for real-time video transmission
EP2888877B1 (en) Method and apparatus for estimating content complexity for video quality assessment
CN111479113A (en) Code rate control method and device, storage medium and electronic equipment
CN104135662B (en) Improved H.264 compressed encoding method for video file under limited bandwidth and emission rate condition
KR20150114959A (en) Method and apparatus for context-based video quality assessment
CN109660804A (en) A kind of video frame coding/decoding method based on model selection
Kazemian An intelligent video streaming technique in zigbee wireless
KR20150115771A (en) Method and apparatus for context-based video quality assessment
Chao et al. Perceptual HEVC/H. 265 system with local just-noticeable-difference model
JP2017028622A (en) Image quality control device, image quality control method, image quality control system, and image quality controlling program
CN116760988B (en) Video coding method and device based on human visual system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200709

Address after: 603a, block a, Xinghe world, No.1 Yabao Road, Longgang District, Shenzhen City, Guangdong Province

Patentee after: Shenzhen Weiwu Technology Co., Ltd

Address before: 200063, Shanghai, Putuo District, home on the first floor of the cross road, No. 28

Patentee before: Palmwin Information Technology (Shanghai) Co.,Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20210202

Address after: 518051 2503, building 15, Longhai homeland, 5246 Yihai Avenue, baonanshan District, Shenzhen City, Guangdong Province

Patentee after: Xiao Feng

Address before: 603a, block a, Xinghe world, No.1, Yabao Road, Longgang District, Shenzhen, Guangdong 518035

Patentee before: Shenzhen Weiwu Technology Co., Ltd