Install port first

Run: sudo port -fvds selfupdate (to get the recent list)

port search ffmpeg

port variants ffmpeg

sudo port install ffmpeg +gpl +lame +x264 +xvid

Install java before these steps