如何使用 ffmpeg 删除徽标过滤器

Zai*_*Ali 3 ffmpeg image-processing

我正在尝试使用 ffmpeg removelogo过滤器,没有语法错误,但结果有某种奇怪的洋红色三角形,其中应用了掩码。

我正在使用以下命令

ffmpeg -y -i sample_image.jpg -vf "removelogo=mask.png" test.jpg 
Run Code Online (Sandbox Code Playgroud)

这是命令中使用的文件。

样本图像.jpg 面具.png 测试.jpg

llo*_*gan 6

这是过滤器的限制。删除徽标过滤器使用相邻像素来填充包含徽标的区域。您的蒙版延伸到图像的最边缘,不留下任何相邻像素。为了获得最佳效果,您需要留一些空间。

由于徽标通常不会延伸到图像的边缘,如果使用removelogo删除实际徽标并从边缘留出足够的空间,那么您将不会遇到此问题。

Alternatively, if you must extend to the edge you could try the delogo filter instead, but it won't let you use an arbitrary mask; only rectangular coordinates. Or use a combination of pad, fillborders, and crop, but results may not be satisfactory (I didn't try).

在此输入图像描述 在此输入图像描述
Original with ugly logo and "bird shit" mask with sufficient padding from edge.

在此输入图像描述
Result of removelogo filter.