natively compiling ffmpeg, x264, mplayer on mac (with builtin x264 and webm encoding)

i’m very pleased that after years of hacks here and there, all three heads of the current codebases pretty well build natively on mac (snow leopard) for

  • x264
  • ffmpeg
  • mplayer

here, i’m making sure that i compile in static version of libvpx (Webm) and libx264 (h.264) video packages so that the ffmpeg can easily make hiqh quality h.246 and webm transcoded videos.

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

 

So we can make nice (2 pass video) ~768 kb/sec 640×480 derivatives like so (alter “-r ” as appropriate):

# make WebM
ffmpeg -deinterlace -y -i 'camels.avi' -vcodec webm -fpre libvpx-360p.ffpreset -vf scale=640:480 -r 20 -threads 2 -map_meta_data -1:0 -pass 1 -an tmp.webm

ffmpeg -deinterlace -y -i 'camels.avi' -vcodec webm -fpre libvpx-360p.ffpreset -vf scale=640:480 -r 20 -threads 2 -map_meta_data -1:0 -pass 2 -acodec libvorbis -ab 128k -ac 2 -ar 44100 tmp.webm

mv tmp.webm 'camels.webm'

 

# make h.264

ffmpeg -deinterlace -y -i 'camels.avi' -vcodec libx264 -fpre libx264-IA.ffpreset -vf scale=640:480 -r 20 -threads 2 -map_meta_data -1:0 -pass 1 -an tmp.mp4


ffmpeg -deinterlace -y -i 'camels.avi' -vcodec libx264 -fpre libx264-IA.ffpreset -vf scale=640:480 -r 20 -threads 2 -map_meta_data -1:0 -pass 2 -acodec aac -strict experimental -ab 128k -ac 2 -ar 44100 tmp.mp4

qt-faststart tmp.mp4 'camels.mp4'

our preset files:
http://archive.org/~tracey/downloads/libvpx-360p.ffpreset
http://archive.org/~tracey/downloads/libx264-IA.ffpreset

Nice things about the h.264 derivative:

  • plays on all iphones and ipads
  • browser video tag and/or flash plugin compatible
  • starts immediately, seeks immediately even before entire video is downloaded

hope this may be useful!

Published by

tracey pooh

i like digital video and road cycling

3 thoughts on “natively compiling ffmpeg, x264, mplayer on mac (with builtin x264 and webm encoding)”

    1. thanks for the tip.
      i did check w/ the original author and his site at
      http://multimedia.cx/eggs/improving-qt-faststart/ where he seems to suggest/prefer the bundled source w/ ffmpeg.

      it seems most of the issues people have had with the C aspect of qt-faststart relate to 32bit vs 64bit compiling — which we don’t really have to worry about in our setup when compiling from ffmpeg as instructed. (and having been “raised on C”, i don’t have any major issues w/ C vs. python.

      was there something compelling otherwise about the python variant you liked?

Leave a Reply

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