Mencoder from macports with x264 support

Alec Jacobson

September 08, 2011

weblog/

I installed mencoder, via mplayer, using macports. I recently start using the mplayer-devel port because it seemed to have better playback. But the issue had arisen before with the normal mplayer port. The problem occurs when I try to encode videos to a x264 .mp4 file. I see one of the following:
-x264encopts is not an MEncoder option
Couldn't find video filter 'x264'.
The solution seems to be reinstalling mplayer-devel with the +mencoder_extras variant. I upgraded my existing mplayer-devel install using
sudo port upgrade --enforce-variants mplayer-devel +mencoder_extras
Now when I issue:
mencoder -ovc help
I see:
MEncoder UNKNOWN-4.2.1 (C) 2000-2011 MPlayer Team

Available codecs:
   copy     - frame copy, without re-encoding. Doesn't work with filters.
   frameno  - special audio-only file for 3-pass encoding, see DOCS.
   raw      - uncompressed video. Use fourcc option to set format explicitly.
   nuv      - nuppel video
   lavc     - libavcodec codecs - best quality!
   libdv    - DV encoding with libdv v0.9.5
   xvid     - XviD encoding
   x264     - H.264 encoding