title: Extract the middle frame of a video in Python using ffmpeg?
body: <p>I have a collection of video files for which I'd like to generate thumbnails. How can I extract the middle frame of the video in Python?</p>
  
  <p>If I execute:</p>
  
  <pre><code>ffmpeg -i /tmp/0.mts
  </code></pre>
  
  <p>I get a line returned to the shell that says:</p>
  
  <pre><code>Duration: 00:00:04.49, start: 1.016689, bitrate: 25234 kb/s
  </code></pre>
  
  <p>Maybe I could extract the timestamp after the duration and somehow divide that by 2 to get the middle frame timestamp, and extract that?</p>
  
  <p>If I'm recursing through a large collection of videos, is there a way to keep ffmpeg "open" without the overhead of opening/closing it to identify each file?</p>