How two merge two files using Expression Encoder 4 sdk

2.2k views Asked by At

I'm doing an application in VSExpress10 using Expression Encoder 4 sdk, wherein I take 2 video files as input and need to produce a single file merging the both. When I add both files to Job class' MediaItems entity, both the files are encoded separately. Is there a way I could merge these files and produce a single file?

1

There are 1 answers

1
JettK On

Sure. You can do something along these lines.

Let's say you have video1.avi and video2.avi; let's further say that they're in the same directory. To put the two together, with video1 followed by video2, you'd do something like:

string pathTo = @"C:\videos\";
MediaItem mergedVideo = new MediaItem(pathTo + "video1.avi");
mergedVideo.Sources.Add(new Source(pathTo + "video2.avi");
//--And you can keep doing this for more videos like below:
//mergedVideo.Sources.Add(new Source(pathTo + "video3.avi");

//Then just encode the job to get a single video of the two sub-videos
job.MediaItems.Add(mergedVideo);
job.Encode();