使用ffmpeg垂直或水平堆叠(马赛克)几个视频? [英] Vertically or horizontally stack (mosaic) several videos using ffmpeg?

查看:24
本文介绍了使用ffmpeg垂直或水平堆叠(马赛克)几个视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个完全相同长度的视频,我想使用 ffmpeg 将它们堆叠成一个视频文件.

I have two videos of the same exact length, and I would like to use ffmpeg to stack them into one video file.

我该怎么做?

推荐答案

请参阅此问题的此答案以获得更新,更简单的方法.

See this answer to this question for a newer, simpler way to do this.

旧版本:
您应该可以使用 pad电影overlay 过滤器.该命令将如下所示:

Old version:
You should be able to do this using the pad, movie and overlay filters in FFmpeg. The command will look something like this:

ffmpeg -i top.mov -vf 'pad=iw:2*ih [top]; movie=bottom.mov [bottom]; 
  [top][bottom] overlay=0:main_h/2' stacked.mov

首先,应该在顶部的电影被填充到两倍的高度.然后加载底部的电影.然后底部电影叠加在填充的顶部电影上,偏移量是填充电影高度的一半.

First the movie that should be on top is padded to twice its height. Then the bottom movie is loaded. Then the bottom movie is overlaid on the padded top movie at an offset of half the padded movie's height.

这篇关于使用ffmpeg垂直或水平堆叠(马赛克)几个视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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