FFMPEG:在视频上叠加图像并保留大小 [英] FFMPEG : overlay image on video and retain size

查看:215
本文介绍了FFMPEG:在视频上叠加图像并保留大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在视频的顶部"叠加图像(中间有形状的透明背景),然后重新获得图像.图像尺寸大于视频尺寸.这是我正在使用的命令:

I'm trying to overlay an image (transparent background with shape in the middle) "on top" of the video and get the image back. The image size is bigger then the video. Here is the command that I'm using:

"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[1:v][0:v]scale2ref=iw:ih[ovr][base];[ovr]colorchannelmixer=aa=1.0[ovrl];[base][ovrl]overlay[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"

以上内容将图像缩放为视频的大小.

The above scales the image to the size of the video.

我希望图像和视频保留其大小,并输出2个重叠的图像.

I want the image and the video to retain their size and output an image of the 2 overlaid.

有人可以给我一些建议吗?

Can someone please give me advice on how I can do this?

推荐答案

跳过scale2ref.

Skip the scale2ref.

"-i", video.mp4, "-i", image.mp4, "-filter_complex", "[0:v]pad=iw:2*trunc(iw*16/9/2):(ow-iw)/2:(oh-ih)/2[v0];[1:v][v0]scale2ref[v1][v0];[v0][v1]overlay=x=(W-w)/2:y=(H-h)/2[v]", "-map", "[v]", "-q:v", "2", directoryToStore + "/" + ImageName + ".jpeg"

这篇关于FFMPEG:在视频上叠加图像并保留大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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