Wednesday, October 31, 2012

Installing ffmpeg on Amazon AMI (CentOS 6)

An easy way to install ffmpeg on Amazon AMI (special distro for Amazon AWS EC2 service) without using any source packages. Basically, it is a rebranded CentOS using Amazon's repository, which does not have many packages, including ffmpeg and it's dependencies. Your version may vary:
$ cat /etc/issue
Amazon Linux AMI release 2012.09
Determine which CentOS this is based off (version is in Red Hat X.X.X-x):
$ cat /proc/version
Linux version 3.2.21-1.32.6.amzn1.x86_64 (mockbuild@gobi-build-31004)
(gcc version 4.4.6 20110731 (Red Hat 4.4.6-3) (GCC) ) #1 SMP Sat Jun 
23 02:32:15 UTC 2012
So here we basically have CentOS 6. Go ahead and create /etc/yum.repos.d/centos.repo :
name=CentOS-6 – Base
That's not all. Some libraries are hidden in EPEL repository, it should be already added but not enabled, so edit /etc/yum.repos.d/epel.repo and make sure you have enabled=1 there (don't need source and debuginfo sections,  we won't be building anything today). And do the same for /etc/yum.repos.d/rpmforge.repo - should enable extras section.

Now we're ready for some magic:
$ sudo yum -y update
$ sudo yum -y install ffmpeg
Be warned that there might be some small conflicts between CentOS and Amazon repositories. Resolve using common sense. This guide should work as is for Amazon AMI 2012.09