如何在 C# 中将 2 个视频文件合并在一起? [英] How to merge 2 video files together in C#?

查看:19
本文介绍了如何在 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屋!

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