using Microsoft.DirectX.AudioVideoPlayback;
Video vvideo = new Video(FileUpload.FileName.ToString());
StringBuilder sb = new StringBuilder();
sb.Append(duration.toString());
error message;
“Installed an access attempt was made to the application domain.”
“vvideo” instance is created error msj ://
But down found cods I found a working code in c #. but asp.net does not work
string file1 = "c://ds.mpeg"
IMediaPosition m_objMediaPosition = null;
FilgraphManager m_objFilterGraph = new FilgraphManager();
m_objFilterGraph.RenderFile(filename);
m_objMediaPosition = m_objFilterGraph as IMediaPosition;
int s = (int)m_objMediaPosition.Duration;
int h = s / 3600;
int m = (s - (h * 3600)) / 60;
s = s - (h * 3600 + m * 60);
I DON'T TAKE VIDEO DURATION BOYS :/
I make Function everywhere it uses ;)
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);
}
}