|
|
|
รบกวนสอบถามการ Upload ไฟล์วีดีโอ หาค่าความยาวเวลาของไฟล์คลิป ASP.Net |
|
|
|
|
|
|
|
ลองใช้ ffmpeg ครับ เช่น
Code (C#)
public string f_VideoDuration((add path)parameters)
{
try
{
string sInputVideo = Page.MapPath(add path);
string sPath = " -i " + sInputVideo ;
Process ffmepg = new Process();
ffmepg.StartInfo.FileName = (Server.MapPath(ffmpeg.exe"));
ffmepg.StartInfo.UseShellExecute = false;
ffmepg.StartInfo.RedirectStandardOutput = true;
ffmepg.StartInfo.RedirectStandardError = true;
ffmepg.StartInfo.CreateNoWindow = true;
ffmepg.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
ffmepg.StartInfo.Arguments = sPath;
ffmepg.EnableRaisingEvents = true;
ffmepg.Start();
string sDuration = ffmepg.StandardError.ReadToEnd().ToString();
ffmepg.Close();
ffmepg.Dispose();
sDuration = sDuration.Remove(0, sDuration.LastIndexOf("Duration: ") + 10);
sDuration = sDuration.Substring(0, sDuration.IndexOf(","));
return sDuration;
}
catch (Exception ex)
{
throw (ex);
}
}
|
|
|
|
|
Date :
2014-02-18 17:38:15 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|