title: Detecting program errors in bash scripts?
body: <p>I'm trying to write my first semi advanced bash script that will take input in the form of a filename referring to an <code>avi</code> video, send it to <code>ffmpeg</code> to convert to a <code>mp4</code> (preserving the original name) and then hand it off to <code>MP4Box</code>.</p>
  
  <p>The below is pretty much what I'm doing...</p>
  
  <pre><code>#!/usr/bin/bash
  ffmpeg -i $0 -acodec libfaac -ab 128k -ac 2 -vcodec libx264 -vpre hq -crf 22 -threads 0 ($0).mp4
  MP4Box -inter 500 ($0).mp4
  </code></pre>
  
  <ul>
  <li>Is there some sort of try/catch I can do for the first program invocation to make sure MP4Box gets workable input? </li>
  <li>Should I even bother with error catching at all, should I instead rely on the programs themselves to do this for me?</li>
  </ul>