Live Chat with Operator

3GP Video

ASP.NET Media Handler Pro can be use to encode any format video to .3gp foramt in order to play on mobile phones via quicktime player or any other compatible players.

Sample codes and detail about encoding or publishing videos to .3gp format is available below.

All examples available is compatible with ASP.NET Media Handler Pro version 3.0 or later. If you need more information conntact us.

Sample Code: 3GP Encoding Updated Code

Updated code for encoding 3gp video from any format video or from sequence of images. It requires asp.net media handler pro 5.2 or later and latest ffmpeg build.
3GP Encoding from other video formats using Process() method

_mhandler.FileName = "sample.wmv";
_mhandler.OutputFileName = "sample";
_mhandler.OutputExtension =".3gp";
_mhandler.VCodec= "h263";
_mhandler.ACodec="libopencore_amrnb";
_mhandler.Channel= 1;
_mhandler.Video_Bitrate=12.2;
_mhandler.Audio_Bitrate=8000;
_mhandler.FrameRate = 25;
_mhandler.Parameters = " -s qcif";
_mhandler.Process();

 

3GP Encoding from sequence of images using Process() method

_mhandler.FileName = "sample_%04d.jpg"; // e.g sample_0001.jpg
_mhandler.OutputFileName = "sample";
_mhandler.OutputExtension =".3gp";
_mhandler.VCodec= "h263";
_mhandler.ACodec="libopencore_amrnb";
_mhandler.Channel= 1;
_mhandler.Video_Bitrate=12.2;
_mhandler.Audio_Bitrate=8000;
_mhandler.FrameRate = 1; // decrease framerate to increase transition time between two images
_mhandler.Parameters = " -s qcif";
_mhandler.Process();

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


Sample Code: Encode video to 3gp format - C#

Sample code for encoding video to .3gp video using Media Handler Pro version 3.0.
Using Encode_3GP() function default options

// Sample code for encoding any format video to .3gp 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\\3gp";
_mhandler.FileName = "sample.mpg";

// optional output filename

_mhandler.OutputFileName = "sample.3gp";

// publish video to .3gp format with default options.

string output = _mhandler.Encode_3GP();

// this will generate .3gp video with default options. if you want to customize values then set values as shown below.

// setting video related properties

_mhandler.Video_Bitrate = 100;
_mhandler.Audio_Bitrate = 12.2;
_mhandler.Audio_SamplingRate = 8000;

// optional video width and height settings

_mhandler.Width = 176;
_mhandler.Height = 144;

// optional video and audio codec settings, make sure it is compatible with 3gp video otherwise result in failure of video encoding.

_mhandler.ACodec = "libamr_nb";
_mhandler.VCodec = "h263";

// view more options in component documentation.

// Encode 3GP Video using Media Handler Pro version 3.0

string output = _mhandler.Encode_3GP();

// Encode 3GP Video using Media Handler Pro version 4.0 or later

VideoInfo info = _mhandler.Encode_3GP();

// 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 - 2012, mediasoftpro.com  | Site Map | Privacy Policy | Terms of Use