title: Extending a script to loop over multiple files and generate output names
body: <p>I have following script (named vid2gif.sh) to convert a video file to gif: </p>
  
  <pre><code>#! /bin/bash
  ffmpeg -i $1 /tmp/gif/out%04d.gif
  gifsicle --delay=10 --loop /tmp/gif/*.gif &gt; $2
  </code></pre>
  
  <p>I can convert a file using command: </p>
  
  <pre><code>vid2gif.sh myvid.mp4 myvid.gif
  </code></pre>
  
  <p>How can I make it to convert all mp4 files in a folder? That is, how can I make following command work:</p>
  
  <pre><code>vid2gif.sh *.mp4
  </code></pre>
  
  <p>The script should output files as *.gif. Thanks for your help. </p>