如何在C#中将2个视频文件合并在一起? [英] How to merge 2 video files together in C#?
本文介绍了如何在C#中将2个视频文件合并在一起?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要将多个视频文件(.wmv)合并在一起,以获得单个wmv文件. 我该怎么办?
I need to merge multiple video files (.wmv) together to get a single wmv file. How can I do it?
推荐答案
您可以轻松地使用 Splicer ,它在C#中免费开放源代码
You can do that easily Use Splicer, it free and open source in C#
简化使用DirectShow编辑和编码音频和视频的开发应用程序
Simplify developing applications for editing and encoding audio and video using DirectShow
示例:
using Splicer;
using Splicer.Timeline;
using Splicer.Renderer;
string firstVideoFilePath = @"C:\first.avi";
string secondVideoFilePath = @"C:\second.avi";
string outputVideoPath = @"C:\output.avi";
using (ITimeline timeline = new DefaultTimeline())
{
IGroup group = timeline.AddVideoGroup(32, 720, 576);
var firstVideoClip = group.AddTrack().AddVideo(firstVideoFilePath);
var secondVideoClip = group.AddTrack().AddVideo(secondVideoFilePath, firstVideoClip.Duration);
using (AviFileRenderer renderer = new AviFileRenderer(timeline, outputVideoPath))
{
renderer.Render();
}
}
这篇关于如何在C#中将2个视频文件合并在一起?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文