The simplest way to install ffmpeg on Mac OS X is with Homebrew.
Once you have Homebrew installed install ffmpeg from the Terminal with the following:
$ brew install ffmpeg
Homebrew installs ffmpeg with many of the common codecs including H.264.
After you can convert from the Terminal with the following:
$ ffmpeg -i input.h264 -acodec copy -vcodec copy output.m4v
You're done!