CN111787327A - Code stream smoothing control method and system - Google Patents

Code stream smoothing control method and system Download PDF

Info

Publication number
CN111787327A
CN111787327A CN202010626097.2A CN202010626097A CN111787327A CN 111787327 A CN111787327 A CN 111787327A CN 202010626097 A CN202010626097 A CN 202010626097A CN 111787327 A CN111787327 A CN 111787327A
Authority
CN
China
Prior art keywords
value
frame
key frame
target key
threshold
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
Application number
CN202010626097.2A
Other languages
Chinese (zh)
Other versions
CN111787327B (en
Inventor
不公告发明人
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Zhigan Electronic Technology Co ltd
Original Assignee
Suzhou Zhigan Electronic Technology 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 Suzhou Zhigan Electronic Technology Co ltd filed Critical Suzhou Zhigan Electronic Technology Co ltd
Priority to CN202010626097.2A priority Critical patent/CN111787327B/en
Publication of CN111787327A publication Critical patent/CN111787327A/en
Application granted granted Critical
Publication of CN111787327B publication Critical patent/CN111787327B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/134Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or criterion affecting or controlling the adaptive coding
    • H04N19/146Data rate or code amount at the encoder output
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/102Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the element, parameter or selection affected or controlled by the adaptive coding
    • H04N19/124Quantisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/60Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding
    • H04N19/625Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using transform coding using discrete cosine transform [DCT]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/20Servers specifically adapted for the distribution of content, e.g. VOD servers; Operations thereof
    • H04N21/25Management operations performed by the server for facilitating the content distribution or administrating data related to end-users or client devices, e.g. end-user or client device authentication, learning user preferences for recommending movies
    • H04N21/266Channel or content management, e.g. generation and management of keys and entitlement messages in a conditional access system, merging a VOD unicast channel into a multicast channel
    • H04N21/2662Controlling the complexity of the video stream, e.g. by scaling the resolution or bitrate of the video stream based on the client capabilities

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • Discrete Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Compression Or Coding Systems Of Tv Signals (AREA)

Abstract

The invention provides a code stream smooth control method and a system, wherein the method comprises the following steps: continuously acquiring target key frames of a video file to determine frame values of the target key frames; acquiring a maximum threshold and a minimum threshold of a video file key frame corresponding to a target code stream smooth grade; counting the number of times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, and adjusting the quantization parameter value of the target key frame based on the number of times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, so as to adjust the frame value of the target key frame. The invention solves the problems of image blockage and the like caused by the fact that key frames cannot be transmitted in time in the prior art.

Description

Code stream smoothing control method and system
Technical Field
The invention relates to the technical field of code stream smoothing control, in particular to a code stream smoothing control method and system.
Background
I-frames (I-frames), also known as intra pictures, are typically the first frames of each GOP (a video compression technique used by MPEG), moderately compressed, and serve as randomly accessed reference points for pictures. In the course of MPEG coding, a part of video frame sequence is compressed into I frame; partially compressing into a P frame; and also partially compressed into B frames. The I-frame method is an intra-frame compression method, also known as a "key-frame" compression method. The I-frame method is a compression technique based on discrete cosine transform (dct) (discretecosine transform).
A frame is a basic unit constituting a video image. The key frame is also called I frame, which is an important frame in interframe compression coding and is also a coding frame of full frame compression. When decoding, the complete image can be reconstructed only by using the data of the I frame, and the I frame is generated without referring to other pictures.
When a source end, i.e., a sending end (e.g., a webcam or a multimedia server, etc.), sends encoded data to a decoding end through a network, for different network environments, the size of a key frame of a video file may affect the transmission efficiency of the file. When the key frame, i.e. the I frame, is large, the key frame needs to be cut into packets for transmission, so that the transmission efficiency is low due to long transmission time. In addition, due to factors such as a network topology and a transmission speed, the transmission speed of the I frame is slower than that of the P frame, and the decoding end can decode the P frame after receiving the I frame, so that the decoding end needs to buffer the image data of the P frame. When the network signal is poor, the image data transmission speed is too slow or frame loss occurs, and the key frame cannot be transmitted to the receiving end in time, so that the image of the receiving end is blocked and the like.
In view of the above, there is a need to improve the bit stream smoothing technology in the prior art to solve the above technical problems.
Disclosure of Invention
The invention aims to provide a code stream smooth control method and a code stream smooth control system, which are used for solving the problems of image blockage and the like caused by the fact that key frames cannot be transmitted in time in the prior art.
To achieve the above object, the present invention is realized by:
in a first aspect, a method for controlling code stream smoothness is provided, where the method includes:
continuously acquiring target key frames of a video file to determine frame values of the target key frames;
acquiring a maximum threshold and a minimum threshold of a video file key frame corresponding to a target code stream smooth grade;
counting the number of times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold, so as to adjust the quantization parameter value of the target key frame based on the number of times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, so as to adjust the frame value of the target key frame.
As a further improvement of the invention, obtaining the maximum threshold and the minimum threshold of the video file key frame corresponding to the smooth grade of the target code stream comprises the following steps:
acquiring a first maximum value and a first minimum value of a video file key frame corresponding to the minimum code stream smooth level;
acquiring a second maximum value and a second minimum value of the video file key frame corresponding to the smooth grade of the strongest code stream;
and determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth level based on the strongest code stream smooth level, the first maximum value, the first minimum value, the second maximum value and the second minimum value.
As a further improvement of the present invention, determining a maximum threshold and a minimum threshold of a key frame of a video file corresponding to a target code stream smooth level based on a strongest code stream smooth level, a first maximum value, a first minimum value, a second maximum value, and a second minimum value includes:
determining a first gradient coefficient corresponding to a maximum threshold value and a second gradient coefficient corresponding to a minimum threshold value of a video file key frame based on the smooth grade of the strongest code stream, the first maximum value, the first minimum value, the second maximum value and the second minimum value;
and determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth level based on the first gradient coefficient, the second maximum value and the second minimum value.
As a further improvement of the present invention, counting the number of times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold includes:
determining a relationship between a frame value of the target key frame and a maximum threshold value;
when the frame value of the target key frame is larger than the maximum threshold value, counting the times that the frame value of the target key frame is larger than the maximum threshold value; or
When the frame value of the target key frame is smaller than the maximum threshold, determining the relationship between the frame value of the target key frame and the minimum threshold, so as to count the times that the frame value of the target key frame is smaller than the minimum threshold when the frame value of the target key frame is smaller than the minimum threshold.
As a further improvement of the present invention, counting the number of times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold includes:
determining a relationship between a frame value of the target key frame and a minimum threshold;
when the frame value of the target key frame is smaller than a minimum threshold value, counting the times that the frame value of the target key frame is smaller than the minimum threshold value; or
When the frame value of the target key frame is larger than the minimum threshold, determining the relationship between the frame value of the target key frame and the maximum threshold, so as to count the times that the frame value of the target key frame is larger than the maximum threshold when the frame value of the target key frame is larger than the maximum threshold.
As a further improvement of the present invention, adjusting the quantization parameter value of the target key frame based on the number of times the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold comprises:
if the number of times that the frame value of the target key frame is larger than the maximum threshold exceeds a preset threshold, increasing the quantization parameter value of the target key frame;
and if the frequency that the frame value of the target key frame is smaller than the minimum threshold exceeds the preset threshold, reducing the quantization parameter value of the target key frame.
As a further improvement of the invention, the preset threshold value is any one numerical value of 1-3;
optionally, the preset threshold is 2.
In a second aspect, the present invention provides a code stream smoothing system, including:
the hardware encoder is used for continuously acquiring target key frames of the video file to determine frame values of the target key frames and acquiring a maximum threshold and a minimum threshold of the video file key frames corresponding to the smooth grade of a target code stream;
the processor counts the times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold; and the number of the first and second groups,
a controller to adjust a quantization parameter value of the target key frame based on a number of times that a frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold, to adjust the frame value of the target key frame.
In a third aspect, the present invention provides a terminal device, including: a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to the first aspect.
In a fourth aspect, the invention provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the method according to the first aspect.
The invention has the beneficial effects that:
the code stream smoothing control method of the invention compares the frame value of the target key frame of the video file obtained continuously with the maximum threshold and the minimum threshold of the key frame corresponding to the smoothing grade of the target code stream, and adjusts the quantization parameter value of the target key frame according to the times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, so as to adjust the frame value of the target key frame by adjusting the quantization parameter value of the target key frame, thereby controlling the frame value of the target key frame of the video file transmitted to the receiving end to be within a reasonable range. Therefore, the video file can be rapidly transmitted to the receiving end on the premise of ensuring the picture quality.
Drawings
FIG. 1 is a schematic flow chart of a code stream smoothing control method according to an embodiment of the present invention;
FIG. 2 is a schematic flow chart of a code stream smoothing control method according to another embodiment of the present invention;
FIG. 3 is a schematic flow chart of a code stream smoothing control method according to still another embodiment of the present invention;
FIG. 4 is a graph illustrating exemplary relationship between key frames and the smoothness level of a code stream according to an embodiment of the present invention;
FIG. 5 is a schematic flow chart of a code stream smoothing control method according to an embodiment of the present invention;
fig. 6 is a schematic flow chart of a code stream smoothing control system according to an embodiment of the present invention.
Detailed Description
The present invention is described in detail with reference to the embodiments shown in the drawings, but it should be understood that these embodiments are not intended to limit the present invention, and those skilled in the art should understand that functional, methodological, or structural equivalents or substitutions made by these embodiments are within the scope of the present invention.
The technical solutions provided by the embodiments of the present invention are described in detail below with reference to the accompanying drawings.
The first embodiment is as follows:
the existing code rate control algorithm mainly outputs the target code rate by adjusting the size of a quantization parameter of discrete cosine transform. The fixed bitrate (CBR) represents a static (Constant) bitrate, and is a compression method with a fixed sampling rate. For video coding, CBR coding means that the output code data amount per second of the encoder (or the input code rate of the decoder) should be fixed (constant). The encoder detects the complexity of each frame of image and then calculates the code rate. If the code rate is too small, filling useless data to keep the same with the specified code rate; if the code rate is too large, the code rate is appropriately lowered to be consistent with the specified code rate.
The quantization is to reduce the image coding length without reducing the visual effect, and reduce unnecessary information in the visual recovery. The quantization parameter QP is a number of a quantization step Qstep, which reflects a spatial detail compression situation, so that the smaller the quantization parameter QP, the smaller the quantization step, the smaller the quantization loss, the smaller the quantization error, and most of the detail of the image is retained. On the contrary, the larger the quantization parameter QP is, the larger the quantization step size is, and the larger the quantization loss is, the larger the quantization error is, some details of the image are lost, the code rate is reduced, the image distortion is enhanced, and the image quality is reduced. It can be seen that the quantization parameter QP and the fixed code rate CBR are in an inverse relationship, and the inverse relationship becomes more obvious as the complexity of the video source increases.
For different network environments, the frame value range of the key frame is different under the condition of ensuring the image transmission quality and the transmission speed. Due to the lossy quantization-dequantization data, the quantization noise and the artifacts caused by the quantization noise are difficult to avoid in modern video compression techniques. Therefore, the value of the quantization parameter QP can influence whether the video file can be transmitted to a receiving end in time under the condition of ensuring the quality of the key frame of the video file.
To solve the above technical problem, as shown in fig. 1, the present invention provides a code stream smoothing control method, including:
and 102, continuously acquiring the target key frames of the video file to determine the frame values of the target key frames. The target key frames of the video file can be continuously acquired by the upper-layer end control hardware encoder.
And 104, acquiring the maximum threshold and the minimum threshold of the video file key frame corresponding to the smooth grade of the target code stream.
As shown in fig. 2, step 104 specifically includes:
and 202, acquiring a first maximum value and a first minimum value of the video file key frame corresponding to the minimum code stream smooth level. Acquiring different images, and acquiring a first maximum value and a first minimum value of each image key frame corresponding to the weakest code stream smooth level under the condition of ensuring that the quality of each image is basically normal to serve as a first maximum value (marked as MaxT) of a video file key frame corresponding to the weakest code stream smooth level0) And a first minimum value (noted MinT)0). The unopened code stream smooth level can be used as the weakest code stream smooth level, and the basically normal image quality generally means that the image can be normally decoded and has no obvious phenomena of flicker, screen splash, respiratory effect and the like.
And step 204, acquiring a second maximum value and a second minimum value of the video file key frame corresponding to the smooth grade of the strongest code stream.
Wherein, the second maximum value (marked as MaxT) of the video file key frame corresponding to the strongest code stream smooth grade is preset according to experience100) And a second minimum value (noted MinT)100). Of course, the second maximum value and the second minimum value of each image key frame corresponding to the strongest code stream smooth level can be obtained by acquiring different images and under the condition of ensuring that the quality of each image is basically normal, and the second maximum value and the second minimum value of each image key frame corresponding to the strongest code stream smooth level are used as the second maximum value and the second minimum value of the video file key frame corresponding to the strongest code stream smooth level.
And step 206, determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth grade based on the strongest code stream smooth grade, the first maximum value, the first minimum value, the second maximum value and the second minimum value.
As shown in fig. 3, step 206 specifically includes:
and 302, determining a first gradient coefficient corresponding to the maximum threshold value and a second gradient coefficient corresponding to the minimum threshold value of the key frame of the video file based on the smooth level of the strongest code stream, the first maximum value, the first minimum value, the second maximum value and the second minimum value.
And step 304, determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth level based on the first gradient coefficient, the second maximum value and the second minimum value.
The smooth level of the code stream can be set or adjusted through a sliding bar of the interface. For example, the code stream smoothing level can be set to 0-100, and the code stream smoothing level 0 represents closing the code stream smoothing function or represents the weakest code stream smoothing level. The smooth grade of the strongest code stream is recorded as T100And the first gradient coefficient corresponding to the maximum threshold value of the video file key frame is marked as G1And the second gradient coefficient corresponding to the maximum threshold value of the key frame of the video file is recorded as G2Then, the first gradient coefficient G is calculated according to the formula (1)1And a second gradient coefficient G2
Figure BDA0002564798390000071
The maximum threshold value of the video file key frame corresponding to the target code stream smooth level is assumed to be recorded as MaxTxThe minimum threshold value of the video file key frame corresponding to the target code stream smooth level is marked as MinTxAnd the smooth grade of the target code stream is recorded as Tx0(the value of the target code stream smooth grade can be obtained according to the code stream smooth grade interface), then the maximum threshold value of the video file key frame corresponding to the target code stream smooth grade and the minimum threshold value of the video file key frame are obtained according to the formula (2).
Figure BDA0002564798390000072
And 106, counting the times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, and adjusting the quantization parameter value of the target key frame based on the times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold so as to adjust the frame value of the target key frame. It should be noted that the quantization parameter value according to the embodiment of the present invention is the quantization parameter QP.
Specifically, the relationship between the frame value of the target key frame and the maximum threshold is determined, and then when the frame value of the target key frame is greater than the maximum threshold, the number of times that the frame value of the target key frame is greater than the maximum threshold is counted; or when the frame value of the target key frame is smaller than the maximum threshold, determining the relationship between the frame value of the target key frame and the minimum threshold, and counting the times that the frame value of the target key frame is smaller than the minimum threshold when the frame value of the target key frame is smaller than the minimum threshold.
Of course, the relationship between the frame value of the target key frame and the minimum threshold may also be determined first, and then when the frame value of the target key frame is smaller than the minimum threshold, the number of times that the frame value of the target key frame is smaller than the minimum threshold may be counted; or when the frame value of the target key frame is greater than the minimum threshold, determining the relationship between the frame value of the target key frame and the maximum threshold, so as to count the times that the frame value of the target key frame is greater than the maximum threshold when the frame value of the target key frame is greater than the maximum threshold.
If the number of times that the frame value of the target key frame is greater than the maximum threshold exceeds the preset threshold, the quantization parameter value of the target key frame is increased, so that the frame value of the target key frame is reduced by increasing the quantization parameter value. And if the number of times that the frame value of the target key frame is smaller than the minimum threshold exceeds the preset threshold, reducing the quantization parameter value of the target key frame so as to increase the frame value of the target key frame by reducing the quantization parameter value.
Therefore, the code stream smoothing control method of the embodiment of the invention compares the frame value of the target key frame of the video file obtained continuously with the maximum threshold and the minimum threshold of the key frame corresponding to the smoothing grade of the target code stream, adjusts the quantization parameter value of the target key frame according to the times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, adjusts the frame value of the target key frame by adjusting the quantization parameter value of the target key frame, and controls the frame value of the target key frame of the video file transmitted to the receiving end to be within a reasonable range. Therefore, in different network environments, the frame value of the target key frame is controlled within a reasonable range by adjusting the quantization parameter value of the transmitted target key frame, so that the time delay of network transmission is effectively reduced, the decoding effect and efficiency of the decoding end on the target key frame are improved, and the video file is rapidly transmitted to the receiving end on the premise of ensuring that the quality of the transmitted image has no problem basically. Therefore, the problem that the image of the receiving end is blocked and the like due to the fact that the key frame cannot be timely transmitted to the receiving end due to the fact that the image data transmission speed is too slow or frame loss occurs in the prior art is solved.
It should be noted that the frame value of the key frame is within a reasonable range, which means that the image quality can meet the basic normal requirement or the decoding end is not affected to perform normal decoding on the image quality. In addition, the quantization parameter values of the key frame include a maximum quantization parameter value and a minimum quantization parameter value. In the embodiment of the invention, the frame value of the target key frame is controlled within a reasonable range by adjusting the minimum quantization parameter value of the key frame.
It can be understood that, in an actual application scenario, under a specific network environment and under a condition that a decoding end can normally receive and play, the maximum threshold of the corresponding key frame when the image quality is best can be measured firstAnd the minimum threshold value of the corresponding key frame when the image quality is normal is used as the maximum threshold value and the minimum threshold value of the key frame of the video file corresponding to the smooth grade of the target code stream, and then the first gradient coefficient G is corrected1And a second gradient coefficient G2And acquiring a characteristic relation curve between the key frame and the smooth level of the code stream in the specific network environment, as shown in fig. 4. The range of the frame value change of the key frame can be increased by properly expanding the smoothing level so as to adapt to more network application scenes.
The curve A1B1 represents a relationship curve between the maximum threshold of the key frame and the code stream smoothing level, the curve A2B2 represents a relationship curve between the minimum threshold of the key frame and the code stream smoothing level, and the straight line AB represents a frame value adjustment region of the key frame corresponding to the target code stream smoothing level. That is, if the number of times that the frame value of the target key frame exceeds the maximum threshold is greater than the preset threshold, the frame value of the target key frame is decreased by increasing the minimum quantization parameter value to reduce the image quality of the target key frame, so that the adjusted frame value of the target key frame falls within the range of the straight line AB. If the number of times that the frame value of the target key frame is lower than the minimum threshold is larger than the preset threshold, the frame value of the target key frame is increased by reducing the minimum quantization parameter value so as to improve the image quality of the target key frame, and the adjusted frame value of the target key frame is in the range represented by the straight line AB. Therefore, the frame value of the target key frame is controlled to be within the range represented by the straight line AB, so that the transmission speed of the key frame is improved on the premise of ensuring the image quality.
It should be understood that the preset threshold value described in any of the above embodiments may be set according to parameters such as the operating frequency of the hardware encoder, the image quality, and the like. That is, if the preset threshold is smaller, the hardware encoder may frequently adjust the set code rate, and the code stream may be unstable. If the preset threshold is large, the hardware encoder cannot be adjusted in time, and the key frame is too large, so that the problems of frame loss or decoding delay, image pause, poor image quality and the like are easily caused. Multiple researches show that the preset threshold value can be set to any value of 1-3. Preferably, the preset threshold is set to 2. Therefore, the number of times that the frame value of the target key frame is greater than the maximum threshold value and the number of times that the frame value of the target key frame is less than the minimum threshold value are compared with 2, so that the frame value of the key frame is adjusted by adjusting the quantization parameter value of the target key frame, the frame value of the adjusted key frame is in a reasonable range, the impact of the key frame on a network is reduced under the condition that the image quality is ensured to be normal, and the efficiency of the network for transmitting the key frame to a receiving end is improved.
As shown in fig. 5, in a specific embodiment of the present invention, an implementation process of the code stream smoothing control method according to the embodiment of the present invention may be:
and 501, controlling a hardware encoder to continuously acquire the key frames so as to determine the frame size of the key frames.
And 502, judging the relationship between the frame value of the key frame (i.e. the I frame) and the maximum threshold value and the minimum threshold value. The maximum threshold and the minimum threshold of the embodiment of the present invention are the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smoothing level, and may be obtained or determined according to the method of the code stream smoothing control method of the embodiment, which relates to the maximum threshold and the minimum threshold, and are not described in detail herein.
Step 503, judging whether the frame value of the I frame is larger than the maximum threshold value, if so, entering step 504; if not, go to step 505.
Step 504, determine whether the number of times that the frame value of the I frame is greater than the maximum threshold is greater than 2, if so, go to step 5041. If not, step 502 is re-entered.
And step 5041, when the frame value of the I frame is determined to be greater than the maximum threshold value, increasing the minimum quantization parameter value to reduce the frame value of the I frame, and clearing the counted times to 0. Thus, the network transmission rate is improved by reducing the image quality of the I frame.
And 505, judging whether the frame value of the I frame is smaller than a minimum threshold value, if so, entering a step 506, and if not, entering a step 507.
Step 506, determine whether the number of times that the frame value of the I frame is less than the minimum threshold is greater than 2, if so, go to step 5061. If not, step 502 is re-entered.
And 5061, when the frame value of the I frame is determined to be smaller than the minimum threshold value, reducing the minimum quantization parameter value to increase the frame value of the I frame, and clearing the counted times to 0. Therefore, the image quality of the I frame is improved on the premise of ensuring the network transmission rate.
Therefore, the number of times that the frame value of the I frame (namely the target key frame) is greater than the maximum threshold value and the number of times that the frame value of the target key frame is less than the minimum threshold value are compared with 2, so that the frame value of the key frame is adjusted by adjusting the quantization parameter value of the target key frame, and the adjusted frame value of the key frame is in a reasonable range, so that the impact of the key frame on the network is reduced under the condition of ensuring the normal image quality, namely the efficiency of the network for transmitting the key frame to the receiving end is improved.
The first to fourth tables are test results of actually setting up a test environment, the test environment is that the camera is connected to the test platform through a wide area Network, and the Time of the test platform and the Time of the camera are synchronized through a Network Time Protocol (NTP for short) or other methods. By opening ports of the camera and the test platform for printing, after the camera sends a section of video, the time for the test platform to receive is synchronously grabbed and printed, and the time interval from the beginning of sending to the receiving end to the beginning of receiving the complete image data and decoding by the receiving end is obtained.
As shown in the network test data in table one and table two, when the code stream smoothing function is turned off, 3.524 seconds are required for the network delay from the sending end (e.g., a video camera) to the decoding end to receive the image data. As shown in table three and table four, after the code stream smoothing function is started and the minimum quantization parameter value is adjusted based on the current code stream smoothing level, the video file is transmitted from the transmitting end, and the network delay experienced by the video file is only 2.683 seconds when the decoding end receives the image data. Obviously, after the code stream smoothing function is started and the minimum quantization parameter value is adjusted, the time interval from the beginning of sending to the receiving end to the beginning of receiving the image data and decoding by the receiving end is effectively reduced. Therefore, by adjusting the smooth level of the code stream and adjusting the minimum quantization parameter value based on the adjusted smooth level of the code stream, the frame value of the I frame can be reduced or increased on the premise of ensuring the image quality, so that the transmission rate of the network to the I frame is increased on the premise of ensuring the normal image quality or the quality of the I frame is increased on the premise of ensuring the low quality of the I frame.
Table one, test data table of sending end when closing code stream smoothing function
Figure BDA0002564798390000121
Second table, test data table of receiving end when closing code stream smoothing function
Figure BDA0002564798390000131
Third, test data table of sending end when starting code stream smoothing function
Figure BDA0002564798390000141
Fourth, test data table of receiving end when starting code stream smoothing function
Figure BDA0002564798390000151
Example two:
as shown in fig. 6, the present invention further provides a code stream smoothing control system, including: the hardware encoder 602 is configured to continuously obtain target key frames of the video file to determine frame values of the target key frames, and obtain a maximum threshold and a minimum threshold of the video file key frames corresponding to a smooth level of a target code stream; a processor 604 for counting the number of times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold; and a controller 606 adjusting the quantization parameter value of the target key frame based on the number of times the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold, to adjust the frame value of the target key frame.
The hardware encoder 602 may be configured with a processing unit 602 ', so as to obtain, through the processing unit 602', a first maximum value and a first minimum value of the video file key frame corresponding to the weakest code stream smoothing level, and obtain a second maximum value and a second minimum value of the video file key frame corresponding to the strongest code stream smoothing level, so as to determine, according to the strongest code stream smoothing level, the first maximum value, the first minimum value, the second maximum value, and the second minimum value, a maximum threshold value and a minimum threshold value of the video file key frame corresponding to the target code stream smoothing level. Specifically, the processing unit 602' determines, based on the strongest code stream smoothing level, the first maximum value, the first minimum value, the second maximum value, and the second minimum value, a first gradient coefficient corresponding to the maximum threshold value and a second gradient coefficient corresponding to the minimum threshold value of the key frame of the video file, so as to determine, according to the first gradient coefficient, the second maximum value, and the second minimum value, the maximum threshold value and the minimum threshold value of the key frame of the video file corresponding to the target code stream smoothing level.
The controller 606 is further configured to determine a relationship between the frame value of the target key frame and the maximum threshold, and then count the number of times that the frame value of the target key frame is greater than the maximum threshold when the frame value of the target key frame is greater than the maximum threshold; or when the frame value of the target key frame is smaller than the maximum threshold, determining the relationship between the frame value of the target key frame and the minimum threshold, and counting the times that the frame value of the target key frame is smaller than the minimum threshold when the frame value of the target key frame is smaller than the minimum threshold.
It should be understood that, in the code stream smoothing control system according to the embodiment of the present invention, the frame value of the target key frame of the video file continuously obtained by the hardware encoder 602 is compared with the maximum threshold and the minimum threshold of the key frame corresponding to the smoothing level of the target code stream, and the quantization parameter value of the target key frame is adjusted by the number of times that the frame value of the target key frame counted by the processor 604 is greater than the maximum threshold or smaller than the minimum threshold, so that the frame value of the target key frame is adjusted by adjusting the quantization parameter value of the target key frame by the controller 606, thereby controlling the frame value of the target key frame of the video file transmitted to the receiving end within a reasonable range. Therefore, in different network environments, the frame value of the target key frame is controlled within a reasonable range by adjusting the quantization parameter value of the transmitted target key frame, so that the time delay of network transmission is effectively reduced, the decoding effect and efficiency of the decoding end on the target key frame are improved, and the video file is rapidly transmitted to the receiving end on the premise of ensuring that the quality of the transmitted image has no problem basically. Therefore, the problem that the image of the receiving end is blocked and the like due to the fact that the key frame cannot be timely transmitted to the receiving end due to the fact that the image data transmission speed is too slow or frame loss occurs in the prior art is solved.
Example three:
preferably, an embodiment of the present invention further provides a terminal device, which may include a processor, a memory, and a computer program stored in the memory and capable of running on the processor, where the computer program, when executed by the processor, implements the processes of the method embodiments shown in fig. 1 to 5, and can achieve the same technical effects, and details are not described here to avoid repetition. The processor can be an ASIC, an FPGA, a CPU, an MCU or other physical hardware or virtual equipment with an instruction processing function; the memory is selected from RAM, DRAM, FeRAM, NVDIMM, SSD, RAID 0-7 or data center.
An embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program implements each process of the method shown in fig. 1 to 5, and can achieve the same technical effect, and in order to avoid repetition, details are not repeated here. The computer-readable storage medium may be a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk.
The above-listed detailed description is only a specific description of a possible embodiment of the present invention, and they are not intended to limit the scope of the present invention, and equivalent embodiments or modifications made without departing from the technical spirit of the present invention should be included in the scope of the present invention.
It will be evident to those skilled in the art that the invention is not limited to the details of the foregoing illustrative embodiments, and that the present invention may be embodied in other specific forms without departing from the spirit or essential attributes thereof. The present embodiments are therefore to be considered in all respects as illustrative and not restrictive, the scope of the invention being indicated by the appended claims rather than by the foregoing description, and all changes which come within the meaning and range of equivalency of the claims are therefore intended to be embraced therein. Any reference sign in a claim should not be construed as limiting the claim concerned.
Furthermore, it should be understood that although the present description refers to embodiments, not every embodiment may contain only a single embodiment, and such description is for clarity only, and those skilled in the art should integrate the description, and the embodiments may be combined as appropriate to form other embodiments understood by those skilled in the art.

Claims (10)

1. A code stream smoothing control method is characterized by comprising the following steps:
continuously acquiring target key frames of a video file to determine frame values of the target key frames;
acquiring a maximum threshold and a minimum threshold of a video file key frame corresponding to a target code stream smooth grade;
counting the number of times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold, so as to adjust the quantization parameter value of the target key frame based on the number of times that the frame value of the target key frame is greater than the maximum threshold or less than the minimum threshold, so as to adjust the frame value of the target key frame.
2. The method of claim 1, wherein obtaining the maximum threshold and the minimum threshold of the key frame of the video file corresponding to the smooth level of the target code stream comprises:
acquiring a first maximum value and a first minimum value of a video file key frame corresponding to the minimum code stream smooth level;
acquiring a second maximum value and a second minimum value of the video file key frame corresponding to the smooth grade of the strongest code stream;
and determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth level based on the strongest code stream smooth level, the first maximum value, the first minimum value, the second maximum value and the second minimum value.
3. The method of claim 2, wherein determining a maximum threshold and a minimum threshold of a key frame of the video file corresponding to the target smooth level of the code stream based on the strongest smooth level of the code stream, the first maximum, the first minimum, the second maximum, and the second minimum comprises:
determining a first gradient coefficient corresponding to a maximum threshold value and a second gradient coefficient corresponding to a minimum threshold value of a video file key frame based on the smooth grade of the strongest code stream, the first maximum value, the first minimum value, the second maximum value and the second minimum value;
and determining the maximum threshold and the minimum threshold of the video file key frame corresponding to the target code stream smooth level based on the first gradient coefficient, the second maximum value and the second minimum value.
4. The method according to any of claims 1-3, wherein counting the number of times the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold comprises:
determining a relationship between a frame value of the target key frame and a maximum threshold value;
when the frame value of the target key frame is larger than the maximum threshold value, counting the times that the frame value of the target key frame is larger than the maximum threshold value; or
When the frame value of the target key frame is smaller than the maximum threshold, determining the relationship between the frame value of the target key frame and the minimum threshold, so as to count the times that the frame value of the target key frame is smaller than the minimum threshold when the frame value of the target key frame is smaller than the minimum threshold.
5. The method according to any of claims 1-3, wherein counting the number of times the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold comprises:
determining a relationship between a frame value of the target key frame and a minimum threshold;
when the frame value of the target key frame is smaller than a minimum threshold value, counting the times that the frame value of the target key frame is smaller than the minimum threshold value; or
When the frame value of the target key frame is larger than the minimum threshold, determining the relationship between the frame value of the target key frame and the maximum threshold, so as to count the times that the frame value of the target key frame is larger than the maximum threshold when the frame value of the target key frame is larger than the maximum threshold.
6. The method of claim 1, wherein adjusting the quantization parameter value of the target key frame based on the number of times the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold comprises:
if the number of times that the frame value of the target key frame is larger than the maximum threshold exceeds a preset threshold, increasing the quantization parameter value of the target key frame;
and if the frequency that the frame value of the target key frame is smaller than the minimum threshold exceeds the preset threshold, reducing the quantization parameter value of the target key frame.
7. The method of claim 6,
the preset threshold value is any one value of 1-3;
optionally, the preset threshold is 2.
8. A code stream smoothing system, comprising:
the hardware encoder is used for continuously acquiring target key frames of the video file to determine frame values of the target key frames and acquiring a maximum threshold and a minimum threshold of the video file key frames corresponding to the smooth grade of a target code stream;
the processor counts the times that the frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold; and the number of the first and second groups,
a controller to adjust a quantization parameter value of the target key frame based on a number of times that a frame value of the target key frame is greater than a maximum threshold or less than a minimum threshold, to adjust the frame value of the target key frame.
9. A terminal device, comprising: a processor, a memory and a computer program stored on the memory and executable on the processor, the computer program, when executed by the processor, implementing the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 7.
CN202010626097.2A 2020-07-01 2020-07-01 Code stream smoothing control method and system Active CN111787327B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010626097.2A CN111787327B (en) 2020-07-01 2020-07-01 Code stream smoothing control method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010626097.2A CN111787327B (en) 2020-07-01 2020-07-01 Code stream smoothing control method and system

Publications (2)

Publication Number Publication Date
CN111787327A true CN111787327A (en) 2020-10-16
CN111787327B CN111787327B (en) 2022-08-02

Family

ID=72757762

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010626097.2A Active CN111787327B (en) 2020-07-01 2020-07-01 Code stream smoothing control method and system

Country Status (1)

Country Link
CN (1) CN111787327B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179394A (en) * 2013-01-21 2013-06-26 北京航空航天大学 I frame rate control method based on stable area video quality
CN106572352A (en) * 2016-10-21 2017-04-19 浙江大华技术股份有限公司 Keyframe size control method and device
US20170289551A1 (en) * 2016-03-30 2017-10-05 Sony Interactive Entertainment Inc. Advanced picture quality oriented rate control for low-latency streaming applications

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103179394A (en) * 2013-01-21 2013-06-26 北京航空航天大学 I frame rate control method based on stable area video quality
US20170289551A1 (en) * 2016-03-30 2017-10-05 Sony Interactive Entertainment Inc. Advanced picture quality oriented rate control for low-latency streaming applications
CN106572352A (en) * 2016-10-21 2017-04-19 浙江大华技术股份有限公司 Keyframe size control method and device

Also Published As

Publication number Publication date
CN111787327B (en) 2022-08-02

Similar Documents

Publication Publication Date Title
EP2274914B1 (en) Video refresh adaptation algorithms responsive to error feedback
US9426475B2 (en) Scene change detection using sum of variance and estimated picture encoding cost
US9071841B2 (en) Video transcoding with dynamically modifiable spatial resolution
KR101414435B1 (en) Method and apparatus for assessing quality of video stream
KR101518358B1 (en) A buffer-based rate control exploiting frame complexity buffer level and position of intra frames in video coding
US9565440B2 (en) Quantization parameter adjustment based on sum of variance and estimated picture encoding cost
TWI478584B (en) Apparatus and method thereof for encoding/decoding video
JP5351040B2 (en) Improved video rate control for video coding standards
JP3436507B2 (en) Bit rate control method
WO2010009637A1 (en) Method, system and equipment for evaluating video quality
CN107770538B (en) Method, device and system for detecting scene switching frame
JP4221655B2 (en) Encoding apparatus, encoding method, program, and recording medium
US6580755B1 (en) Apparatus and method for encoding
US20230045884A1 (en) Rio-based video coding method and deivice
JP4861371B2 (en) Video quality estimation apparatus, method, and program
KR101478834B1 (en) A Method and Apparatus for Transcoding a Video Signal
CN111787327B (en) Code stream smoothing control method and system
JP2000358247A (en) Rate controller, rate control method and coder
JP4718736B2 (en) Video encoding device
WO2000064187A1 (en) Image encoding device and its method
JP3425130B2 (en) Encoding device and encoding method
CN115633176B (en) Method, device and storage medium for dynamically adjusting length of picture group
JP4228739B2 (en) Encoding apparatus, encoding method, program, and recording medium
Pan et al. Proactive frame-skipping decision scheme for variable frame rate video coding
JP4186544B2 (en) Encoding apparatus, encoding method, program, and recording medium

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