MP3 Files

Media Handler Pro can be used to create the MP3 file as a way to store a single segment of audio, commonly a song, such that the file can be easily organized and transferred between computers or other devices such as MP3 Players.

Below is some sample code in c# that will help you to encode any video or audio file to mp3 audio file.

Sample Code - C#

Sample code for encoding video or audio file to mp3 audio using Media Handler Pro version 3.0 or later.
Using Encode_MP3() function

// Sample code for encoding any format video to mp3 format.
_mhandler.FFMPEGPath = HttpContext.Current.Server.MapPath("~\\ffmpeg\\ffmpeg.exe");
_mhandler.InputPath = RootPath + "\\contents\\video";
_mhandler.OutputPath = RootPath + "\\contents\\mp3";

_mhandler.FileName = "sample.mp4";

// optional output filename

_mhandler.OutputFileName = "sample.mp3";
_mhandler.Video_Bitrate = 192;
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 48000;

// view more options in component documentation.

// Encode MP3 audio using Media Handler Pro version 3.0

string output = _mhandler.Encode_MP3();

// Encode MP3 audio using Media Handler Pro version 4.0 or later

VideoInfo info = _mhandler.Encode_MP3();

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

©2007 - 2009, MediaSoft Pro Inc  | Site Map