title: How to extract duration time from ffmpeg output?
body: <p>To get a lot of information about a media file one can do</p>
  
  <pre><code>ffmpeg -i &lt;filename&gt;
  </code></pre>
  
  <p>where it will output a lot of lines, one in particular</p>
  
  <pre><code>Duration: 00:08:07.98, start: 0.000000, bitrate: 2080 kb/s
  </code></pre>
  
  <p>I would like to output only <code>00:08:07.98</code>, so I try</p>
  
  <pre><code>ffmpeg -i file.mp4 | grep Duration| sed 's/Duration: \(.*\), start/\1/g'
  </code></pre>
  
  <p>But it prints everything, and not just the length.</p>
  
  <p>Even <code>ffmpeg -i file.mp4 | grep Duration</code> outputs everything.</p>
  
  <p>How do I get just the duration length?</p>