This page provide media handler pro sample codes which will help you in publishing avi format videos from other formats in your asp.net, c# and vb.net applications.

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

C# Sample Code

Sample code for encoding video to .avi video using asp.net media handler pro component.

Sample code for encoding video to .avi video using Media Handler Pro. You can use either Encode_AVI() special function with builtin options or you can use Process() general function to publish videos to avi format. We recommend using Process() function as it provide much more flexibility and freedom to use your own custom options.

// Sample code for encoding any format video to avi format.
MediaHandler _mhandler = new MediaHandler();
// required properties
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\video";
_mhandler.OutputPath = RootPath + "\\contents\\avi";
_mhandler.FileName = "sample.mpg";
// optional output filename
_mhandler.OutputFileName = "sample.avi";
// loading automatic video and audio settings for avi video.
view detail about TargetFileType in documentation.
_mhandler.TargetFileType = "pal-vcd";
// optional video width and height settings
_mhandler.Width = 320;
_mhandler.Height = 240;
// posting watermark on avi video, view detail in watermark
section
_mhandler.WaterMarkPath = RootPath + "\\contents\\watermark";
_mhandler.WaterMarkImage = "watermark.gif";
// Encode AVI Video using Media Handler Pro version 3.0
string output = _mhandler.Encode_AVI();
// Encode AVI Video using Media Handler Pro version 4.0 or later
VideoInfo info = _mhandler.Encode_AVI();
// Check for errors 
if (info.ErrorCode > 0)
{
Response.Write("Video processing failed, Error code " + info.ErrorCode+ " generated");
return;
}

Click here for detail about retrieving information from video