FFMPEG Commands

This post will help you process almost every type of custom ffmpeg commands using media handler pro in your asp.net, c# and vb.net applications.

If you want more information, please contact us.


Sample Codes

Example: Translating and processing sample ffmpeg command using asp.net media handler pro component.

e.g sample ffmpeg command for encoding a video sequence for the iPpod/iPhone
ffmpeg -i source_video.avi  -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X final_video.mp4
********************************************************************
_mhandler.FileName = "source_video.avi";
_mhandler.OutputFileName = "final_video";
_mhandler.OutputExtension=".mp4";
_mhandler.ACodec = "aac";
_mhandler.Audio_Bitrate = 128;
_mhandler.VCodec = "mpeg4";
_mhandler.Video_Bitrate = 1200;
_mhandler.Parameters = "-mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -title X";
_mhandler.Width = 320;
_mhandler.Height= 180;
********************************************************************
VideoInfo info = _mhandler.Process();
if (info.ErrorCode > 0)
{
	Response.Write("Error occured: Error Code: " + info.ErrorCode + "<br />Error Message: " + info.ErrorMessage);
	return;
}

You can pass almost all ffmpeg commands via media handler pro parameters object e.g

_mhandler.Parameters = "source_video.avi  -acodec aac -ab 128kb -vcodec mpeg4 -b 1200kb -mbd 2 -flags +4mv+trell -aic 2 -cmp 2 -subcmp 2 -s 320x180 -title X final_video.mp4";
VideoInfo info = _mhandler.Process();
if (info.ErrorCode > 0)
{
	Response.Write("Error occured: Error Code: " + info.ErrorCode + "<br />Error Message: " + info.ErrorMessage);
	return;
}
    

You must make sure your ffmpeg command supported by your ffmpeg build you are using in your application.

You must provide complete path for input media file, source media file and any presets used.