FFMPEG:图像/视频的色度键/绿屏过滤器 [英] FFMPEG: chroma key / greenscreen filter for images / video
问题描述
我需要一个视频使用色度键过滤器/绿屏过滤器并将其覆盖在另一个视频上并将其作为新视频输出.
I need for a video to use chroma key filter / greenscreen filter and overlay it over another video and output it as new video.
是否有任何用于此目的的现有库、脚本、过滤器或解决方案?
Are there any existing libraries, scripts, filters or solutions for this purpose?
推荐答案
答案(现在)是肯定的,有一个过滤器用于生成色度键并覆盖它们.过滤器名称是颜色键".网站上有例子,命令如下:
The answer (now) is yes, there is a filter for generating chroma-keys and overlaying them. The filter name is "color key". There are examples on the site, here's the command:
ffmpeg -i <base-video> -i <overlay-video> -filter_complex '[1:v]colorkey=0x<color>:<similarity>:<blend>[ckout];[0:v][ckout]overlay[out]' -map '[out]' <output-file>
其中
是要以十六进制匹配的 rgb 颜色(例如:0x000000 表示黑色),
是颜色匹配的容差(ex: 0.3) 和
(ex: 0.2) 控制不透明度是开-关还是渐变的.(有关更多信息,请参阅文档).
where <color>
is the rgb color to match in hex (ex: 0x000000 for black), <similarity>
is a tolerance on the color-match (ex: 0.3), and <blend>
(ex: 0.2) controls whether the opacity is on-off or how gradual it is. (See the documentation for more).
这篇关于FFMPEG:图像/视频的色度键/绿屏过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!