gpt4 book ai didi

video - 透明地将 mp4 转换为 webm?

转载 作者:行者123 更新时间:2023-11-28 21:40:37 26 4
gpt4 key购买 nike

我知道如何 convert mp4 to webm with ffmpeg :

ffmpeg -y -i me939371029.mp4 -r 30  out3.webm

但我想使用 webm transparency .该指南使用 Blender,但 Blender 是一种不容易自动化的桌面工具,只能输出必须转换为视频的 PNG。 我想要一个接受视频输入、颜色和视频输出的命令行应用。例如:

some-app -i video.mp4 -transparent ff0000 -o video.webm

如果 ffmpeg 中没有这样的东西,我会感到很惊讶,但我似乎找不到它。

最佳答案

假设要抠出的颜色是00ff00,使用

ffmpeg -i input.mp4 -c:v libvpx -vf "colorkey=0x00ff00:0.1:0.1,format=yuva420p" out.webm

colorkey=0x00ff00:0.1:0.1

部分由:分隔。第一部分是关键颜色。颜色

0x00ff00

是绿色的。

第二个是相似度

0.01 matches only the exact key color, while 1.0 matches everything.

第三个是混合百分比

0.0 makes pixels either fully transparent, or not transparent at all.

Higher values result in semi-transparent pixels, with a higher transparency the more similar the pixels color is to the key color.

参见 ffmpeg colorkey documentation


解决auto_alt_ref错误

当您遇到错误时说:使用 auto_alt_ref 的透明编码不起作用 Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - 可能不正确的参数,如比特率、速率、宽度或高度

您可以通过添加参数 -auto-alt-ref 0

来禁用 auto_alt_ref

关于video - 透明地将 mp4 转换为 webm?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34678964/

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