Archive for September, 2009

How To: Install ffmpeg on CentOS or Redhat using up2date or yum

Wednesday, September 30th, 2009

There are a bunch of instructions out there for installing ffmpeg. I found really easy instructions using yum, but I needed to use up2date. So I figured I would compile my steps.

First, make sure you’re logged in as root:

su -

Install with up2date:

1. Add the following line to /etc/sysconfig/rhn/sources:

yum dag http://apt.sw.be/redhat/el4/en/$ARCH/dag

Note: Your source line may be different depending on your release. You can find the correct line to use here: http://dag.wieers.com/rpm/FAQ.php#B5

2. Add the following line to /etc/ld.so.conf:

/usr/local/lib

3. Finally, execute each of the following in order:

ldconfig -v
rpm -Uvh ftp://rpmfind.net/linux/dag/redhat/el4/en/i386/dag/RPMS/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
up2date ffmpeg ffmpeg-devel

Note: Your rpm may be different depending on your release. You can find the correct rpm to use here: http://www.rpmfind.net/linux/rpm2html/search.php?query=rpmforge-release

- Or – Install with yum:

1. Create and add the following to /etc/yum.repos.d/dag.repo:

[dag]
name=Dag RPM Repository for Red Hat Enterprise Linux
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1

2. Add the following line to /etc/ld.so.conf:

/usr/local/lib

3. Finally, execute each of the following in order:

ldconfig -v
rpm -Uvh ftp://rpmfind.net/linux/dag/redhat/el4/en/i386/dag/RPMS/rpmforge-release-0.3.6-1.el4.rf.i386.rpm
yum update
yum install ffmpeg ffmpeg-devel

Note: Your rpm may be different depending on your release You can find the correct rpm to use here: http://www.rpmfind.net/linux/rpm2html/search.php?query=rpmforge-release

You’re finished! You can find the PHP extension here: http://ffmpeg-php.sourceforge.net

I found the original yum instructions here: http://www.crucialp.com/resources/tutorials/server-administration/how-to-install-ffmpeg-centos-rhel-redhat-enterprise-easy-way.php

Title “keywordize” function

Friday, September 11th, 2009

This function is used to fetch a valid keyword string for use in a URL. This function comes in handy when you want to structure your URLs to contain keywords found in the page’s title, for example.

Any non alphanumeric characters are stripped from the string, and spaces are replaced with dashes. Extra whitespace is accounted for.

Example:

$title = 'This is the "Best" Function Ever!';
echo keywordize($title);

Output:

this-is-the-best-function-ever

Code:

  function keywordize($string){
    return preg_replace(array('/^[^a-z0-9]|[^a-z0-9]+$/', '/ +|(\.{2,}[ ]?)+/s', '/[^a-z0-9_-]/s', '/(-{2,})/', '/((^-)|(-$))/'), array('', '-', '', '-', ''), strtolower($string));
  }

You can use the output of this function in your URLs like most CMS applications do to make your URLs search engine friendly.

You can add weight to the keywords within you page by containing them within the page’s URL.

I’ve written a short tutorial on adding search engine friendly keywords to a URL with ModRewrite.