本文介绍了什么是 H.264 中的 VBV(视频缓冲验证器)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法理解什么是 VBV(视频缓冲验证器)以及它与最大速率有什么关系.
当我使用这个命令时:

I can't understand what is a VBV (Video Buffering Verifier) and what relations it have with a maxrate.
When I use this command:

ffmpeg -i input.mp4 -crf 21 -maxrate 750k -bufsize 750k -codec:v:0 libx264 -s 640x360 -r 30 output.mp4

output.mp4 视频的比特率约为 730 kb/s
但是当我使用这个命令时(相同的命令,但带有 -bufsize 5000k):

output.mp4 video have a bit rate about 730 kb/s
But when I use this command (same command but with -bufsize 5000k):

ffmpeg -i input.mp4 -crf 21 -maxrate 750k -bufsize 5000k -codec:v:0 libx264 -s 640x360 -r 30 output.mp4

output.mp4 视频的比特率高于 750kb/s(大约 800-900kb/s).
为什么会发生?为什么我们需要 bufsize?bufsize 有什么作用?

output.mp4 video have more bit rate than 750kb/s (about 800-900 kb/s).
Why it happens? Why we need the the bufsize? What does the bufsize do?

推荐答案

基本上 VBV 使您能够确保编码流不会溢出或下溢解码器的缓冲区.如果太多数据快速进入,缓冲区将溢出,您将被迫丢弃其中的一些.如果数据进入太慢,缓冲区将耗尽,播放将停止.

Basically the VBV enables you to make sure the encoded stream doesn't overflow or underflow the decoder's buffer. If too much data comes in fast the buffer will overflow and you'll be forced to drop some of it. If data is coming in too slow the buffer will run out and the playback will stall.

这有点违反直觉,但 VBV 下溢 表示编码器速率缓冲区溢出(视频比特率大于输入速率)而 VBV 溢出 表示编码器速率缓冲区下溢(视频比特率低于输入速率).

It's a bit counter-intuitive but a VBV underflow signals an encoder rate buffer overflow (video bitrate larger than the input rate) while a VBV overflow signals an encoder rate buffer underflow (video bitrate lower than input the rate).

对于 ffmpegbufsize 是缓冲区的大小.minratemaxratebufsize 结合使用来设置 VBR(可变比特率)的最大和最小比特率变化容限.

For ffmpeg the bufsize is the size of the buffer. minrate and maxrate are used in conjunction with bufsize to set the max and min bitrate change tolerance for VBR (variable bitrate).

minrate 通常与 maxrate 一起使用以实现接近 CBR(恒定比特率).

minrate is typically used along with maxrate to achieve near-CBR (constant bitrate).

maxrate 不是峰值比特率,而是可以进入缓冲区的最大比特率.如果您有一个大缓冲区,就像在第二个示例中一样,您可以在更长的时间内容忍更高的比特率,直到缓冲区溢出.VBV 可确保在此之前降低您的比特率.这就是为什么您的流可以达到 800-900 kbps.

maxrate is not the peak bitrate, it's rather the maximum bitrate that can enter the buffer. If you have a large buffer, like in your second example, you can tolerate a higher bitrate for a greater amount of time until the buffer overflows. VBV makes sure your bitrate is lowered before that happens. That's why your stream can reach 800-900 kbps.

您可以在此处阅读更多信息:--vbv-bufsize 和--vbv 之间的关系-maxrate

You can read more here: The relationship between --vbv-bufsize and --vbv-maxrate

这篇关于什么是 H.264 中的 VBV(视频缓冲验证器)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-23 02:38
查看更多