Media Handler Pro can be used to create MPG video files. View examples below or contact us for more help.
Example shown below is related with Media Handler Pro version 3.0 or later.
// Sample code for encoding any format video to mpg 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\\mpg";
_mhandler.FileName = "sample.mp4";
// optional output filename
_mhandler.OutputFileName = "sample.mpg";
// 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 mpg video, view detail in watermark section
_mhandler.WaterMarkPath = RootPath + "\\contents\\watermark";
_mhandler.WaterMarkImage = "watermark.gif";
// Encode video to FLV format in Media Handler Pro version 3.0
string output = _mhandler.Encode_MPG();
// Encode Video to MPG format in Media Handler Pro version 4.0 or later
VideoInfo info = _mhandler.Encode_MPG();
// Check for errors
if (info.ErrorCode > 0)
{
Response.Write("Video processing failed, Error code " + info.ErrorCode + " generated");
return;
}
// Retrieve output information from VideoInfo Object. View Detail