Media Handler Pro 5.0 or later support joining two or more video clips in one video file and encoding to desired video format in one step.
Media Handler Pro support the following ways to join video clips in one video file.
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();
if (info.ErrorCode > 0)
{
Response.Write("Error occured: Error Code: " + info.ErrorCode + "<br />Error Message: " + info.ErrorMessage);
return;
}
It may be possible that Media Handler Pro function Join_Videos() return error code if it encounter any error while processing request or settings. Some of main error codes that may be happen while joining videos.