title: How to get the video duration using FFMPEG in C# asp.net
body: <p>I want to get the video file duration in string using C#. I searched the internet and all i get is:</p>
  
  <pre><code>ffmpeg -i inputfile.avi
  </code></pre>
  
  <p>And every1 say that parse the output for duration.</p>
  
  <p>Here is my code which is </p>
  
  <pre><code>string filargs = "-y -i " + inputavi + " -ar 22050 " + outputflv;
      Process proc;
      proc = new Process();
      proc.StartInfo.FileName = spath;
      proc.StartInfo.Arguments = filargs;
      proc.StartInfo.UseShellExecute = false;
      proc.StartInfo.CreateNoWindow = false;
      proc.StartInfo.RedirectStandardOutput = false;
      try
      {
          proc.Start();
  
      }
      catch (Exception ex)
      {
          Response.Write(ex.Message);
      }
  
      try
      {
          proc.WaitForExit(50 * 1000);
      }
      catch (Exception ex)
      { }
      finally
      {
          proc.Close();
      }
  </code></pre>
  
  <p>Now please tell me how can i save the output string and parse it for the video duration.</p>
  
  <p>Thanks and regards,</p>