Skip to main content

How to create a new file from multiple source files without reencoding?

Product: Video Edit SDK .Net. Engine: VideoEditCore (Windows only).

Sample code

Using our SDK, you can combine streams from several input files. For example, you can add an additional audio stream to the AVI file. Reencoding is not required if the output format is compatible with audio and video streams.

Create a streams list:

var streams = new List();

Add video stream. The ID is set to "v" to add the video stream.

streams.Add(new FFMPEGStream
{
Filename = "c:\\samples\\!video.avi",
ID = "v"
});

Add audio stream from mp3 file. The ID is set to "a" to add the audio stream. Must be "a" for audio files.

streams.Add(new FFMPEGStream
{
Filename = "c:\\samples\\!sophie.mp3",
ID = "a"
});

Add audio stream from another AVI file. The ID is set to "a" to add the audio stream from the video file.

streams.Add(new FFMPEGStream
{
Filename = "c:\\samples\\!video2.avi",
ID = "a"
});

The second parameter is "true" to set the duration of the output file to the shortest stream. If the video stream duration is bigger than the audio stream duration, you'll have problems seeking in some players.

VideoEdit1.FastEdit_MuxStreams(streams, true, outputFile);

Required redists

  • SDK redist
  • FFMPEG redist x86 x64

How can the required redists be installed or deployed to the user's PC?


Visit our GitHub page to get more code samples.