Thursday, 23 December 2010

Building FFMPEG on Mac OSX Snow Leopard

FFMPEG is an amazing set of video and audio conversion tools, accessible via the command-line. It's rather fiddly to use, but being a command-line program it can be easily integrated into your server-side tools. The sequence of steps below worked perfectly for me on Snow Leopard with XCode 3.2.4 installed.

cd ~
# checkout the latest version of the source
svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg

# enable mp3 support (you need to install lame first. omit --enable-libmp3lame to build without it)
./configure --enable-libmp3lame --enable-shared --disable-mmx --arch=x86_64

# compile
make

# install
sudo make install



Example Commands


Here are some of the commands I've run so far..

Rotate a video 90 degrees clockwise (good for films shot in portrait


ffmpeg -vf "transpose=1" -i input.mp4 output.mp4

Note that there are many tutorials on the web that suggest you should use --vfilter "rotate=90" to rotate a video. This no longer works, as vfilters has been renamed vf, and the rotate option has been removed. As of Dec 2010, the above command does work.

Convert a mp3 to a flv audio file


ffmpeg -y -i myfile.mp3 -f flv -acodec libmp3lame -ab 64 -ac 1 myfile.flv

I'm using this command as part of a project I'm working on, flv is better than mp3 as you can stream (using flowplayer) an flv in such a way that user can jump around to any point of the audio without needing to download it all to that point. However, this is quite fiddly, a future blog post will explain how I did this!

2 comments:

  1. I highly recommend Avdshare Video Converter is the best choice to rotate MP4 files in sideways or vertical side as well as rotate videos in other formats like MOV, WMV, FLV, MKV, AVCHD, MPEG, DV, ASF, etc.You find it at
    http://www.avdshare.com/mp4-rotator-for-mac-and-windows

    ReplyDelete