MPG Video

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.

Sample Code: Encode video to MPG Video

Sample code for encoding video to .mpg video using Media Handler Pro version 3.0.
Using Encode_MPG() function default options

// 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";

// start processing video

string output = _mhandler.Encode_MPG();

// validate output with error codes in order to make sure mpg video is published successfully.

©2007 - 2008, MediaSoft Pro Inc  | Site Map