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

查看:271
本文介绍了使用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 重叠过滤器.该命令将如下所示:

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天全站免登陆