Movatterモバイル変換


[0]ホーム

URL:


CN102724502B - The control method of code check and device in a kind of Video coding - Google Patents

The control method of code check and device in a kind of Video coding
Download PDF

Info

Publication number
CN102724502B
CN102724502BCN201210190602.9ACN201210190602ACN102724502BCN 102724502 BCN102724502 BCN 102724502BCN 201210190602 ACN201210190602 ACN 201210190602ACN 102724502 BCN102724502 BCN 102724502B
Authority
CN
China
Prior art keywords
frame
sliding window
current frame
preset
upper limit
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
CN201210190602.9A
Other languages
Chinese (zh)
Other versions
CN102724502A (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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co LtdfiledCriticalHuawei Technologies Co Ltd
Priority to CN201210190602.9ApriorityCriticalpatent/CN102724502B/en
Publication of CN102724502ApublicationCriticalpatent/CN102724502A/en
Application grantedgrantedCritical
Publication of CN102724502BpublicationCriticalpatent/CN102724502B/en
Activelegal-statusCriticalCurrent
Anticipated expirationlegal-statusCritical

Links

Landscapes

Abstract

Translated fromChinese

本发明实施例提供一种视频编码中码率的控制方法及装置,涉及视频编码技术领域,用以控制视频编码输出的瞬时码率不超过设定的码率上限,防止网络阻塞或丢包;所述方法包括,设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧;若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧;其中,所述第一滑动窗口的大小等于预设的帧率N。本发明实施例用于视频编码。

Embodiments of the present invention provide a bit rate control method and device in video encoding, which relate to the technical field of video encoding and are used to control the instantaneous bit rate of video encoding output not to exceed a set bit rate upper limit to prevent network congestion or packet loss; The method includes setting the position of the first sliding window so that the current frame is located in the Nth frame of the first sliding window; An upper limit, the current frame is not output; wherein, the size of the first sliding window is equal to the preset frame rate N. The embodiment of the present invention is used for video coding.

Description

Translated fromChinese
一种视频编码中码率的控制方法及装置Method and device for controlling code rate in video coding

技术领域technical field

本发明涉及视频编码技术领域,尤其涉及一种视频编码中码率的控制方法及装置。The present invention relates to the technical field of video coding, in particular to a method and device for controlling code rate in video coding.

背景技术Background technique

在视频通信应用中,为了便于视频数据的传输和存储需要对视频图像进行压缩编码。由于视频图像是随时间变化的,经过压缩编码输出的压缩码流比特数也会随时间变化。用单位时间内压缩编码输出的码流比特数之和表示编码输出的码率,则视频编码输出码率会在一定范围内波动。由于网络上的带宽或者存储媒质容量是有限的,这就需要在视频压缩编码过程中进行码率控制,使编码端输出的码率不超过设定的网络带宽或者存储媒质容量的上限,防止出现丢包现象。In video communication applications, in order to facilitate the transmission and storage of video data, video images need to be compressed and encoded. Since the video image changes with time, the number of bits of the compressed code stream output through compression encoding will also change with time. The code output bit rate is represented by the sum of the code stream bit numbers compressed and coded per unit time, and the video code output code rate will fluctuate within a certain range. Since the bandwidth or storage medium capacity on the network is limited, it is necessary to control the bit rate in the process of video compression encoding, so that the bit rate output by the encoding end does not exceed the upper limit of the set network bandwidth or storage medium capacity to prevent the occurrence of Packet loss.

现有码率控制算法大多采用VBV(virtual buffer verification,视频缓存检验器)来控制编码输出比特数。在VBV中,编码器在编码时有一个虚拟的码流缓冲区,记为buffer。编码器在编码每一帧时,首先计算待编码帧的目标比特数,根据目标比特数计算量化参数(QP值),通过QP值调节每帧输出的bit数。当buffer中的码流快要下溢时,编码器为这帧产生较多的bit数;当buffer中的码流快要上溢时,编码器为这帧产生较少的bit数,或者跳帧。这样,buffer中的码流就可以按照设定的码率匀速输出。Most of the existing rate control algorithms use VBV (virtual buffer verification, video buffer verifier) to control the number of encoded output bits. In VBV, the encoder has a virtual code stream buffer during encoding, which is recorded as buffer. When encoding each frame, the encoder first calculates the target number of bits of the frame to be encoded, calculates the quantization parameter (QP value) according to the target number of bits, and adjusts the number of bits output by each frame through the QP value. When the code stream in the buffer is about to underflow, the encoder generates more bits for this frame; when the code stream in the buffer is about to overflow, the encoder generates fewer bits for this frame, or skips frames. In this way, the code stream in the buffer can be output at a constant speed according to the set code rate.

但是,在实时视讯应用中会出现待编码图像复杂度突然增加的情况,编码器输出的瞬时码率有可能超过设定的网络带宽上限,而虚拟码流缓冲区仍然显示不上溢也不下溢。例如:在编码器连续编码输出若干帧复杂度低的静止图像之后,虚拟码流缓冲区中剩余比特数很少,此时,如果待编码图像突然变得很复杂,为了确保图像质量,编码器必须连续输出较大的比特流,虚拟码流缓冲区的满度将迅速增加。此时,虚拟码流缓冲区中存放的码流可能为最近的不足1秒钟的压缩码流,虚拟码流缓冲区中的码流比特数之和显然不能表示此时的编码输出瞬时码率,因此,通过虚拟码流缓冲区的码流比特数之和来判定输出码率是否超过设定上限的方法,无法确保任意时刻编码输出的码率不超过设定的上限,可能导致网络阻塞或丢包,影响解码输出的图像质量和播放流畅性,降低视频实时通信的主观感受。However, in real-time video applications, when the complexity of the image to be encoded suddenly increases, the instantaneous bit rate output by the encoder may exceed the upper limit of the set network bandwidth, but the virtual bit stream buffer still shows neither overflow nor underflow . For example: after the encoder continuously encodes and outputs several frames of low-complexity still images, the number of remaining bits in the virtual stream buffer is very small. At this time, if the image to be encoded suddenly becomes very complex, in order to ensure the image quality, the encoder Larger bit streams must be output continuously, and the fullness of the virtual stream buffer will increase rapidly. At this time, the code stream stored in the virtual code stream buffer may be the latest compressed code stream of less than 1 second, and the sum of the code stream bits in the virtual code stream buffer obviously cannot represent the instantaneous code rate of the encoding output at this time Therefore, the method of judging whether the output code rate exceeds the set upper limit by the sum of the code stream bits in the virtual code stream buffer cannot ensure that the code output code rate at any time does not exceed the set upper limit, which may lead to network congestion or Packet loss affects the image quality and playback fluency of decoding output, and reduces the subjective experience of video real-time communication.

发明内容Contents of the invention

本发明的实施例提供一种视频编码中码率的控制方法及装置。用以控制视频编码输出的瞬时码率不超过设定的码率上限,防止网络阻塞或丢包。Embodiments of the present invention provide a code rate control method and device in video coding. It is used to control the instantaneous bit rate of video encoding output not to exceed the set bit rate upper limit to prevent network congestion or packet loss.

为达到上述目的,本发明的实施例采用如下技术方案:In order to achieve the above object, embodiments of the present invention adopt the following technical solutions:

本发明的实施例提供一种视频编码中码率的控制方法及装置。用以控制视频编码输出的瞬时码率不超过设定的码率上限,防止网络阻塞或丢包。Embodiments of the present invention provide a code rate control method and device in video coding. It is used to control the instantaneous bit rate of video encoding output not to exceed the set bit rate upper limit to prevent network congestion or packet loss.

为达到上述目的,本发明的实施例采用如下技术方案:In order to achieve the above object, embodiments of the present invention adopt the following technical solutions:

一方面,提供一种视频编码中码率的控制方法,包括,On the one hand, a bit rate control method in video coding is provided, including,

设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧;Setting the position of the first sliding window so that the current frame is located at the Nth frame of the first sliding window;

若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧;其中,所述第一滑动窗口的大小等于预设的帧率N。If the sum of the bits of the compressed code stream of all frames in the first sliding window is greater than the preset upper limit of the code rate, the current frame is not output; wherein, the size of the first sliding window is equal to the preset frame rate N.

一方面,提供一种视频编码中码率的控制装置,包括,On the one hand, a device for controlling bit rate in video coding is provided, comprising:

滑动窗口设置模块,用于设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧;The sliding window setting module is used to set the position of the first sliding window so that the current frame is located at the Nth frame of the first sliding window;

输出判断模块,用于判断是否输出当前帧,若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧;An output judging module, used to judge whether to output the current frame, if the sum of the compressed code stream bits of all frames in the first sliding window is greater than the preset code rate upper limit, the current frame is not output;

其中,所述第一滑动窗口的大小等于预设的帧率N。Wherein, the size of the first sliding window is equal to a preset frame rate N.

本发明实施例提供的视频编码中码率的控制方法及装置,采用预设的滑动窗口,并将滑动窗口的大小设置为预设的帧率,这样,编码器输出的瞬时码率就等于每秒内滑动窗口内的所有编码输出帧的压缩码流比特数之和。编码器在输出每帧时,若滑动窗口内所有编码输出帧的压缩码流比特数之和大于预设的码率上限,表明编码器输出的瞬时码率大于预设的码率上限,则不输出当前帧。从而控制视频编码输出的瞬时码率不超过设定的码率上限,防止网络阻塞或丢包。The method and device for controlling the bit rate in video encoding provided by the embodiments of the present invention adopt a preset sliding window, and set the size of the sliding window to the preset frame rate, so that the instantaneous bit rate output by the encoder is equal to each The sum of the compressed code stream bits of all coded output frames within the sliding window within a second. When the encoder outputs each frame, if the sum of the compressed code stream bits of all coded output frames in the sliding window is greater than the preset upper limit of the code rate, it indicates that the instantaneous code rate output by the encoder is greater than the preset upper limit of the code rate, then no Output the current frame. In this way, the instantaneous bit rate of the video encoding output is controlled not to exceed the upper limit of the set bit rate, preventing network congestion or packet loss.

附图说明Description of drawings

为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. Those skilled in the art can also obtain other drawings based on these drawings without creative work.

图1为本发明实施例提供的视频编码中码率的控制方法的流程图;FIG. 1 is a flow chart of a method for controlling a code rate in video coding provided by an embodiment of the present invention;

图2为本发明实施例提供的第一、第二滑动窗口的示意图;FIG. 2 is a schematic diagram of first and second sliding windows provided by an embodiment of the present invention;

图3为本发明另一实施例提供的视频编码中码率的控制方法的流程图;FIG. 3 is a flow chart of a method for controlling bit rates in video coding provided by another embodiment of the present invention;

图4为本发明实施例提供的视频编码中码率的控制装置的结构示意图。FIG. 4 is a schematic structural diagram of an apparatus for controlling a code rate in video encoding according to an embodiment of the present invention.

具体实施方式Detailed ways

下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only some, not all, embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the protection scope of the present invention.

本发明实施例中,在视频编码器中设置滑动窗口,滑动窗口的大小N等于预设的帧率。其中,该预设的帧率可以根据用户对图像的流畅新需求、网络可用带宽等条件确定。例如,预设的帧率为30时,表示每秒编码输出30帧图像,则滑动窗口的大小N=30。由于编码输出的码率是单位时间内压缩编码输出的码流比特数之和。这样,在单位时间,即每秒内,滑动窗口内的所有编码输出帧的压缩码流比特数之和等于此时编码器输出的瞬时码率。编码器在编码、输出每一帧时,通过控制活动窗口内的所有编码输出帧的比特数,可以确保视频编码输出的瞬时码率不超过设定的码率上限。In the embodiment of the present invention, a sliding window is set in the video encoder, and the size N of the sliding window is equal to a preset frame rate. Wherein, the preset frame rate may be determined according to the user's demand for smooth images, available network bandwidth and other conditions. For example, when the preset frame rate is 30, it means that 30 frames of images are encoded and output per second, and the size of the sliding window is N=30. Because the code rate output by encoding is the sum of the bit numbers of code streams output by compression encoding per unit time. In this way, within a unit time, that is, within each second, the sum of the compressed code stream bit numbers of all coded output frames in the sliding window is equal to the instantaneous code rate output by the coder at this time. When encoding and outputting each frame, the encoder can ensure that the instantaneous bit rate of video encoding output does not exceed the set bit rate upper limit by controlling the number of bits of all encoded output frames in the active window.

本发明实施例提供的视频编码中码率的控制方法,如图1所示,包括,The code rate control method in video coding provided by the embodiment of the present invention, as shown in FIG. 1 , includes:

101、设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧。101. Set the position of the first sliding window, so that the current frame is located in the Nth frame of the first sliding window.

其中,当前帧是指编码器进行编码、输出处理的那一帧。如图2所示。第一滑动窗口的大小等于帧率N,当前帧是第一滑动窗口的第N帧。此时,编码器已经编码输出第一滑动窗口内的第1至N-1帧,并完成对第N帧的编码即将输出第N帧。Wherein, the current frame refers to the frame that is encoded and output by the encoder. as shown in picture 2. The size of the first sliding window is equal to the frame rate N, and the current frame is the Nth frame of the first sliding window. At this point, the encoder has already encoded and outputted frames 1 to N-1 in the first sliding window, and is about to output the Nth frame after completing the encoding of the Nth frame.

202、若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧。202. If the sum of the bits of compressed code streams of all frames in the first sliding window is greater than the preset code rate upper limit, the current frame is not output.

计算第一滑动窗口内所有帧的压缩码流比特数之和,当满足条件,Σi=0N-1Li+LN>max bitrateCalculate the sum of the compressed code stream bits of all frames in the first sliding window, when the conditions are met, Σ i = 0 N - 1 L i + L N > max bit rate

编码器不输出当前帧N,即丢弃当前帧。其中,LN为当前编码帧的比特数;Li为第一滑动窗口内已经编码的第i帧的压缩码流比特数;maxbitrate为预设的码率上限,具体可以是预设的网络带宽上限,或者根据存储媒质(如硬盘、光盘等)的容量换算得到的码率上限;N为第一滑动窗口的大小,即预设的帧率。The encoder does not output the current frame N, that is, discards the current frame. Among them, LN is the number of bits of the current encoded frame; Li is the number of compressed code stream bits of the i-th frame that has been encoded in the first sliding window; maxbitrate is the preset code rate upper limit, which can be the preset network bandwidth The upper limit, or the upper limit of the code rate converted according to the capacity of the storage medium (such as hard disk, optical disc, etc.); N is the size of the first sliding window, that is, the preset frame rate.

本发明实施例提供的视频编码中码率的控制方法,将预设的帧率设置为活动窗口的大小,这样,编码器输出的瞬时码率就等于每秒内滑动窗口内的所有编码输出帧的压缩码流比特数之和。编码器在输出每帧时,若滑动窗口内的压缩码流比特数之和大于预设的码率上限,表明编码器输出的瞬时码率大于预设的码率上限,则不输出当前帧。从而控制视频编码输出的瞬时码率不超过设定的码率上限,防止网络阻塞或丢包。The bit rate control method in video encoding provided by the embodiment of the present invention sets the preset frame rate as the size of the active window, so that the instantaneous bit rate output by the encoder is equal to all encoded output frames in the sliding window per second The sum of the number of compressed code stream bits. When the encoder outputs each frame, if the sum of the compressed code stream bits in the sliding window is greater than the preset upper limit of the code rate, it means that the instantaneous code rate output by the encoder is greater than the preset upper limit of the code rate, and the current frame will not be output. In this way, the instantaneous bit rate of the video encoding output is controlled not to exceed the upper limit of the set bit rate, preventing network congestion or packet loss.

本发明实施例提供的另一种视频编码中码率的控制方法,如图3所示,包括,Another code rate control method in video coding provided by an embodiment of the present invention, as shown in FIG. 3 , includes:

301、设置第一滑动窗口的位置,使当前帧位于第一滑动窗口的第N帧。301. Set the position of the first sliding window, so that the current frame is located in the Nth frame of the first sliding window.

其中,当前帧是指编码器进行编码、输出处理的那一帧。如图2所示。第一滑动窗口的大小等于帧率N,当前帧是第一滑动窗口的第N帧。此时,编码器已经编码输出第一滑动窗口内的第1至N-1帧即将开始编码第N帧。Wherein, the current frame refers to the frame that is encoded and output by the encoder. as shown in picture 2. The size of the first sliding window is equal to the frame rate N, and the current frame is the Nth frame of the first sliding window. At this time, the encoder has already encoded and outputted frames 1 to N-1 in the first sliding window and is about to start encoding the Nth frame.

302、判断是否编码当前帧。302. Determine whether to encode the current frame.

计算第一滑动窗口内第1帧至第N-1帧的压缩码流比特数之和与第N帧预设的目标比特数上限之和。Calculate the sum of the bits of the compressed code stream from the 1st frame to the N-1th frame in the first sliding window and the sum of the preset target bit number upper limit of the Nth frame.

若第一滑动窗口内的第1帧至第N-1帧压缩码流比特数之和与第N帧预设的目标比特数之和大于预设的码率上限,不编码当前帧。即If the sum of the bits of the compressed stream from frame 1 to frame N-1 in the first sliding window and the preset target bits of frame N is greater than the preset upper limit of the code rate, the current frame is not encoded. Right now

编码器不编码第N帧。其中,Li为第一滑动窗口内已经编码的第i帧的压缩码流比特数;maxbitrate为设定的码率上限,具体可以是预设的网络带宽上限,或者根据存储媒质(如硬盘、光盘等)的容量换算得到的码率上限;N为第一滑动窗口的大小,(bitrate/N)表示第一滑动窗口中第N帧的目标比特数,该值可以根据设置的编码器的目标比特率bitrate计算得到。The encoder does not encode frame N. Wherein, Li is the number of compressed code stream bits of the i-th frame that has been encoded in the first sliding window; maxbitrate is the upper limit of the code rate set, which can be the preset upper limit of network bandwidth, or according to the storage medium (such as hard disk, The upper limit of the code rate obtained by converting the capacity of CD, etc.); N is the size of the first sliding window, (bitrate/N) represents the target number of bits of the Nth frame in the first sliding window, and this value can be set according to the target of the encoder The bit rate bitrate is calculated.

若第一滑动窗口内的第1帧至第N-1帧压缩码流比特数之和与第N帧预设的目标比特数之和不大于预设的码率上限,编码当前帧,即If the sum of the bit numbers of the compressed code stream from the first frame to the N-1th frame in the first sliding window and the preset target bit number of the Nth frame are not greater than the preset bit rate upper limit, encode the current frame, that is

编码器编码第N帧。The encoder encodes frame N.

本步骤中,若确定不编码当前帧,则跳过当前帧,步骤结束。对下一帧进行处理。若确定编码当前帧,在编码完成后,进入步骤303。In this step, if it is determined not to encode the current frame, the current frame is skipped, and the step ends. Process the next frame. If it is determined to encode the current frame, go to step 303 after the encoding is completed.

303、设置第二滑动窗口的位置,使当前帧位于所述第二滑动窗口的第N-(M-1)帧。303. Set the position of the second sliding window, so that the current frame is located in the N-(M-1)th frame of the second sliding window.

其中,当前帧是指编码器进行编码、输出处理的那一帧。如图2所示。第二滑动窗口的大小等于帧率N,当前帧是第二滑动窗口的第N-(M-1)帧。此时,编码器已经编码输出第二滑动窗口内的第1至N-M帧,编码器即将开始编码第N-(M-1)帧。Wherein, the current frame refers to the frame that is encoded and output by the encoder. as shown in picture 2. The size of the second sliding window is equal to the frame rate N, and the current frame is the N-(M-1)th frame of the second sliding window. At this time, the encoder has encoded and outputted the 1st to N-M frames in the second sliding window, and the encoder is about to start encoding the N-(M-1)th frame.

304、根据第二滑动窗口内第1帧至第N-M帧的压缩码流比特数之和确定当前帧的目标比特数上限。304. Determine the upper limit of the target bit number of the current frame according to the sum of the bit numbers of the compressed code stream from the first frame to the N-Mth frame in the second sliding window.

计算第二编码器将根据滑动窗口内第1帧至第N-M帧的压缩码Calculate the compression code that the second encoder will use from frame 1 to frame NM in the sliding window

其中,TN-(M-1)为即将编码的当前帧目标比特数上限;maxbitrate为预设的码率上限,具体可以是预设的网络带宽上限,或者根据存储媒质(如硬盘、光盘等)的容量换算得到的码率上限;Li为第二滑动窗口内已经编码的第i帧的压缩码流比特数;N为第二滑动窗口的大小;(M-1)*(bitrate/N)表示第二滑动窗口内位于当前帧之后的共计(M-1)帧的预设目标比特数之和;(bitrate/N)表示第二滑动窗口中第N帧的目标比特数,该值可以根据设置的编码器的目标比特率bitrate计算得到。M大于1小于N。优选的,M为3或4。Among them, TN-(M-1) is the upper limit of the target number of bits of the current frame to be encoded; maxbitrate is the upper limit of the preset code rate, which can be the upper limit of the preset network bandwidth, or according to the storage medium (such as hard disk, CD, etc.) ) capacity conversion to obtain the code rate upper limit; Li is the compressed code stream bit number of the i-th frame that has been encoded in the second sliding window; N is the size of the second sliding window; (M-1)*(bitrate/N ) represents the sum of the preset target bits of the total (M-1) frames behind the current frame in the second sliding window; (bitrate/N) represents the target bits of the Nth frame in the second sliding window, and this value can be Calculated according to the target bitrate of the encoder set. M is greater than 1 and less than N. Preferably, M is 3 or 4.

这样,编码器在编码当前帧之前,可以使用第二滑动窗口计算当前帧的目标比特数上限,若已经编码输出第二滑动窗口内的第1至N-M帧的压缩码流比特数较大时,可以提前控制当前帧目标比特数上限,防止连续跳帧,提高编码器输出的图像流畅性。In this way, before encoding the current frame, the encoder can use the second sliding window to calculate the upper limit of the target number of bits of the current frame. It can control the upper limit of the target number of bits of the current frame in advance, prevent continuous frame skipping, and improve the smoothness of the image output by the encoder.

接着,编码器根据当前帧的目标比特数上限TN-(M-1)调整当前帧的目标比特数,再根据当前帧的目标比特数计算QP值,对当前帧进行编码。Next, the encoder adjusts the target bit number of the current frame according to the target bit number upper limit TN-(M-1) of the current frame, and then calculates the QP value according to the target bit number of the current frame to encode the current frame.

305、设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧。305. Set the position of the first sliding window, so that the current frame is located in the Nth frame of the first sliding window.

步骤305与步骤301的不同在于,在进行步骤305时,编码器已经编码输出第一滑动窗口内的第1至N-1帧,并完成对第N帧的编码即将输出第N帧。The difference between step 305 and step 301 is that when step 305 is performed, the encoder has already encoded and outputted frames 1 to N-1 in the first sliding window, and is about to output the Nth frame after completing the encoding of the Nth frame.

306、判断是否输出当前帧。306. Determine whether to output the current frame.

计算第一滑动窗口内所有帧的压缩码流比特数之和。Calculate the sum of the bit numbers of the compressed code streams of all frames in the first sliding window.

若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码If the sum of the compressed code stream bits of all frames in the first sliding window is greater than the preset code

编码器不输出当前帧N,即丢弃当前帧。其中,LN为当前编码帧的比特数;Li为第一滑动窗口内已经编码的第i帧的压缩码流比特数;maxbitrate为预设的码率上限,具体可以是预设的网络带宽上限,或者根据存储媒质(如硬盘、光盘等)的容量换算得到的码率上限;N为第一滑动窗口的大小,即预设的帧率。The encoder does not output the current frame N, that is, discards the current frame. Among them, LN is the number of bits of the current encoded frame; Li is the number of compressed code stream bits of the i-th frame that has been encoded in the first sliding window; maxbitrate is the upper limit of the preset code rate, which can be specifically the preset network bandwidth The upper limit, or the upper limit of the code rate converted according to the capacity of the storage medium (such as a hard disk, an optical disc, etc.); N is the size of the first sliding window, that is, the preset frame rate.

若第一滑动窗口内所有帧的压缩码流比特数之和不大于预设的If the sum of the compressed code stream bits of all frames in the first sliding window is not greater than the preset

编码器输出当前帧N。其中,LN为当前编码帧的比特数;Li为第一滑动窗口内已经编码的第i帧的压缩码流比特数;maxbitrate为预设的码率上限,具体可以是预设的网络带宽上限,或者根据存储媒质(如硬盘、光盘等)的容量换算得到的码率上限;N为第一滑动窗口的大小,即预设的帧率。The encoder outputs the current frame N. Among them, LN is the number of bits of the current encoded frame; Li is the number of compressed code stream bits of the i-th frame that has been encoded in the first sliding window; maxbitrate is the preset code rate upper limit, which can be the preset network bandwidth The upper limit, or the upper limit of the code rate converted according to the capacity of the storage medium (such as hard disk, optical disc, etc.); N is the size of the first sliding window, that is, the preset frame rate.

需要说明的是,对于当前帧,步骤301~302与步骤303~304可以同时进行,步骤303~304也可以在步骤301~302之前进行,也可以只进行步骤301~302,或者只进行步骤303~304。可以理解的是,以上变形及其他依据本发明的思路可作的变形,均应纳入本发明的保护范围。It should be noted that, for the current frame, steps 301-302 and steps 303-304 can be performed simultaneously, steps 303-304 can also be performed before steps 301-302, or only steps 301-302 can be performed, or only step 303 can be performed ~304. It can be understood that the above modifications and other modifications that can be made according to the idea of the present invention should be included in the protection scope of the present invention.

如图4所示,本发明实施例还提供一种视频编码中码率的控制装置4,包括,As shown in FIG. 4, the embodiment of the present invention also provides a code rate control device 4 in video coding, including:

滑动窗口设置模块41,用于设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧。The sliding window setting module 41 is configured to set the position of the first sliding window so that the current frame is located in the Nth frame of the first sliding window.

输出判断模块42,用于判断是否输出当前帧,若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧。The output judging module 42 is used for judging whether to output the current frame, if the sum of the compressed code stream bits of all frames in the first sliding window is greater than the preset code rate upper limit, the current frame is not output.

其中,所述第一滑动窗口的大小等于预设的帧率N。Wherein, the size of the first sliding window is equal to a preset frame rate N.

进一步的,装置4还包括,Further, the device 4 also includes,

编码判断模块43,用于判断是否编码当前帧,若第一滑动窗口内第1帧至第N-1帧的压缩码流比特数之和与第N帧预设的目标比特数之和大于预设的码率上限,不编码当前帧。Encoding judging module 43, for judging whether to encode the current frame, if the sum of the compressed code stream bit numbers of the first frame to the N-1th frame in the first sliding window and the preset target bit number of the Nth frame are greater than the preset The upper limit of the set code rate, the current frame will not be encoded.

其中,所述第一滑动窗口的大小等于预设的帧率N。Wherein, the size of the first sliding window is equal to a preset frame rate N.

进一步的,滑动窗口设置单元41,还用于设置第二滑动窗口的位置,使所述当前帧位于所述第二滑动窗口的第N-(M-1)帧;Further, the sliding window setting unit 41 is also used to set the position of the second sliding window so that the current frame is located at the N-(M-1)th frame of the second sliding window;

所述装置4还包括,The device 4 also includes,

确定模块44,用于根据第二滑动窗口内第1帧至第N-M帧的压缩码流比特数之和确定当前帧的目标比特数上限;A determining module 44, configured to determine the upper limit of the target number of bits of the current frame according to the sum of the bits of the compressed code stream from the first frame to the N-M frame in the second sliding window;

其中,所述第二滑动窗口的大小等于预设的帧率N。Wherein, the size of the second sliding window is equal to a preset frame rate N.

图4所示的视频编码中码率的控制装置能够执行上述方法实施例中的步骤,完成方法实施例的各功能,其应用过程中按方法实施例的描述实现视频编码中码率的控制方法。The device for controlling the code rate in video coding shown in Figure 4 can execute the steps in the above-mentioned method embodiments, complete the functions of the method embodiments, and implement the method for controlling the code rate in video coding according to the description of the method embodiments in the application process .

示例性的,图4所示的视频编码中码率的控制装置可以是编码器。Exemplarily, the apparatus for controlling bit rate in video encoding shown in FIG. 4 may be an encoder.

以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应以所述权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Anyone skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present invention. Should be covered within the protection scope of the present invention. Therefore, the protection scope of the present invention should be determined by the protection scope of the claims.

Claims (6)

Translated fromChinese
1.一种视频编码中码率的控制方法,其特征在于,包括:1. A method for controlling code rate in video coding, characterized in that, comprising:设置第二滑动窗口的位置,使当前帧位于所述第二滑动窗口的第N-(M-1)帧;The position of the second sliding window is set so that the current frame is located at the N-(M-1)th frame of the second sliding window;根据所述第二滑动窗口内第1帧至第N-M帧的压缩码流比特数之和确定所述当前帧的目标比特数上限;其中,所述第二滑动窗口的大小等于预设的帧率N;The upper limit of the target number of bits of the current frame is determined according to the sum of the bits of the compressed code stream from the first frame to the N-M frame in the second sliding window; wherein, the size of the second sliding window is equal to a preset frame rate N;设置第一滑动窗口的位置,使所述当前帧位于所述第一滑动窗口的第N帧;Setting the position of the first sliding window so that the current frame is located at the Nth frame of the first sliding window;在对所述当前帧编码后,若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,则不输出当前帧;其中,所述第一滑动窗口的大小等于预设的帧率N。After encoding the current frame, if the sum of the compressed code stream bits of all frames in the first sliding window is greater than the preset code rate upper limit, the current frame is not output; wherein, the size of the first sliding window is equal to The preset frame rate N.2.根据权利要求1所述的方法,其特征在于,所述“设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧”与所述“若第一滑动窗口内的压缩码流比特数之和大于预设的码率上限,不输出当前帧”之间还包括:2. The method according to claim 1, wherein said "setting the position of the first sliding window so that the current frame is positioned at the Nth frame of the first sliding window" is the same as said "if the first sliding window The sum of the bits of the compressed code stream within is greater than the preset upper limit of the code rate, and the current frame is not output." Also includes:若第一滑动窗口内第1帧至第N-1帧的压缩码流比特数之和与第N帧预设的目标比特数之和大于预设的码率上限,不编码当前帧,当前帧的处理步骤结束;If the sum of the compressed code stream bits from the first frame to the N-1th frame in the first sliding window and the preset target bit number of the Nth frame are greater than the preset code rate upper limit, the current frame is not encoded, and the current frame The processing step of the end;若第一滑动窗口内第1帧至第N-1帧的压缩码流比特数之和与第N帧预设的目标比特数之和不大于预设的码率上限,编码当前帧。If the sum of the bits of the compressed stream from frame 1 to frame N-1 in the first sliding window and the preset target bits of frame N is not greater than the preset upper limit of the code rate, encode the current frame.3.根据权利要求1所述的方法,其特征在于,所述当前帧的目标比特数上限为,TN-(M-1)=maxbitrate-Σi=1N-MLi-(M-1)*(bitrateN)3. The method according to claim 1, wherein the upper limit of the target bit number of the current frame is, T N - ( m - 1 ) = max bit rate - Σ i = 1 N - m L i - ( m - 1 ) * ( bit rate N )其中,TN-(M-1)为当前帧目标比特数上限;maxbitrate为预设的码率上限;Li为第二滑动窗口内已经编码的第i帧的压缩码流比特数;N为第二滑动窗口的大小;(M-1)*(bitrate/N)表示第二滑动窗口内位于当前帧之后的共计(M-1)帧的预设目标比特数之和。Among them, TN-(M-1) is the upper limit of the target number of bits of the current frame; maxbitrate is the upper limit of the preset code rate; Li is the number of compressed code stream bits of the i-th frame that has been encoded in the second sliding window; N is The size of the second sliding window; (M-1)*(bitrate/N) represents the sum of the preset target bit numbers of the total (M-1) frames after the current frame in the second sliding window.4.根据权利要求3所述的方法,其特征在于,所述M取值为3或者4。4. The method according to claim 3, wherein the value of M is 3 or 4.5.一种视频编码中码率的控制装置,其特征在于,包括,5. A device for controlling bit rate in video coding, characterized in that, comprising,滑动窗口设置单元,用于设置第二滑动窗口的位置,使当前帧位于所述第二滑动窗口的第N-(M-1)帧;The sliding window setting unit is used to set the position of the second sliding window so that the current frame is located at the N-(M-1)th frame of the second sliding window;确定模块,用于根据所述第二滑动窗口内第1帧至第N-M帧的压缩码流比特数之和确定所述当前帧的目标比特数上限;其中,所述第二滑动窗口的大小等于预设的帧率N;A determining module, configured to determine the upper limit of the target number of bits of the current frame according to the sum of the bits of the compressed code stream from the first frame to the N-M frame in the second sliding window; wherein, the size of the second sliding window is equal to preset frame rate N;所述滑动窗口设置模块,还用于设置第一滑动窗口的位置,使当前帧位于所述第一滑动窗口的第N帧;The sliding window setting module is also used to set the position of the first sliding window so that the current frame is located in the Nth frame of the first sliding window;输出判断模块,用于在对所述当前帧编码后,判断是否输出当前帧,若第一滑动窗口内所有帧的压缩码流比特数之和大于预设的码率上限,不输出当前帧;The output judging module is used to judge whether to output the current frame after encoding the current frame, and if the sum of the bit numbers of the compressed code streams of all frames in the first sliding window is greater than the preset code rate upper limit, the current frame is not output;其中,所述第一滑动窗口的大小等于预设的帧率N。Wherein, the size of the first sliding window is equal to a preset frame rate N.6.根据权利要求5所述的装置,其特征在于,还包括,6. The device according to claim 5, further comprising,编码判断模块,用于判断是否编码当前帧,若第一滑动窗口内第1帧至第N-1帧的压缩码流比特数之和与第N帧预设的目标比特数上限之和大于预设的码率上限,不编码当前帧;An encoding judging module, used to judge whether to encode the current frame, if the sum of the bit numbers of the compressed code stream from the first frame to the N-1th frame in the first sliding window and the preset target bit number upper limit of the Nth frame are greater than the preset The upper limit of the set code rate will not encode the current frame;其中,所述第一滑动窗口的大小等于预设的帧率N。Wherein, the size of the first sliding window is equal to a preset frame rate N.
CN201210190602.9A2012-06-112012-06-11The control method of code check and device in a kind of Video codingActiveCN102724502B (en)

Priority Applications (1)

Application NumberPriority DateFiling DateTitle
CN201210190602.9ACN102724502B (en)2012-06-112012-06-11The control method of code check and device in a kind of Video coding

Applications Claiming Priority (1)

Application NumberPriority DateFiling DateTitle
CN201210190602.9ACN102724502B (en)2012-06-112012-06-11The control method of code check and device in a kind of Video coding

Publications (2)

Publication NumberPublication Date
CN102724502A CN102724502A (en)2012-10-10
CN102724502Btrue CN102724502B (en)2015-08-19

Family

ID=46950147

Family Applications (1)

Application NumberTitlePriority DateFiling Date
CN201210190602.9AActiveCN102724502B (en)2012-06-112012-06-11The control method of code check and device in a kind of Video coding

Country Status (1)

CountryLink
CN (1)CN102724502B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
WO2017020181A1 (en)*2015-07-312017-02-09SZ DJI Technology Co., Ltd.Method of sensor-assisted rate control
CN106572351B (en)*2015-10-132019-11-15腾讯科技(北京)有限公司Bit rate control method and device, electronic equipment and computer readable storage medium in Video coding
CN106851337B (en)*2017-02-212019-12-24聚好看科技股份有限公司Video buffering control method and device
CN106937115A (en)*2017-03-022017-07-07杭州当虹科技有限公司The method for carrying out bit number training to bit number fallout predictor in Video coding
CN107493478B (en)*2017-09-012020-04-14广州市百果园网络科技有限公司Method and device for setting coding frame rate
CN109862359B (en)*2018-12-292021-01-08北京数码视讯软件技术发展有限公司Code rate control method and device based on layered B frame and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP0778708A2 (en)*1995-12-041997-06-11Tektronix, Inc.Bit rate control for video data
US6141380A (en)*1998-09-182000-10-31Sarnoff CorporationFrame-level rate control for video compression
CN1964494A (en)*2006-11-172007-05-16中兴通讯股份有限公司A method to control frame level of code rate in video coding
US7313183B2 (en)*2003-06-242007-12-25Lsi CorporationReal time scene change detection in video sequences
CN102378065A (en)*2011-10-192012-03-14江西省南城县网信电子有限公司Method and system for configuring buffer area at streaming media server side based on MPEG (Moving Picture Experts Group)-4

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
US8107537B2 (en)*2006-02-022012-01-31Sharp Laboratories Of America, Inc.Picture layer rate control for video encoding
CN101743753B (en)*2007-06-192014-05-21万特里克斯公司 Buffer-based rate control exploiting frame complexity, buffer level, and intra-frame position in video encoding

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication numberPriority datePublication dateAssigneeTitle
EP0778708A2 (en)*1995-12-041997-06-11Tektronix, Inc.Bit rate control for video data
US6141380A (en)*1998-09-182000-10-31Sarnoff CorporationFrame-level rate control for video compression
US7313183B2 (en)*2003-06-242007-12-25Lsi CorporationReal time scene change detection in video sequences
CN1964494A (en)*2006-11-172007-05-16中兴通讯股份有限公司A method to control frame level of code rate in video coding
CN102378065A (en)*2011-10-192012-03-14江西省南城县网信电子有限公司Method and system for configuring buffer area at streaming media server side based on MPEG (Moving Picture Experts Group)-4

Also Published As

Publication numberPublication date
CN102724502A (en)2012-10-10

Similar Documents

PublicationPublication DateTitle
CN102724502B (en)The control method of code check and device in a kind of Video coding
EP3562155B1 (en)Bit rate control method and device
CN109743600B (en) Wearable based on-site operation and maintenance adaptive video streaming rate control method
CN101594525B (en)Method and device for acquiring quantization parameters and transcoding device
US20020090027A1 (en)Apparatus, and associated method, for selecting an encoding rate by which to encode video frames of a video sequence
RU2009116472A (en) DYNAMIC MODIFICATION OF VIDEO PROPERTIES
US20110299589A1 (en)Rate control in video communication via virtual transmission buffer
CN103458264B (en)Method and device for evaluating quality of media
CN103155580A (en)Adaptive streaming of video at different quality levels
CN102905128B (en)Codec processor is the method for Rate Control during wireless video transmission
ITTO20090486A1 (en) DYNAMIC CONTROLLER OF INDEPENDENT TRANSMISSION SPEED FROM THE GROUP OF IMAGES
CN115174907B (en) Method and device for controlling video compression bit rate
JP2019512970A5 (en)
CN110572695A (en)media data encoding and decoding methods and electronic equipment
CN102761741A (en)Video encoding code rate control system and method on basis of caches at encoding and decoding ends
WO2015095166A2 (en)Producing an output need parameter for an encoder
EP2978219B1 (en)Variable rate video encoder
EP4633158A1 (en)Coding control method and apparatus, and device, storage medium and product
CN102075784B (en)Video quality assessment method under condition of comprehensively considering compression and packet loss impairment
US7714751B2 (en)Transcoder controlling generated codes of an output stream to a target bit rate
CN101521813A (en)Method and device for processing media stream
CN102625104A (en) A kind of video coding method
CN114363618A (en) A video coding constant bit rate control method, system and electronic device
CN102724507B (en)GPU (graphic processing unit) accelerating encoder rate control method
CN102595142B (en)Method and system for power grid holographic digital map video encoding

Legal Events

DateCodeTitleDescription
C06Publication
PB01Publication
C10Entry into substantive examination
SE01Entry into force of request for substantive examination
C14Grant of patent or utility model
GR01Patent grant

[8]ページ先頭

©2009-2025 Movatter.jp