使用ffmpeg / avconv将视频转换为WebM

耶罗恩

尝试优化家庭视频的大小时,我在Xubuntu上使用Pitivi将其中的一些视频转换为WebM作为测试。大小差异很大。生成的webm文件仅占原始文件的10%左右,而图片质量对我来说几乎一样。

我还尝试使用进行转换,avconv以便可以编写脚本,但是生成的文件看起来确实很烂。在查看了Pitivi中的渲染设置之后,我尝试了一些参数:avconv -i $1 -q 5 -qmin 0 -qmax 63 ${1%.*}.webm,但是质量看起来仍然很糟糕,因此似乎缺少了/使用了一些错误的参数。有人知道哪些正确的参数可用于将h264电影转换为webm并获得与Pitivi相同的质量吗?

这些是Pitivi中的设置: 创建Pitivi项目 渲染到WebM(HTML5视频) 编解码器配置

slhck

Note: This information is based on the FFmpeg Wiki on VP9 encoding. Please refer to that article for more information – it will be continuously maintained and extended. For the best results you should use the a recent version of ffmpeg by downloading it from their website (a static build will suffice; it contains the libvps-vp9 encoder).

Variable Bit Rate

VBR encoding gives you the optimal overall quality, since the encoder can freely choose how many bits to assign to a frame. Choose this mode unless you are preparing videos for constant-bitrate streaming.

Option 1: Constant quality encoding

Typically, if you do not want to target a specific file size, you should let the bitrate vary freely, as that will lead to the highest quality. You can do this by setting the bitrate to 0 and the constant rate factor (CRF) to the target quality level:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 output.webm

CRF value can be from 0–63. Lower values mean better quality. Recommended values range from 15–35, with 31 being recommended for 1080p HD video. Google has a guide with more info on that.

Option 2: Two-pass encoding with a target bitrate

If you want your file to have a specific target bitrate or file size, you need to specify the rate and use two-pass encoding (which will ensure an optimal quality distribution). Here we're choosing 5 MBit/s, which should be enough for 1080p content.

ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 5M -pass 1 -f webm /dev/null && \
ffmpeg -i input.mp4 -c:v libvpx-vp9 -b:v 5M -pass 2 output.webm

Windows users need to use NUL instead of /dev/null, and a ^ instead of \.

Constant Bit Rate

First of all, libvpx offers constant bitrate and variable bitrate encoding modes. Constant bitrate should be avoided whenever possible (unless you target a specific file size or streaming scenario), since the average quality per file size will be worse. Still, you could try setting a constant bitrate if nothing else works for you, e.g. with 1 MBit/s:

ffmpeg -i input.mp4 -c:v libvpx-vp9 -minrate 5M -maxrate 5M -b:v 5M output.webm

Look at the output and increase or decrease the bit rate to your liking (or file size constraints). For example, you can use 500K or 5M, et cetera.

你必须指定-minrate-maxrate以及比特率-b:v,以使编码器使用CBR。它们都必须具有相同的值-否则,它将选择不同的目标比特率,并进行VBR编码,但质量较差。

声音的

VP9编码当前选择的音频编解码器是Opus。FFmpeg将默认选择必要的编码器及其选项。如果要显式设置-c:a libopus,也可以这样做。有关更多选项,请参考libopus文档

本文收集自互联网,转载请注明来源。

如有侵权,请联系[email protected] 删除。

编辑于
0

我来说两句

0条评论
登录后参与评论

相关文章

来自分类Dev

使用avconv将未编号的图像转换为视频

来自分类Dev

如何使用ffmpeg / avconv使用wmv1编解码器将任何视频转换为.avi?

来自分类Dev

使用ffmpeg将webm转换为mp4

来自分类Dev

ffmpeg:使用ffmpeg将图像/音频转换为视频

来自分类Dev

FFMPEG hwaccel将WEBM转换为MP4视频失败:找不到编解码器参数

来自分类Dev

PHP-使用ffmpeg将图像转换为视频

来自分类Dev

如何成功使用ffmpeg将图像转换为视频

来自分类Dev

使用ffmpeg将视频转换为Gif Android Studio

来自分类Dev

如何使用ffmpeg将图像帧转换为视频?

来自分类Dev

在Windows上使用FFMPEG将图像转换为视频

来自分类Dev

使用FFMPEG将视频转换为mpg格式

来自分类Dev

使用ffmpeg将.mov视频转换为.mp4

来自分类Dev

使用FFmpeg将视频转换为图像序列的python脚本

来自分类Dev

如何使用 ffmpeg 以合理的质量将视频转换为 GIF?

来自分类Dev

使用alpha将WEBM转换为HEVC

来自分类Dev

使用ffmpeg使用Alpha将mov转换为使用Alpha的VP9 Webm

来自分类Dev

FFMpeg将jpeg图像转换为视频

来自分类Dev

FFMPEG:将.rgb图像转换为视频

来自分类Dev

使用avconv将mkv递归转换为mp4

来自分类Dev

如何使用avconv将PPM转换为MP4

来自分类Dev

FFMPEG:将WebM VP8 / VP9多分辨率视频转换为MP4(H.264)

来自分类Dev

使用ffmpeg将.avi电影转换为3GP时,视频转换停止

来自分类Dev

将图像添加到3GP文件,然后使用avconv por ffmpeg将其转换为MP4

来自分类Dev

将图像添加到3GP文件,然后使用avconv por ffmpeg将其转换为MP4

来自分类Dev

使用ffmpeg提高webm视频的质量

来自分类Dev

使用ffmpeg提高webm视频的质量

来自分类Dev

使用ffmpeg将WAV转换为AIFF

来自分类Dev

Popen.write-对已关闭文件的操作| 使用FFmpeg将图像转换为视频

来自分类Dev

使用ffmpeg和文件列表将图像序列转换为视频

Related 相关文章

  1. 1

    使用avconv将未编号的图像转换为视频

  2. 2

    如何使用ffmpeg / avconv使用wmv1编解码器将任何视频转换为.avi?

  3. 3

    使用ffmpeg将webm转换为mp4

  4. 4

    ffmpeg:使用ffmpeg将图像/音频转换为视频

  5. 5

    FFMPEG hwaccel将WEBM转换为MP4视频失败:找不到编解码器参数

  6. 6

    PHP-使用ffmpeg将图像转换为视频

  7. 7

    如何成功使用ffmpeg将图像转换为视频

  8. 8

    使用ffmpeg将视频转换为Gif Android Studio

  9. 9

    如何使用ffmpeg将图像帧转换为视频?

  10. 10

    在Windows上使用FFMPEG将图像转换为视频

  11. 11

    使用FFMPEG将视频转换为mpg格式

  12. 12

    使用ffmpeg将.mov视频转换为.mp4

  13. 13

    使用FFmpeg将视频转换为图像序列的python脚本

  14. 14

    如何使用 ffmpeg 以合理的质量将视频转换为 GIF?

  15. 15

    使用alpha将WEBM转换为HEVC

  16. 16

    使用ffmpeg使用Alpha将mov转换为使用Alpha的VP9 Webm

  17. 17

    FFMpeg将jpeg图像转换为视频

  18. 18

    FFMPEG:将.rgb图像转换为视频

  19. 19

    使用avconv将mkv递归转换为mp4

  20. 20

    如何使用avconv将PPM转换为MP4

  21. 21

    FFMPEG:将WebM VP8 / VP9多分辨率视频转换为MP4(H.264)

  22. 22

    使用ffmpeg将.avi电影转换为3GP时,视频转换停止

  23. 23

    将图像添加到3GP文件,然后使用avconv por ffmpeg将其转换为MP4

  24. 24

    将图像添加到3GP文件,然后使用avconv por ffmpeg将其转换为MP4

  25. 25

    使用ffmpeg提高webm视频的质量

  26. 26

    使用ffmpeg提高webm视频的质量

  27. 27

    使用ffmpeg将WAV转换为AIFF

  28. 28

    Popen.write-对已关闭文件的操作| 使用FFmpeg将图像转换为视频

  29. 29

    使用ffmpeg和文件列表将图像序列转换为视频

热门标签

归档