多个视频源组合成一个 [英] Multiple video sources combined into one
问题描述
我正在寻找一种有效的方式来执行以下操作:
I am looking for an efficient way to do the following:
使用几个源视频(大致相同的长度),我需要生成一个输出视频由所有原始来源组成,每个来源都在自己的区域运行(像一堆 PIP 几种不同的尺寸)。所以,最终的结果是所有的原始文件都并排运行,每个都在自己的区域/框中。
Using several source videos (of approximately the same length), I need to generate an output video that is composed of all of the original sources each running in its own area (like a bunch of PIPs in several different sizes). So, the end result is that all the original are running side-by-side, each in its own area/box.
源和输出需要是 flv
,我使用的平台是Windows(Windows 7 64位上的开发,部署到Windows Server 2008)。
The source and output need to be flv
and the platform I am using is Windows (dev on Windows 7 64bit, deployment to Windows server 2008).
I已查看 avisynth ,但不幸的是它无法处理 flv
而不是我已经尝试使用插件和flv分割器。
I have looked at avisynth but unfortunately it can't handle flv
and non of the plugins and flv splitters I have tried worked.
我目前的过程使用 ffmpeg 以下方式:
My current process uses ffmpeg in the following manner:
- 使用ffmpeg每个视频每秒生成25 png,根据需要调整原始大小。
- 使用
System.Drawing
命名空间将每组框架组合成一个新的图像,从静态背景开始,然后将每个框架加载到$ code>图像并绘制到背景图形
对象 - 这给了我的组合框架。 - 使用ffmpeg将生成的图像与视频相结合。
- Use ffmpeg to generate 25 png's per second per video, resizing the original as needed.
- Use the
System.Drawing
namespace to combine each set of frames into a new image, starting with a static background, then loading each frame into anImage
and drawing to the backgroundGraphics
object - this gives me the combined frames. - Use ffmpeg to combine the generated images to a video.
所有这些都是IO密集型(这是我的处理瓶颈在这一刻),我觉得必须有一个更有效的方式来实现我的目标。我没有太多的视频处理经验,不知道有什么选择。
All this is very IO intensive (which is my processing bottleneck at the moment) and I feel there must be a more efficient way to reach my goal. I do not have much experience with video processing, and don't know what options are out there.
任何人都可以提出更有效的处理方式吗?
Can anyone suggest a more efficient way of processing these?
推荐答案
在ffmpeg中执行所有操作。您可以使用视频过滤器进行许多操作。例如,并排连接两个视频:
Do everything inside ffmpeg. You can do a lot of things with video filters. For example to join two videos side by side:
ffmpeg -i input0.avi -vf "movie=input1.avi [in1]; [in]pad=640*2:352[in0]; [in0][in1] overlay=640:0 [out]" out.avi
@Oded:这基本上是这个命令所做的。您可以删除 pad
过滤器,并更改覆盖
过滤器的参数,以移动第二个视频。 p>
@Oded: That's basically what this command does. You can remove the pad
filter and change the parameters of overlay
filter to move the second video wherever you like.
ffmpeg -i big.avi -vf "movie=small.avi [small]; [in][small] overlay=10:10 [out]" out.avi
我提供的链接描述了过滤器语法。一起连接多个过滤器:
The link I provided describes the filter syntax. You can chain multiple filters together:
ffmpeg -i big.avi -vf "movie=small0.avi [small0]; [in][small0] overlay=10:10 [tmp];\
movie=small1.avi [small1]; [tmp][small1] overlay=30:10 [out]" out.avi
这篇关于多个视频源组合成一个的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!