natively compiling ffmpeg, mplayer, mencoder on MacOS Lion (with x264!)

OK, I’ve revamped my script to compile these tools:
ffmpeg
ffrobe
qt-faststart
mplayer
mencoder

on MacOS Lion, using the heads of the trees, with direct encoding support for:
x264
vpx / WebM

http://archive.org/~tracey/downloads/macff.sh.txt

A nice recent update to ffmpeg is the ability to decode/read Apple ProRes, too!

Published by

tracey pooh

i like digital video and road cycling

2 thoughts on “natively compiling ffmpeg, mplayer, mencoder on MacOS Lion (with x264!)”

  1. I am getting an error when I run your scripts. First error is in patching for the thumbnail, but when i commented out the patch for thumbnail, it went further ahead but broke in building mencoder. Following is the error message :
    clang -o mencoder mencoder.o parser-mecmd.o xvid_vbr.o libmpcodecs/ae.o libmpcodecs/ae_pcm.o libmpcodecs/ve.o libmpcodecs/ve_raw.o libmpdemux/muxer.o libmpdemux/muxer_avi.o libmpdemux/muxer_mpeg.o libmpdemux/muxer_rawaudio.o libmpdemux/muxer_rawvideo.o libmpcodecs/ae_faac.o libmpcodecs/ae_lavc.o libmpcodecs/ve_lavc.o libmpdemux/muxer_lavf.o libmpcodecs/ae_lame.o libmpcodecs/ve_x264.o libmpcodecs/ve_xvid4.o asxparser.o bstr.o codec-cfg.o cpudetect.o edl.o fmt-conversion.o m_config.o m_option.o m_struct.o mp_msg.o mp_strings.o mpcommon.o parser-cfg.o path.o playtree.o playtreeparser.o subopt-helper.o libaf/af.o libaf/af_center.o libaf/af_channels.o libaf/af_comp.o libaf/af_delay.o libaf/af_dummy.o libaf/af_equalizer.o libaf/af_extrastereo.o libaf/af_format.o libaf/af_gate.o libaf/af_hrtf.o libaf/af_karaoke.o libaf/af_pan.o libaf/af_resample.o libaf/af_scaletempo.o libaf/af_sinesuppress.o libaf/af_stats.o libaf/af_sub.o libaf/af_surround.o libaf/af_sweep.o libaf/af_tools.o libaf/af_volnorm.o libaf/af_volume.o libaf/filter.o libaf/format.o libaf/reorder_ch.o libaf/window.o libmpcodecs/ad.o libmpcodecs/ad_alaw.o libmpcodecs/ad_dk3adpcm.o libmpcodecs/ad_dvdpcm.o libmpcodecs/ad_hwac3.o libmpcodecs/ad_hwmpa.o libmpcodecs/ad_imaadpcm.o libmpcodecs/ad_msadpcm.o libmpcodecs/ad_pcm.o libmpcodecs/dec_audio.o libmpcodecs/dec_teletext.o libmpcodecs/dec_video.o libmpcodecs/img_format.o libmpcodecs/mp_image.o libmpcodecs/pullup.o libmpcodecs/vd.o libmpcodecs/vd_hmblck.o libmpcodecs/vd_lzo.o libmpcodecs/vd_mpegpes.o libmpcodecs/vd_mtga.o libmpcodecs/vd_null.o libmpcodecs/vd_raw.o libmpcodecs/vd_sgi.o libmpcodecs/vf.o libmpcodecs/vf_1bpp.o libmpcodecs/vf_2xsai.o libmpcodecs/vf_blackframe.o libmpcodecs/vf_boxblur.o libmpcodecs/vf_crop.o libmpcodecs/vf_cropdetect.o libmpcodecs/vf_decimate.o libmpcodecs/vf_delogo.o libmpcodecs/vf_denoise3d.o libmpcodecs/vf_detc.o libmpcodecs/vf_dint.o libmpcodecs/vf_divtc.o libmpcodecs/vf_down3dright.o libmpcodecs/vf_dsize.o libmpcodecs/vf_dvbscale.o libmpcodecs/vf_eq.o libmpcodecs/vf_eq2.o libmpcodecs/vf_expand.o libmpcodecs/vf_field.o libmpcodecs/vf_fil.o libmpcodecs/vf_filmdint.o libmpcodecs/vf_fixpts.o libmpcodecs/vf_flip.o libmpcodecs/vf_format.o libmpcodecs/vf_framestep.o libmpcodecs/vf_gradfun.o libmpcodecs/vf_halfpack.o libmpcodecs/vf_harddup.o libmpcodecs/vf_hqdn3d.o libmpcodecs/vf_hue.o libmpcodecs/vf_il.o libmpcodecs/vf_ilpack.o libmpcodecs/vf_ivtc.o libmpcodecs/vf_kerndeint.o libmpcodecs/vf_mirror.o libmpcodecs/vf_noformat.o libmpcodecs/vf_noise.o libmpcodecs/vf_ow.o libmpcodecs/vf_palette.o libmpcodecs/vf_perspective.o libmpcodecs/vf_phase.o libmpcodecs/vf_pp7.o libmpcodecs/vf_pullup.o libmpcodecs/vf_rectangle.o libmpcodecs/vf_remove_logo.o libmpcodecs/vf_rgbtest.o libmpcodecs/vf_rotate.o libmpcodecs/vf_sab.o libmpcodecs/vf_scale.o libmpcodecs/vf_smartblur.o libmpcodecs/vf_softpulldown.o libmpcodecs/vf_stereo3d.o libmpcodecs/vf_softskip.o libmpcodecs/vf_swapuv.o libmpcodecs/vf_telecine.o libmpcodecs/vf_test.o libmpcodecs/vf_tfields.o libmpcodecs/vf_tile.o libmpcodecs/vf_tinterlace.o libmpcodecs/vf_unsharp.o libmpcodecs/vf_vo.o libmpcodecs/vf_yadif.o libmpcodecs/vf_yuvcsp.o libmpcodecs/vf_yvu9.o libmpdemux/aac_hdr.o libmpdemux/asfheader.o libmpdemux/aviheader.o libmpdemux/aviprint.o libmpdemux/demuxer.o libmpdemux/demux_aac.o libmpdemux/demux_asf.o libmpdemux/demux_audio.o libmpdemux/demux_avi.o libmpdemux/demux_demuxers.o libmpdemux/demux_film.o libmpdemux/demux_fli.o libmpdemux/demux_lmlm4.o libmpdemux/demux_mf.o libmpdemux/demux_mkv.o libmpdemux/demux_mov.o libmpdemux/demux_mpg.o libmpdemux/demux_nsv.o libmpdemux/demux_pva.o libmpdemux/demux_rawaudio.o libmpdemux/demux_rawvideo.o libmpdemux/demux_realaud.o libmpdemux/demux_real.o libmpdemux/demux_roq.o libmpdemux/demux_smjpeg.o libmpdemux/demux_ts.o libmpdemux/demux_ty.o libmpdemux/demux_ty_osd.o libmpdemux/demux_viv.o libmpdemux/demux_vqf.o libmpdemux/demux_y4m.o libmpdemux/ebml.o libmpdemux/extension.o libmpdemux/mf.o libmpdemux/mp3_hdr.o libmpdemux/mp_taglists.o libmpdemux/mpeg_hdr.o libmpdemux/mpeg_packetizer.o libmpdemux/parse_es.o libmpdemux/parse_mp4.o libmpdemux/video.o libmpdemux/yuv4mpeg.o libmpdemux/yuv4mpeg_ratio.o osdep/getch2.o osdep/timer-darwin.o stream/open.o stream/stream.o stream/stream_bd.o stream/stream_cue.o stream/stream_file.o stream/stream_mf.o stream/stream_null.o stream/url.o sub/eosd.o sub/find_sub.o sub/osd.o sub/spudec.o sub/sub.o sub/sub_cc.o sub/subreader.o sub/vobsub.o sub/font_load.o stream/stream_dvdnav.o libdvdnav/dvdnav.o libdvdnav/highlight.o libdvdnav/navigation.o libdvdnav/read_cache.o libdvdnav/remap.o libdvdnav/searching.o libdvdnav/settings.o libdvdnav/vm/decoder.o libdvdnav/vm/vm.o libdvdnav/vm/vmcmd.o stream/stream_dvd.o stream/stream_dvd_common.o libdvdread4/bitreader.o libdvdread4/dvd_input.o libdvdread4/dvd_reader.o libdvdread4/dvd_udf.o libdvdread4/ifo_print.o libdvdread4/ifo_read.o libdvdread4/md5.o libdvdread4/nav_print.o libdvdread4/nav_read.o libvo/aclib.o av_helpers.o av_opts.o libaf/af_lavcac3enc.o libaf/af_lavcresample.o libmpcodecs/ad_ffmpeg.o libmpcodecs/ad_spdif.o libmpcodecs/vd_ffmpeg.o libmpcodecs/vf_geq.o libmpcodecs/vf_lavc.o libmpcodecs/vf_lavcdeint.o libmpcodecs/vf_screenshot.o libmpdemux/demux_lavf.o stream/stream_ffmpeg.o sub/av_sub.o libmpcodecs/vf_fspp.o libmpcodecs/vf_mcdeint.o libmpcodecs/vf_qp.o libmpcodecs/vf_spp.o libmpcodecs/vf_uspp.o stream/stream_ftp.o libmpcodecs/vf_bmovl.o libaf/af_export.o osdep/mmap_anon.o libdvdcss/css.o libdvdcss/device.o libdvdcss/error.o libdvdcss/ioctl.o libdvdcss/libdvdcss.o libmpcodecs/vd_libmpeg2.o libmpeg2/alloc.o libmpeg2/cpu_accel.o libmpeg2/cpu_state.o libmpeg2/decode.o libmpeg2/header.o libmpeg2/idct.o libmpeg2/motion_comp.o libmpeg2/slice.o libmpeg2/idct_mmx.o libmpeg2/motion_comp_mmx.o libmpcodecs/vd_theora.o libmpcodecs/ad_mp3lib.o mp3lib/sr1.o mp3lib/decode_mmx.o mp3lib/dct64_sse.o stream/stream_rtsp.o stream/freesdp/common.o stream/freesdp/errorlist.o stream/freesdp/parser.o stream/librtsp/rtsp.o stream/librtsp/rtsp_rtp.o stream/librtsp/rtsp_session.o stream/stream_netstream.o stream/asf_mmst_streaming.o stream/asf_streaming.o stream/cookies.o stream/http.o stream/network.o stream/pnm.o stream/rtp.o stream/udp.o stream/tcp.o stream/stream_rtp.o stream/stream_udp.o stream/realrtsp/asmrp.o stream/realrtsp/real.o stream/realrtsp/rmff.o stream/realrtsp/sdpplin.o stream/realrtsp/xbuffer.o libmpcodecs/vd_mpng.o libmpcodecs/vf_pp.o libmpcodecs/ad_realaud.o libmpcodecs/vd_realvid.o stream/cache2.o stream/stream_tv.o stream/tv.o stream/frequencies.o stream/tvi_dummy.o sub/unrar_exec.o stream/stream_vcd.o libmpcodecs/ad_libvorbis.o libmpdemux/demux_ogg.o libmpcodecs/vd_xanim.o libmpcodecs/vd_xvid4.o osdep/shmem.o ffmpeg/libpostproc/libpostproc.a ffmpeg/libavfilter/libavfilter.a ffmpeg/libavformat/libavformat.a ffmpeg/libavcodec/libavcodec.a ffmpeg/libswscale/libswscale.a ffmpeg/libswresample/libswresample.a ffmpeg/libavutil/libavutil.a /opt/local/x/usr/local/lib/libx264.a -lncurses -lpng -lz -framework IOKit -framework Carbon -lz -lbz2 -lvorbis -lvorbisenc -logg -ltheoradec -logg -lopencore-amrnb -lopencore-amrwb -lxvidcore -lvpx -L/usr/X11R6/lib -L/opt/local/lib -lm -lfaac -lmp3lame
    Undefined symbols for architecture x86_64:
    “_cio_tell”, referenced from:
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    Undefined symbols for architecture x86_64:
    “_cio_tell”, referenced from:
    “_opj_cio_close”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_opj_cio_open”, referenced from:
    “_opj_cio_close”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_opj_create_compress”, referenced from:
    “_opj_cio_open”, referenced from:
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_opj_create_decompress”, referenced from:
    “_opj_create_compress”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_decode_with_info”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_opj_create_decompress”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_opj_destroy_compress”, referenced from:
    _libopenjpeg_encode_close in libavcodec.a(libopenjpegenc.o)
    “_opj_decode_with_info”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_opj_destroy_decompress”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_opj_destroy_compress”, referenced from:
    _libopenjpeg_encode_close in libavcodec.a(libopenjpegenc.o)
    “_opj_encode”, referenced from:
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_opj_destroy_decompress”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_opj_image_create”, referenced from:
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_encode”, referenced from:
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_opj_image_destroy”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_close in libavcodec.a(libopenjpegenc.o)
    “_opj_image_create”, referenced from:
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_set_default_decoder_parameters”, referenced from:
    _libopenjpeg_decode_init in libavcodec.a(libopenjpegdec.o)
    “_opj_image_destroy”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_close in libavcodec.a(libopenjpegenc.o)
    “_opj_set_default_encoder_parameters”, referenced from:
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_set_default_decoder_parameters”, referenced from:
    “_opj_set_event_mgr”, referenced from:
    _libopenjpeg_decode_init in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_setup_decoder”, referenced from:
    “_opj_set_default_encoder_parameters”, referenced from:
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_opj_setup_encoder”, referenced from:
    “_opj_set_event_mgr”, referenced from:
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    _libopenjpeg_encode_init in libavcodec.a(libopenjpegenc.o)
    “_th_encode_alloc”, referenced from:
    “_opj_setup_decoder”, referenced from:
    _encode_init in libavcodec.a(libtheoraenc.o)
    _libopenjpeg_decode_frame in libavcodec.a(libopenjpegdec.o)
    “_th_encode_ctl”, referenced from:
    “_opj_setup_encoder”, referenced from:
    _encode_init in libavcodec.a(libtheoraenc.o)
    _get_stats in libavcodec.a(libtheoraenc.o)
    _submit_stats in libavcodec.a(libtheoraenc.o)
    _libopenjpeg_encode_frame in libavcodec.a(libopenjpegenc.o)
    “_th_encode_flushheader”, referenced from:
    “_th_encode_alloc”, referenced from:
    _encode_init in libavcodec.a(libtheoraenc.o)
    _encode_init in libavcodec.a(libtheoraenc.o)
    “_th_encode_free”, referenced from:
    “_th_encode_ctl”, referenced from:
    _encode_close in libavcodec.a(libtheoraenc.o)
    _encode_init in libavcodec.a(libtheoraenc.o)
    _get_stats in libavcodec.a(libtheoraenc.o)
    _submit_stats in libavcodec.a(libtheoraenc.o)
    “_th_encode_packetout”, referenced from:
    “_th_encode_flushheader”, referenced from:
    _encode_frame in libavcodec.a(libtheoraenc.o)
    _encode_init in libavcodec.a(libtheoraenc.o)
    “_th_encode_ycbcr_in”, referenced from:
    _encode_frame in libavcodec.a(libtheoraenc.o)
    “_th_encode_free”, referenced from:
    _encode_close in libavcodec.a(libtheoraenc.o)
    “_th_encode_packetout”, referenced from:
    _encode_frame in libavcodec.a(libtheoraenc.o)
    ld: symbol(s) not found for architecture x86_64
    “_th_encode_ycbcr_in”, referenced from:
    _encode_frame in libavcodec.a(libtheoraenc.o)
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [mencoder] Error 1
    make: *** Waiting for unfinished jobs….
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    make: *** [mplayer] Error 1

    How do i turn off building mencoder ?

    1. hey there!

      I’ve updated my script since then — the patches should work now (they sometimes don’t work for a short period until I adjust them and update them, etc.)

      to disable mplayer/mencoder building (which is admittedly on macs the thing most likely to have issues at any given time) with the new script, simply change this line

      if [ “$SHORTNAME” == “mac” ]; then

      to something like

      if [ “$SHORTNAME” == “macxxxx” ]; then

      if you ever have issues with the patches, you can disable all of them entirely by changing these 2 lines:

      function ffmpeg_patch()
      {

      to

      function ffmpeg_patch()
      { return;

      (and you can also move any .patch file to the “right” of the “#” char in the “for p in ….” line there if you want to try some but not all of them, alternatively)

      hope that all helps!!

Leave a Reply

Your email address will not be published. Required fields are marked *