Installing php-ffmpeg on ubuntu from source

ubuntu-18.04

This tutorial will teach you how to successfully install php-ffmpeg on ubuntu 7.10 but approach is the same no matter which Ubuntu version you might use. 

You do not need to follow steps below if you run latest Ubuntu release. You can install php-ffmpeg as a module via aptitude or synaptic.

Before you start with this tutorial please check that php-gd is enabled. php-ffmpeg uses gd to generate screenshots and image manipulation.

Ok, let’s go.

Installation of ffmpeg requires php5-dev package. We are going to use phpize5 and which ships with php5-dev package. First install php5-dev if you haven’t done it yet.

Code:
sudo apt-get install php5-dev

Follow now these steps below to install php-ffmpeg from source.

1. Install ffmpeg package, ships even with mplayer.

Code:
sudo apt-get install ffmpeg

2. Install libavcodec

Code:
sudo apt-get install libavcodec-dev 

3. Install libavcodec1d

Code:
sudo apt-get install libavcodec1d 

4. Install mencoder

Code:
sudo apt-get install mencoder

5. Downloaded the ffmpeg-php source: 

Code:
wget https://downloads.sourceforge.net/ffmpeg-php/ffmpeg-php-0.5.1.tbz2?modtime=1181869403&big_mirror=0

6. Unpuck and go to unpacked folder and run phpize5 to prepare PHP extension for compilling

7. Run configure 

Code:
./configure

8. Run make to compile the code

Code:
make

9. Run make install to install compilation

Code:
sudo make install

Successfull result should look like this:
Installing shared extensions: /usr/lib/php5/20060613+lfs/

10. Edit php.ini file and add: 

Code:
extension=ffmpeg.so

I hope this helped? Please leave a comment.

Leave a Comment