Archive for March, 2008

  1. Installing ffmpeg on OS X

    This is a work in progress for installing ffmpeg on OSX by a custom compile

    This is another thing that I have needed to do and decided to put what I am doing in a blog post, I might need it in the future or it might be helpful for others.

    So firstly download LAME – this is needed for supporting MP3 audio files, such as those in FLV and also for vorbis support. LAME src can be located on sourceforge.

    Unarchive the file (lame-3.98b6 at the time of writing )

    cd lame-3.98b6
    ./configure --with-vorbis
    make
    sudo make install

    The first time I did this I noticed a problem running make so I “make clean” and then went through the process again.

    Next up we want support for AAC audio, and you can get packages called FAAD2 and FAAC from www.audiocoding.com/downloads.html for these and then unarchive them ( FAAD 2.6.1 and FAAC 1.26 at the time of writing).

    cd faad2
    autoreconf -vif
    ./configure --without-bmp --without-xmms --without-drm --without-mpeg4ip
    make
    sudo make install

    Then faac

    cd faac
    ./bootstrap
    ./configure --with-libmp4v2
    make
    sudo make install

    x264 ( http://www.videolan.org/developers/x264.html )

    cd x264
    ./configure --enable-pthread --enable-pic
    make
    make install

    liba52

    wget http://liba52.sourceforge.net/files/a52dec-snapshot.tar.gz
    tar -xzvf a52dec-snapshot.tar.gz
    cd a52dec-0.7.5-cvs/
    ./configure
    ./configure --enable-libmp3lame --enable-x264 --enable-liba52 --enable-gpl

    And for amr_wb and amr_nb go into their directories and do the following:

    ./configure
    make clean
    make -j2 > /dev/null
    sudo make install

    Basically the -j2 switch is for enabling dual cores when compiling.

    Now we get around to compiling ffmpeg itself:

    ./configure --enable-shared --disable-mmx --enable-libmp3lame --enable-libamr-wb --enable-libamr-nb --enable-nonfree --disable-vhook
    make clean
    make -j2 > /dev/null
    sudo make install

    And that should be it though I am currently trying this configuration and it seems to work well:

    ./configure --enable-shared --disable-mmx --enable-libmp3lame --enable-libamr-wb --enable-libamr-nb --enable-nonfree --enable-libx264 --enable-libfaad --enable-gpl --disable-vhook
    By timc3 on the
    March 25th, 2008
  2. Django and URLS naming

    Django URLs naming can be a pain sometimes, unless it is just me but an easy way to debug is to use Django’s shell and import urlresolvers:

    python manage.py shell

    >> from django.core.urlresolvers import reverse
    >> reverse('nameofurl')

    If there are arguments in the URLS field (for instance passing in the slug):

     >> reverse('nameofurl', 'slug') [/sourcecode]

    Then it should resolve the name to the URL path needed. If it doesn’t, well something is wrong. We got a weird Traceback when using Python 2.5 though:

    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 297, in reverse
        return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs))
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 282, in reverse
        if lookup_view in self.reverse_dict:
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 221, in _get_reverse_dict
        self._reverse_dict[pattern.callback] = (pattern,)
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 178, in _get_callback
        self._callback = get_callable(self._callback_str)
      File "/Users/azimi/Code/Python/Django/django-trunk/django/utils/functional.py", line 130, in wrapper
        result = func(*args)
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 47, in get_callable
        lookup_view = getattr(__import__(mod_name, {}, {}, ['']), func_name)
      File "/website/xmlrpc.py", line 8, in </module><module>
        dispatcher = SimpleXMLRPCDispatcher() # Python 2.4
    TypeError: __init__() takes exactly 3 arguments (1 given)
    >>> reverse('homepage')
    Traceback (most recent call last):
      File "<console>", line 1, in <module>
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 297, in reverse
        return iri_to_uri(u'/' + get_resolver(urlconf).reverse(viewname, *args, **kwargs))
      File "/Library/Python/2.5/site-packages/django/core/urlresolvers.py", line 284, in reverse
        raise NoReverseMatch
    NoReverseMatch
    </module></console></module></console>

    Looks like something is broken in support for python 2.5 on OS X with django, but I wonder if it is just us thats found this.

    By timc3 on the
    March 13th, 2008