title: How to batch convert mp4 files to ogg with ffmpeg using a bash command or Ruby
body: <p>I am running a OSX, don't know tons about video conversions.  But I have like 200 videos that are all in mp4 format and won't play in Firefox.  I need to convert them to ogg to use the html5 video tag.</p>
  
  <p>These files live in a folder structure that makes it hard to do files one at a time.  I would like the bash command or Ruby command to go through all child folders and find all .mp4's and convert them.   </p>
  
  <p>I found one reference of how to do this with Google: <a href="http://athmasagar.wordpress.com/2011/05/12/a-bash-script-to-convert-mp4-files-to-oggogv/" rel="noreferrer">http://athmasagar.wordpress.com/2011/05/12/a-bash-script-to-convert-mp4-files-to-oggogv/</a></p>
  
  <pre><code>#!/bin/bash
  for f in $(ls *mp4 | sed ‘s/\(.*\)\..*/\1/’)
  do
  ffmpeg -i $f.mp4 -acodec vorbis -vcodec libtheora $f.ogg
  done
  </code></pre>
  
  <p>But have no idea how to convert this from linux to osx.</p>