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

Media Handler Pro support the following ways to join video clips in one video file.

  • Fast joining if all video clips in .mpg format and output is 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 image, resize output, customizing video output settings and more.

For latest codes and discussion please visit media handler pro discussion forum section

C# Sample Code

Sample c# code that uses Media Handler Pro component for joining two or more clips and encoding final output in any specified format.

MediaHandler _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();

Click here for detail about retrieving information from video

Error Codes

Various type of error codes may be returned while joing two or more video clips in one video. here is detail.

  • 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 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.
  • more detail