
Public MP4 Video
Example code for publishing any format video to mp4 format utilizing asp.net video converter.
var _mhandler = new MediaHandler();
var RootPath = Server.MapPath(Request.ApplicationPath);
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
// setup input directory path where source video exist
_mhandler.InputPath = RootPath + "\\source";
// setup output directory path where published video will save
_mhandler.OutputPath = RootPath + "\\published";
_mhandler.FileName = "sample.avi";
_mhandler.OutputFileName = "sample";
_mhandler.OutputExtension = ".mp4";
// setup encoding preset. recommended to update with your required settings
_mhandler.Parameters = "-s 640x380 -c:v libx264 -preset medium
-crf 22 -b:v 500k -b:a 128k -profile:v baseline -level 3.1";
VideoInfo info = _mhandler.Process();
if(info.ErrorCode > 0) {
Response.Write("Video processing failed, Error code " + info.ErrorCode + " generated");
Response.Write(info.FFMPEGOutput);
return;
}
else {
Response.Write("Processing Successful");
}