title: Getting FFProbe Information With Python
body: <p>I've been attempting to figure this out for forever now (I'm new to programming) and I can't figure it out.</p>
  
  <p>I'm attempting to build a script that will test the file, and give me output from which I can get information like "Audio Format" that I can then put into the filename.  However, I can't even get the script to return any file info.  I've hit a wall at inserting an input file...</p>
  
  <p>So at this point I just need help getting it to spit out info based on the argvs I've thrown in.  Hopefully I'll be able to figure out how to parse the audio info from that.</p>
  
  <p>My attempt that seems to be close:</p>
  
  <pre><code>#!/usr/bin/python
  import os, sys, subprocess, shlex, re
  from subprocess import call
  def probe_file(filename):
      p = subprocess.Popen(['/opt/local/bin/ffprobe', '-show_format', '-pretty', '-loglevel quiet', -i filename], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
      print filename
      print p.communicate()
  [probe_file (f) for f in os.listdir('.') if not f.startswith('.')]
  </code></pre>