Media Handler Pro 5.0 or later support using preset files for encoding videos with x264 codec. You can use lots of predefined preset files for mp4 / x264 encoding to achieve best results.
Preset File:
A preset file contains a sequence of option=value pairs, one for each line, specifying a sequence of options which would be awkward to specify on the command line.
Check the `ffpresets' directory in the FFmpeg source tree or download preset files directly from here.
Preset files are categorize with
Also make sure that you must use latest ffmpeg build that support ffpreset or preset files.
Some of preset files supported by ffmpeg build rev 22598 are as follows
Sample c# code that uses Media Handler Pro component for encoding mp4 video with x264 codec using preset file mentioned above.
MediaHandler _mhandler = new MediaHandler();
string RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\source";
_mhandler.OutputPath = RootPath + "\\contents\\output";
// set ffpreset file mentioned above using media handler pro property PresetPath.
_mhandler.PresetPath = RootPath + "\\ffmpeg\\ffpresets\\libx264-veryfast_firstpass.ffpreset";
// set mp4 related required properties.
_mhandler.FileName = "Sample.VOB";
_mhandler.OutputFileName = "Sample.mp4";
// Set width and height of final output.
_mhandler.Width = 320;
_mhandler.Height = 240;
// Call method to process parameters
VideoInfo info = _mhandler.Encode_MP4();
if (info.ErrorCode > 0)
{
Response.Write("Error occured: Error Code: " + info.ErrorCode + "<br />Error Message: " + info.ErrorMessage);
return;
}