如何使用FFMPEG将视频保存在特定的比特率中?

发布于 2025-01-28 18:24:02 字数 372 浏览 3 评论 0原文

我正在尝试将一些视频保存在特定的比特率(8000k)中,为此,我使用了以下代码:

ffmpeg  -i  input_1080p60  -c:v  libx264 -pix_fmt yuv420p  -b:v 8000K -bufsize 8000K -minrate 8000K -maxrate 8000K -x264opts keyint=120:min-keyint=120 -preset veryfast -profile:v high out_1080p.264

但是保存视频后,我发现每个视频都有不同的比特率(例如5000k,6000k,7500k,。 ..)。但是我定义了微小的8000k。您知道问题是什么,如何强制上述代码具有特定的比特率?谢谢。

I am trying to save some videos in specific bitrate (8000k) and for this, I used the following code:

ffmpeg  -i  input_1080p60  -c:v  libx264 -pix_fmt yuv420p  -b:v 8000K -bufsize 8000K -minrate 8000K -maxrate 8000K -x264opts keyint=120:min-keyint=120 -preset veryfast -profile:v high out_1080p.264

but after saving the videos, I find out each video has a different bitrate except 8000k ( for example 5000k, 6000k, 7500k,...). but I define the minrate 8000k. do you know what is the problem and how can I force the above code to have the specific bitrate? Thank you.

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

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

发布评论

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

评论(1

娇纵 2025-02-04 18:24:02

这就是2个通用编码的目的。请参阅 ffmpeg wiki

2-pass Encoding背后的想法是运行2-pass的想法。 FFMPEG两次可以首先分析视频,以决定如何最好地分配位以满足特定的比特率,然后第二次通过进行实际编码。

因此,应像这样修改您的命令:

ffmpeg -i  input_1080p60 \
  -pass 1 \
  -c:v  libx264 -pix_fmt yuv420p -b:v 8000K -bufsize 8000K \
  -x264opts keyint=120:min-keyint=120 \
  -preset veryfast -profile:v high /dev/null

ffmpeg -i input_1080p60 \
  -pass 2 \
  -c:v  libx264 -pix_fmt yuv420p -b:v 8000K -bufsize 8000K \
  -x264opts keyint=120:min-keyint=120 \
  -preset veryfast -profile:v high out_1080p.264

如果您在Windows中,请使用nul而不是/dev/dev/null

That's what 2-pass encoding is for. See FFmpeg Wiki

The idea behind 2-pass encoding is that by running FFmpeg twice it can first analyze the video to decide how to best allocate the bits to meet the specific bitrate then the second pass does the actual encoding.

So your command should be modified like this:

ffmpeg -i  input_1080p60 \
  -pass 1 \
  -c:v  libx264 -pix_fmt yuv420p -b:v 8000K -bufsize 8000K \
  -x264opts keyint=120:min-keyint=120 \
  -preset veryfast -profile:v high /dev/null

ffmpeg -i input_1080p60 \
  -pass 2 \
  -c:v  libx264 -pix_fmt yuv420p -b:v 8000K -bufsize 8000K \
  -x264opts keyint=120:min-keyint=120 \
  -preset veryfast -profile:v high out_1080p.264

If you are in Windows, use NUL instead of /dev/null.

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