Join Videos using Media Handler Pro.

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.

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

Sample Code for Joining Video Clips (C# only)

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

 

Parameter Settings

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;
}

Error Codes For Joining Video Clips

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.

  • 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
 
©2007 - 2010, MediaSoft Pro Inc  | Site Map |  Privacy Policy