How to merge 2 video files together in C#?

ε祈祈猫儿з 提交于 2019-12-28 16:19:12

问题


I need to merge multiple video files (.wmv) together to get a single wmv file. How can I do it?


回答1:


You can do that easily Use Splicer, it free and open source in C#

Simplify developing applications for editing and encoding audio and video using DirectShow

Example:

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();
    }
}



回答2:


You can split and join video files using DirectShow or the Windows Media Encoder.

DirectShowNet library has examples which you might find useful. I think its called DESCombine.



来源:https://stackoverflow.com/questions/6890699/how-to-merge-2-video-files-together-in-c

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!