为什么FFMPEG总是制作大型WebM文件? [英] Why does FFMPEG always make large WebM files?

查看:109
本文介绍了为什么FFMPEG总是制作大型WebM文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  ffmpeg -i input.MOV -codec:v libvpx  - 质量好-cpu使用0 -b:v 10k 
-qmin 10 -qmax 42 -maxrate 10k -bufsize 20k -threads 8 -vf scale = -1:1080
-codec:libvorbis -b :a 192k
output.webm

我想用几个不同的比特率进行编码(视频和音频合并):




  • 2192 kbps

  • 1692 kbps

  • 1000 kbps



问题是,无论我输入哪个比特率,我总是得到一个文件速率高于1900 kbps。 (1914 kbps,上面的代码示例)。



我做错了什么?

解决方案

libvpx 在速率控制和质量设置方面有点复杂。请参阅 vpx编码指南 VP8编码参数指南了解更多信息。我花了一个小时挖掘源代码来了解它。



如果要设置不变比特率,您将必须设置 b :v maxrate minrate 到相同的值,例如我简短地省略了这些音频选项):

  ffmpeg -i input.mov -c:v libvpx -b: v 1900K -maxrate 1900K-minrate 1900K output.webm 

如果你想要使用可变质量指定比特率的上限,则需要同时设置 b:v crf 。如果您省略 crf ,则指定的比特率将被视为平均值。只有使用 crf ,编码器将 b:v 的含义更改为允许的最大速率。

  ffmpeg -i input.mov -c:v libvpx -b:v 1900K -crf 10 output.webm 

CRF的值为10是一个很好的起点,但 libvpx 可能会更改在 qmin≤q≤qmax 范围内的每帧质量,您还可以根据需要指定。设置 qmin 的下限为10,似乎对我来说有点高,但实质上你必须做一些尝试和错误,因为如果最大比特率也是低,你会不断饱和。


I'm trying to encode my movies into WebM:

ffmpeg -i input.MOV -codec:v libvpx -quality good -cpu-used 0 -b:v 10k
-qmin 10 -qmax 42 -maxrate 10k -bufsize 20k -threads 8 -vf scale=-1:1080
-codec:a libvorbis -b:a 192k
output.webm

I want to encode at a couple of different bit rates (video and audio combined):

  • 2192 kbps
  • 1692 kbps
  • 1000 kbps

The problem is that no matter which bit rates I enter, I always get a file with a bit rate higher than 1900 kbps. (1914 kbps with the code example above.)

What am I doing wrong?

解决方案

libvpx is a little complicated with regard to rate control and quality settings. Please refer to the vpx Encoding Guide and the VP8 Encode Parameter Guide for more info. It took me an hour of digging through the source code to understand it.

If you want to set constant bitrate, you will have to set b:v, maxrate and minrate to the same values, for example like so (note that I left out the audio options here for brevity):

ffmpeg -i input.mov -c:v libvpx -b:v 1900K -maxrate 1900K -minrate 1900K output.webm

If instead you want to use variable quality and just specify the upper bound for the bitrate, then you need to set both b:v and crf. If you leave out crf, the specified bitrate will just be taken as an average. Only with crf, the encoder changes the meaning of b:v to the maximum allowed rate.

ffmpeg -i input.mov -c:v libvpx -b:v 1900K -crf 10 output.webm

A value of 10 for the CRF is a good starting point, but libvpx may change the quality per frame within the bounds of qmin ≤ q ≤ qmax, which you can also specify if you want. Setting a lower bound of 10 for qmin seems a little high to me, but in essence you'll have to do some trial and error anyway, since if the maximum bitrate is too low, you'll constantly saturate it.

这篇关于为什么FFMPEG总是制作大型WebM文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆