Join Videos

Join Videos

This tutorial will help you join two or more video clips in one video using media handler pro in your asp.net, c#, and vb.net application.

ASP.NET Video Converter supports the following ways to join video clips in one video file.

  • Fast joining if all video clips in .mpg format and output are also in .mpg format.
  • Join two or more different format video clips, join and output in any video format. e.g video clips like sample_01.mp4, sample_02.wmv, sample_03.mpg, and final output like sample_full.avi.
  • Customizing final output like posting watermark images, resize output, customizing video output settings, and more.

C# Sample Code

Sample c# code that uses ASP.NET Video Converter component for joining two or more clips and encoding final output in any specified format.


var _mhandler = new MediaHandler();
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg1371\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\videoclips";
_mhandler.OutputPath = RootPath + "\\contents\\finalvideos";
// Pass two or more video clip names through FileNames property.
_mhandler.FileNames = new string[] { "sample_01.mp4", "sample_02.mp4" };
// Set final output filename through OutputFileName property, it may be without extension.
_mhandler.OutputFileName = "full_video";
// Set final output extension e.g ".avi" will force output in .avi format.
_mhandler.OutputExtension = ".avi";
// Set width and height of final output.
_mhandler.Width = 320;
_mhandler.Height = 240;
// Set all settings that is required for encoding final output. e.g in case of .avi we set TargetFileType.
_mhandler.TargetFileType = "pal-vcd";
// Call join video function to process all settings and create output media.
VideoInfo info = _mhandler.Join_Videos();

Error Codes

Various types of error codes may be returned while joining two or more video clips in one video.

  • 138 - > Join Video: Please specify filenames.
  • 139 - > Join Video: Input file path validation failed, please make sure that all joining clips/files must be located in the input path directory.
  • 140 - > Join Video: Must specify output media type (This.OutputExtension)
  • 141 - > Join Video: Output File Name must specifiy, e.g "sample.avi" or "sample", extension will skip if specified.
  • 142 - > Join Video: Failed to create temp mpg files for attaching videos.
  • 143 - > Join Video: Must contain two or more clips.