多个视频源合二为一
我正在寻找一种有效的方法来执行以下操作:
使用多个源视频(长度大致相同),我需要生成一个输出视频,该输出视频由所有原始源组成,每个原始源都在自己的区域中运行(就像一堆多种不同尺寸的 PIP)。因此,最终结果是所有原始文件都并排运行,每个文件都在自己的区域/框中。
源和输出需要是 flv
并且我使用的平台是 Windows(在 Windows 7 64 位上开发,部署到 Windows Server 2008)。
我看过 avisynth 但不幸的是它无法处理 flv
并且没有插件和 flv 分割器我已经尝试过工作了。
我当前的流程按以下方式使用 ffmpeg:
- 使用 ffmpeg 为每个视频每秒生成 25 个 png,根据需要调整原始大小。
- 使用
System.Drawing
命名空间将每组帧组合成一个新图像,从静态背景开始,然后将每个帧加载到Image
中并绘制到背景< code>Graphics 对象 - 这给了我组合的框架。 - 使用 ffmpeg 将生成的图像合并到视频中。
所有这些都是 IO 密集型的(这是我目前的处理瓶颈),我觉得必须有一种更有效的方法来实现我的目标。我在视频处理方面没有太多经验,也不知道有哪些选择。
谁能建议一种更有效的处理这些的方法?
I am looking for an efficient way to do the following:
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.
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 have looked at avisynth but unfortunately it can't handle flv
and non of the plugins and flv splitters I have tried worked.
My current process uses ffmpeg in the following manner:
- 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.
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在 ffmpeg 中完成所有操作。您可以使用视频过滤器做很多事情。例如,并排加入两个视频:
@Oded:这基本上就是此命令的作用。您可以删除
pad
过滤器并更改overlay
过滤器的参数,将第二个视频移动到您想要的任何位置。我提供的链接描述了过滤器语法。您可以将多个过滤器链接在一起:
Do everything inside ffmpeg. You can do a lot of things with video filters. For example to join two videos side by side:
@Oded: That's basically what this command does. You can remove the
pad
filter and change the parameters ofoverlay
filter to move the second video wherever you like.The link I provided describes the filter syntax. You can chain multiple filters together: