1

使用 C#,

如何使用 DrirectShow 连接两个视频文件(.avi 文件)..?请帮忙!

以下代码仅用于解释问题...

VideoSpanCollection newList = new VideoSpanCollection();
        int j;
        for(int i=0; i<oldItems.Count; i = j)
        {
            for(j=i+1;
                j<oldItems.Count && 
                oldItems[j].File.FullName == oldItems[j-1].File.FullName &&
                Math.Abs(oldItems[j].StartPosition - oldItems[j-1].StopPosition) < 0.5;
                j++);

            VideoSpan newSpan = new VideoSpan();
            newSpan.File = oldItems[i].File;
            newSpan.StartPosition = oldItems[i].StartPosition;
            newSpan.StopPosition = oldItems[j-1].StopPosition;
            AddSpanToListView(newSpan, -1);
        }
4

1 回答 1

2

There is no standard/universal way to, not to mention that they have to be of compatible formats.

In DirectShow you need either custom filter that stream from 2+ sources and route data into recording leg of the pipeline, updating time stamps on the way.

DirectShow Editing Services (DES) might be of some help though it might re-compress the output while rendering the target file. Good news DES is also covered by DirectShow.NET and provides you with sample code to combine video and audio into single output file.

Samples\Editing\DESCombine
--------------------------
A class library that uses DirectShow Editing Services to combine video and audio 
files (or pieces of files) into a single output file.  A help file (DESCombine.chm) 
is provided for using the class.
于 2013-01-13T08:24:01.527 回答