title: It's possible to catch ffmpeg errors with python?
body: <p>Hi I'm trying to make a video converter for django with python, I forked <a href="https://github.com/PixxxeL/django-ffmpeg" rel="nofollow noreferrer">django-ffmpeg</a> module which does almost everything I want, except that doesn't catch error if conversion failed.</p>
  
  <p>Basically the module passes to the command line interface the ffmpeg command to make the conversion like this: </p>
  
  <blockquote>
    <p>/usr/bin/ffmpeg -hide_banner -nostats -i %(input_file)s -target
    film-dvd %(output_file)</p>
  </blockquote>
  
  <p>Module uses this method to pass the ffmpeg command to cli and get the output:</p>
  
  <pre><code>def _cli(self, cmd, without_output=False):
      print 'cli'
      if os.name == 'posix':
          import commands
          return commands.getoutput(cmd)
      else:
          import subprocess
          if without_output:
              DEVNULL = open(os.devnull, 'wb')
              subprocess.Popen(cmd, stdout=DEVNULL, stderr=DEVNULL)
          else:
              p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
              return p.stdout.read()
  </code></pre>
  
  <p>But for example, I you upload an corrupted video file it only returns the ffmpeg message printed on the cli, but nothing is triggered to know that something failed</p>
  
  <p>This is an ffmpeg sample output when conversion failed:</p>
  
  <blockquote>
    <p>[mov,mp4,m4a,3gp,3g2,mj2 @ 0x237d500] Format mov,mp4,m4a,3gp,3g2,mj2
    detected only with low score of 1, misdetection possible!
    [mov,mp4,m4a,3gp,3g2,mj2 @ 0x237d500] moov atom not found
    /home/user/PycharmProjects/videotest/media/videos/orig/270f412927f3405aba041265725cdf6b.mp4:
    Invalid data found when processing input</p>
  </blockquote>
  
  <p>I was wondering if there's any way to make that an exception and how, so I can handle it easy. </p>
  
  <p>The only option that came to my mind is to search: "Invalid data found when processing input" in the cli output message string but I'm not shure that if this is the best approach. Anyone can help me and guide me with this please.</p>