gpt4 book ai didi

video - 使用ffmpeg从mp4文件转换后如何获得具有透明背景填充的动画webp文件?

转载 作者:行者123 更新时间:2023-12-04 22:45:21 24 4
gpt4 key购买 nike

我需要将 mp4 视频 (1280×720) 转换为 webp 文件 (512x512),以便生成的 webp 文件保持纵横比并完全包含在 512x512 中,顶部和底部未覆盖的区域应该是透明的。

我尝试了以下 ffmpeg 命令:

ffmpeg -i sample.mp4 
-vcodec libwebp -filter:v fps=fps=20 -lossless 1 -loop 0 -preset default -an -vsync 0 -vf
scale=512:512:force_original_aspect_ratio=decrease,pad=512:512:-1:-1:color=#00000000 sample.webp

在上面的命令中请注意pad=512:512:-1:-1:color=#00000000我给了 alpha 值 00 但它只输出黑色。

我也引用了这个网站https://ffmpeg.org/ffmpeg-utils.html#color-syntax它说

It can be the name of a color as defined below (case insensitive match) or a [0x|#]RRGGBB[AA] sequence, possibly followed by @ and a string representing the alpha component.The alpha component may be a string composed of "0x" followed by a hexadecimal number or a decimal number between 0.0 and 1.0, which represents the opacity value (‘0x00’ or ‘0.0’ means completely transparent, ‘0xff’ or ‘1.0’ completely opaque). If the alpha component is not specified then ‘0xff’ is assumed.

我尝试了 color=0x000000@0x00color=0x000000@0.0 但结果是不透明的黑色。

最佳答案

我只是在 pad format=rgba,pad 之前缺少格式过滤器

关于video - 使用ffmpeg从mp4文件转换后如何获得具有透明背景填充的动画webp文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66144707/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com