ffmpeg从图像创建gif,在创建过程中添加水印? [英] ffmpeg creating gif from images, add watermark during creation?

查看:628
本文介绍了ffmpeg从图像创建gif,在创建过程中添加水印?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从一系列静态png中成功创建动画。我还想添加一个水印,但是当尝试添加水印源时,我有一些问题。



使用此功能可以生成动画:

  ffmpeg -v warning -framerate 4 -i /tmp/img-%d.png -i /tmp/img-palette.png -lavfi paletteuse-y -loop 0 -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4 

当我添加以下内容以指定水印源(透明png)时,会生成错误:

  -i / tmp /logo.png -filter_complexoverlay = x =(main_w-100):( main_h-50)

完整命令:

  ffmpeg -v warning -framerate 4 -i /tmp/logo.png -filter_complexoverlay = x =(main_w-100):( main_h-50)-i /tmp/img-%d.png -i /tmp/img-palette.png -lavfipaletteuse-y -loop 0 -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4 

错误:

 视频:1kB音频:0kB字幕:0kB其他流:0kB全局头文件:0kB复用开销:未知

我需要生成动画首先,然后将水印应用于该工件,或者是否在创建过程中将所有内容组合在一起?

解决方案

使用

  ffmpeg -v warning -framerate 4 -i /tmp/img-%d.png -i / tmp / img-palette .png -i /tmp/logo.png -filter_complex[0] [2] overlay = x =(main_w-100):( main_h-50)[v]; [v] [1] paletteuse-y -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4 

预先指定所有输入。您只能指定一个filter_complex。 -lavfi filter_complex 的别名。


I'm successfully creating animations from a series of static png's. I also want to add a watermark, but I'm having some issues when trying to add the watermark source.

Using this generates the animations fine:

ffmpeg -v warning -framerate 4 -i /tmp/img-%d.png -i /tmp/img-palette.png -lavfi "paletteuse" -y -loop 0 -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4

When I add the following to specify the watermark source (transparent png) an error is generated:

-i /tmp/logo.png -filter_complex "overlay=x=(main_w-100):(main_h-50)"

Full command:

ffmpeg -v warning -framerate 4 -i /tmp/logo.png -filter_complex "overlay=x=(main_w-100):(main_h-50)" -i /tmp/img-%d.png -i /tmp/img-palette.png -lavfi "paletteuse" -y -loop 0 -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4

Error:

video:1kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

Do I need to generate the animation first, then apply the watermark to that artifact or is there a way to combine everything together during the creation process?

解决方案

Use

ffmpeg -v warning -framerate 4 -i /tmp/img-%d.png -i /tmp/img-palette.png -i /tmp/logo.png -filter_complex "[0][2]overlay=x=(main_w-100):(main_h-50)[v];[v][1]paletteuse" -y -vcodec libx264 -crf 25 -pix_fmt yuv420p -hide_banner /tmp/output.mp4

Specify all inputs upfront. You can only specify one filter_complex. -lavfi is an alias for filter_complex.

这篇关于ffmpeg从图像创建gif,在创建过程中添加水印?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆