In order to display video on the web properly and for further processing, both online and offline you require lots of video information. Video information is necessary both for web applications and desktop applications for its internal use.
You can use MediaHandlerPro component to get lots of video information from any video format. Information retrieved from video includes width, height, sampling rate, video bitrate, audio bitrate, video codec, audio code and others.
In Media Handler Pro version 4.0 or later video information is returned as VideoInfo Ojbect rather than string value which minimize code while parsing string output and decrease chances of errors.
You can also use MediaHandlerPro to check whether current video is in audio format or video format.
Media Handler Pro version 4.0 or later returns information as VideoInfo Ojbect.
MediaHandler _mhandler = new MediaHandler();
_mhandler.InputPath = RootPath + "\\contents\\videos";
_mhandler.FileName = "sample.mp4";
VideoInfo info = _mhandler.Get_Info();
// check for errors
if (info.ErrorCode > 0)
{
Response.Write("Video processing failed, Error code " + info.ErrorCode + " generated");
return;
}
// retrieve information for VideoInfo Object. Detail.
You can use Media Handler Pro version 3.0 to get useful information from video. Note for older version please view examples below.
MediaHandler _mhandler = new MediaHandler();
_mhandler.InputPath = RootPath + "\\contents\\videos";
_mhandler.FileName = "sample.mp4";
string file = _mhandler.isAudio();
if (file == "audio")
Response.Write("Current file is in audio format");
else
Response.Write("Current file is in video format");
MediaHandler _mhandler = new MediaHandler();
_mhandler.InputPath = RootPath + "\\contents\\videos";
_mhandler.FileName = "sample.mp4";
string file = _mhandler.Get_Info();
string[] _arrstr;
_arrstr = file.ToString().Split(char.Parse(","));
// Get Video Duration
string duration = _arrstr[0].Remove(0, _arrstr[0].IndexOf(":") + 1);
// You can get more video information by incrementing array value [0],[1], etc.
string file = _mhandler.is_Audio(filename, _ffmpegpath, InputPath);
if (file == "audio")
Response.Write("Current file is in audio format");
else
Response.Write("Current file is in video format");
string file = _mhandler.Get_Video_Information(filename, _ffmpegpath, InputPath);
string[] _arrstr;
_arrstr = file.ToString().Split(char.Parse(","));
// Get Video Duration
string duration = _arrstr[0].Remove(0, _arrstr[0].IndexOf(":") + 1);
// You can get more video information by incrementing array value [0],[1], etc.