WMV, WMA Files

Windows Media Video (WMV) is the most recognized codec within the WMV family. While all versions of WMV support variable bit rate, average bit rate and constand bit rate.

Media Handler Pro can be used to create WMV and WMA video and audio files, view examples below or contact us for more help.

Example shown below is related with Media Handler Pro version 3.0.

Sample Code: Encode video to WMV Video

Sample code for encoding video to wmv video using Media Handler Pro version 3.0.
Using Encode_WMV() function

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

// optional output filename

_mhandler.OutputFileName = "sample.wmv";

// setting video related properties

_mhandler.Video_Bitrate = 786;
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 44100;

// generate highest quality mp4 video, note by making this option true, video bitrate will no longer work.

_mhandler.MaxQuality = true;

// optional video width and height settings

_mhandler.Width = 320;
_mhandler.Height = 240;

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

_mhandler.ACodec = "wmav1";
_mhandler.VCodec = "wmv1";

// posting watermark on wmv video, view detail in watermark section
_mhandler.WaterMarkPath = RootPath + "\\contents\\watermark";
_mhandler.WaterMarkImage = "watermark.gif";

// start processing video

string output = _mhandler.Encode_WMV();

// validate output with error codes in order to make sure wmv video is published successfully.

Sample Code: Encode video to WMA video

Sample code for encoding video to wma video using Media Handler Pro version 3.0.
Using Encode_M4V() function

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

// optional output filename

_mhandler.OutputFileName = "sample.wma";

// setting video related properties

_mhandler.Video_Bitrate = 786;
_mhandler.Audio_Bitrate = 64;
_mhandler.Audio_SamplingRate = 44100;

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

_mhandler.ACodec = "wmav1";
// start processing video

string output = _mhandler.Encode_WMA();

// validate output with error codes in order to make sure wma video is published successfully.

©2007 - 2008, MediaSoft Pro Inc  | Site Map