可变比特率视频压缩如何平均每帧?

发布于 2024-10-08 05:32:16 字数 386 浏览 5 评论 0原文

可变比特率在什么时间范围内用于平均?例如,假设我想以 2000 kbps 的速度对 60 秒的 640 x 280 25 fps 视频进行编码。

编解码器是否会查看视频的第一秒(25 帧),确定如何将这 25 帧压缩为 2000 KB,然后转到视频的下一秒(25 帧)?

或者它会分析整个视频(也许前 10 秒是纯黑的)并计算出它可以在最后 50 秒使用超过 2000 kb,但仍然保持整个视频的 2000 kb 平均值?

或者是基于特定编解码器的关键帧间隔。如果我将关键帧间隔设置为 250(10 秒的视频),编解码器会在这 10 秒期间分配 20,000 kbit 吗?

我确信对于所有不同的编解码器来说,它实际上是不同的,但我认为必须有一个最佳实践(或者至少是一个我可以谷歌搜索的术语)。

Over what time frame does variable bit rate use for averaging? For example, say I want to encode 60 seconds of 640 x 280 25 fps video at 2000 kilobits per second.

Does the codec look at the first second (25 frames) of video, determine how to compress those 25 frames into 2000 kilobits, then move onto the next second of video (25 frames)?

Or does it analyse the whole video (maybe the first 10 seconds are pure black) and calculate that it can use more than 2000 kilobits for the last 50 seconds, but still maintain a 2000 kilobit average over the entire video?

Or is it based on the key frame interval of the particular codec. If I had the keyframe interval set to 250 (10 seconds of video), would the codec assign 20,000 kilobits over that 10 second period?

I'm sure it's actually different for all different codecs, but I figure there must be a best practice (or at least a term I can Google).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夏雨凉 2024-10-15 05:32:16

我不知道任何特定编解码器的定义或编码器的实现,但我熟悉 VBR 背后的原理和动机(更多的是因为它涉及音频,但我相信概念是相同的)。

这里有两个主要类别:单遍和多遍。单通道(即时)编码速度要快得多。它仅通过视频一次并进行编码。对于广播和整个视频无法进行事先分析的其他情况,可以实时完成。您的问题似乎主要涉及多遍。虽然称为多遍,但通常只意味着两次。更重要的是,您似乎在询问多通道 VBR 编码,其中指定了平均值 (ABR),并且必须遵守该编码。

由于较高的颜色深度、数量、边缘数量等(或在音频中 - 大量复调、混合频率等),VBR 允许需要更高比特率的部分,而对于那些较少的“更简单”部分则允许较低的比特率品质(音频:单一声音、只有节奏的部分等),其极端是整个帧为纯色或接近纯色(沉默)。基本上与影响静态图像压缩的标准相同。

因此,在我看来,编码器坚持指定平均值的最有效方法是在整个文件中以特定周期频率对各个帧进行采样。比如说,整个视频每秒两次。 (我不知道这是否符合实际估计,但你明白了)。希望这可以很好地估计视频特征(因为缺乏更好的词),并允许最有效地分配这些宝贵的资源。

还应该注意的是,有时存在可以采用的最小和最大比特率范围,因此比特率在任何时候都不能小于X或大于Y。精心选择的范围显然取决于分辨率。

至于谷歌的术语 - 尝试多通道编码和 AVR。像往常一样,维基百科勾勒出一幅相当不错的粗略图片,足以让您知道去哪里进一步阅读 http://en.wikipedia.org/wiki/Variable_bitrate#Multi-pass_encoding_and_single-pass_encoding

I don't know the definitions of any particular codec or implementations of encoders but I am familiar with the rational and motivation behind VBR (more as it concerns audio, but I believe the concept is the same).

There are two main categories in play here: single pass and multi pass. Single pass (on-the-fly) encodes much faster. It just passes through the video once and encodes. It can be done in real time for broadcasts and other situations that the whole video isnt available for prior analysis. Your question seems to mainly concern multi-pass. Though it is called multi-pass, it usually means just two. More so, you seem to be asking about multi-pass VBR encoding in which an average (ABR) is specified and must be adhered to.

VBR allows higher bit rates for sections that demand it due to higher color depth, amount of , amount of edges, etc (or in audio - lots of polyphony, mixed frequencies, etc) and lower rates for "plainer" sections with less of those qualities (audio: single voice, sections with only rhythm, etc) the extreme of this being entire frames of a solid color or close to it (silence). Basically the same criteria that effect the compression of still images.

As such, it seems to me that the most effective way for an encoder to stick to a specified average would be to sample individual frames at a certain periodic frequency throughout the entirety of the file. Say, twice a second for the entirety of the video. (I don't know if this is even in the ballpark of a realistic estimate, but you get the idea). This hopefully gives a good estimate of the videos character (for lack of a better word) and allows for most efficient distribution of those precious resources.

It should also be noted that there is sometimes a range of minimum and maximum bit rates that can be employed so that at no time can the bit rate be less than X, or more than Y. Well chosen ranges obviously depend on the resolution.

As for terms to google - try multi-pass encoding and AVR. And as usual, wikipedia sketches a pretty good rough picture, enough so you'd know where to go for further readiong http://en.wikipedia.org/wiki/Variable_bitrate#Multi-pass_encoding_and_single-pass_encoding

私藏温柔 2024-10-15 05:32:16

你可以用谷歌搜索一个术语——多通道编码和多通道编码。率预测。

它的作用(除了提供最佳质量编码之外)是编解码器有效地对视频进行两次编码,第一次记录固定比特率导致的质量损失,第二次合并该信息,以便无论在什么情况下都保持相同的质量水平。视频中的更改量。

速率预测/速率控制是一个非常有趣的话题,特别是对于实时、一次性编码。编解码器必须对未来场景的复杂性做出良好的估计,以便将总体比特率保持在目标范围内。

通道允许的最大比特率的限制(例如,您可能需要 1MBit/s 的平均比特率,但由于播放器中的缓冲,内容不能超过 2MBit/s 的时间超过 5 秒)使此任务更具挑战性。

请查看此处以获取更多提示:
http://www.pixeltools.com/rate_control_paper.html

A term you could google - multi-pass encoding & rate prediction.

What it does (beyond providing the best quality encodes) is that the codec effectively encodes the video twice, first time recording the quality loss resulting from a fixed bitrate, second time, incorporating that information in order to maintain the same level of quality regardless on the amount of changes in the video.

Rate prediction/Rate control, is a very fascinating topic, especially for real time, one-pass encoding. The codec has to make a good estimate of the future scene complexity, in order to keep the overall bitrate on target.

Restrictions on maximum bitrate permitted by channel (for instance, you might want a 1MBit/s average bitrate, but the content cannot exceed 2MBit/s for longer than 5s, because of buffering in the players) make this task even more challenging.

Take a look here for more hints:
http://www.pixeltools.com/rate_control_paper.html

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文