title: How do I use ffmpeg with Python by passing File Objects (instead of locations to files on disk)
body: <p>I'm trying to use ffmpeg with Python's subprocess module to convert some audio files. I grab the audio files from a URL and would like to just be able to pass the Python File Objects to ffmpeg, instead of first saving them to disk. It would also be very nice if I could just get back a file stream instead of having ffmpeg save the output to a file.</p>
  
  <p>For reference, this is what I'm doing now:</p>
  
  <pre><code>tmp = "/dev/shm"
  audio_wav_file = requests.get(audio_url)
  ##              ##                         ##
  ## This is what I don't want to have to do ##
  wavfile = open(tmp+filename, 'wrb')   
  wavfile.write(audio_wav_file.content)
  wavfile.close()
  ##              ##                         ##
  conversion = subprocess.Popen('ffmpeg -i "'+tmp+filename+'" -y "'+tmp+filename_noext+'.flac" 2&gt;&amp;1', shell = True, stdout = subprocess.PIPE).stdout.read()
  </code></pre>
  
  <p>Does anyone know how to do this?</p>
  
  <p>Thanks!</p>