Convert MP4 files to OGV using ffmpeg on OS X
More and more commonly, I'm required to transcode various video files to browser friendly formats like OGV. One of the easiest ways to do this is through command line using ffmpeg.
When I first tried to do this on OS X, I ran into a few dependency issues. Below, I'll outline the installation process that got it working for me.
The first thing to do is install Homebrew if you haven't already:
$ ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"
Next, using Homebrew, install ffmpeg with the appropriate libraries. If you need additional libraries down the road, I believe you have to uninstall ffmpeg and then reinstall it with the approriate flags.
$ brew install ffmpeg \
--with-freetype \
--with-theora \
--with-libvorbis \
--with-libvpx \
--with-rtpdump \
--with-opencore-amr \
--with-libvo-aacenc \
--with-libass \
--with-openjpeg \
--with-schroedinger \
--with-ffplay \
--with-tools \
--with-fdk-aac \
--with-openssl \
--with-opus
Hopefully, it installed without any issues. Now, when you're ready to convert an MP4 file to OGV you can use the following command:
# example video conversion
# audio bitrate: 128k
# video bitrate: 1200k
# width: 730px
# height: 525px
ffmpeg -i inputFile.mp4 -acodec libvorbis -ac 2 -ab 128k -ar 44100 -b:v 1200k -s 730x525 outputFile.ogv