Entries Tagged as ''

Installing FFmpeg On LInux in easy method

650-393 and 70-284 are both required by a 642-552 professional in order to qualify for higher exams like 646-588 as well as 70-293 and 70-294.

FFmpeg is an audio/video conversion tool. It includes libavcodec, the leading open source codec library. An experimental streaming server for live broadcasts is also included. The project was started by Fabrice Bellard (using the pseudonym “Gerard Lantau”), and is now maintained by Michael Niedermayer. Many FFmpeg developers are also part of the MPlayer project, and FFmpeg is hosted at the MPlayer project server.

FFmpeg is developed under Linux, but it can be compiled under most operating systems, including Apple Mac OS X, Microsoft Windows and AmigaOS. There are no releases. Instead, FFmpeg developers recommend using the latest Subversion snapshot as development attempts to maintain a stable trunk.[3] Released under the GNU Lesser General Public License or GNU General Public License (depending on which sub-libraries one would include), FFmpeg is free software.

FFmpeg is a computer program that can record, convert and stream digital audio and video in numerous formats.[1] FFmpeg is a command line tool that is composed of a collection of free software / open source libraries. It includes libavcodec, an audio/video codec library used by several other projects, and libavformat, an audio/video container mux and demux library. The name of the project comes from the MPEG video standards group, together with “FF” for “fast forward”.[2]

Installing FFMpeg

yum install ffmpeg ffmpeg-devel

If you get package not found, then you will need to add few
lines in the yum repository for dag packages installation. Create a file named
dag.repo in /etc/yum.repos.d with the following
contents on it

[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

then

yum install ffmpeg ffmpeg-devel

If everything is fine, then the installation should proceed smoothly. If not
you will get something like warning GPG public key missing .

Common Errors

To fix rpmforge GPG key warning:

rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

For more information refer to this
faq
depending on Centos version

Missing Dependency Error:

If you get missing dependency error like shown below, in the middle of ffmpeg
installation

Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed
by package ffmpeg
Error: Missing Dependency: libtheora.so.0(libtheora.so.1.0) is needed by package
ffmpeg

Error: Missing Dependency: rtld(GNU_HASH) is needed by package ffmpeg
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package gsm
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package x264

Error: Missing Dependency: rtld(GNU_HASH) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package lame
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package a52dec
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faad2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package x264
Error: Missing Dependency: rtld(GNU_HASH) is needed by package lame

Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package xvidcore
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faad2
Error: Missing Dependency: libgif.so.4 is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package faac
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package gsm

Error: Missing Dependency: libpng12.so.0(PNG12_0) is needed by package imlib2
Error: Missing Dependency: rtld(GNU_HASH) is needed by package libmp4v2
Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package libmp4v2

then most commonly you have GLIB 2.3 installed instead of GLIB 2.4 version.
To check the current GLIB version installed on your server. just use

yum list glib*

and it should list the latest GLIB package version.

The reason i was getting this error was my rpmforge packages was pointed to
centos 5 versions instead of centos 4.6.

To fix dependency error:

To fix this error, you might need to check your rpmforge packages compatible
to the release of your existing CentOS version.
Check the file /etc/yum.repos.d/rpmforge.repo and it should
look like for Centos 4.6(Final). If you have lines like http://apt.sw.be/redhat/el5/en/mirrors-rpmforge
you might need to make changes to the rpmforge.repos
like shown below

Note: Backup the original rpmforge.repo file
before you edit its content.

[rpmforge]
name = Red Hat Enterprise $releasever – RPMforge.net – dag
#baseurl = http://apt.sw.be/redhat/el4/en/$basearch/dag

mirrorlist = http://apt.sw.be/redhat/el4/en/mirrors-rpmforge
#mirrorlist = file:///etc/yum.repos.d/mirrors-rpmforge
enabled = 1
protect = 0
gpgkey = file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmforge-dag

gpgcheck = 1

To know what linux type and version you are running

cat /etc/redhat-release

Once this is done, do again yum install ffmpeg.

This trick resolved the problem in my linux box running Centos 4.6 and this
is the only way i found to install ffmpeg using yum.

To check the FFmpeg working:

Finally, check the ffmpeg whether it is working or not.

> ffmpeg
> ffmpeg -formats
> ffmpeg –help
// This lists path of mpeg, its modules and other path information

ffmpeg -i Input.file Output.file

To check what audi/video formats are supported

ffmpeg -formats > ffmpeg-format.txt

Open the ffmpeg-formats.txt to see the ooutput

D means decode
E means encode

V means video
A means audio
T = Truncated

Install FFMPEG-PHP Extension

FFmpeg-php
is a very good extension and wrapper for PHP which can pull useful information
about video through API interface. Inorder to install it you will need to download
the source file and then compile and install extension in your server. You can
download the source tarball : http://ffmpeg-php.sourceforge.net/

wget /path/to/this/file/ffmpeg-php-0.5.2.1.tbz2

tar -xjf ffmpeg-0.5.2.1.tbz2

phpize

./configure
make
make install

Common Errors

1. If you get command not found error for
phpize, then you will need to do yum install php-devel

2. If you get error like “ffmpeg headers not
found”
while configuring the source.

configure: error: ffmpeg headers not found. Make sure ffmpeg is
compiled as shared libraries using the –enable-shared option

then it means you have not installed ffmpeg-devel packages.

To Fix: Just install ffmpeg-devel using

yum install ffmpeg-devel

3. If you get an error like shared libraries not found problem
and the program halts in the middle, then you must specify the ffmpeg installed
path explicitly to the ./configure.

configure: error: ffmpeg shared libraries not found. Make sure
ffmpeg is compiled as shared libraries using the –enable-shared option

To Fix:

1. First find out the ffmpeg path with ffmpeg –help command.
The prefix default path should be like /usr/local/cpffmpeg
2. Configure the FFmpeg-php with –with-ffmpeg option

./configure –with-ffmpeg=/usr/local/cpffmpeg

That should resolve the problem!

Editing PHP.INI

Once you have done that without any problems then you will see the php extension
file /usr/local/lib/php/extensions/no-debug-non-zts-20060613/ffmpeg.so
and you will need mention that extension in php.ini file

nano /usr/local/lib/php.ini

Put the below two lines at the end of the php.ini file

[ffmpeg]
extension=ffmpeg.so

Then restart the server service httpd restart

To check whether ffmpeg enabled with php, point your browser
to test.php file. It should show the confirmation of installed
ffmpeg php extension

// #test.php

<?php

phpinfo()

?>

If any case the ffmpeg does not show in the phpinfo() test make sure that php.ini
path to ffmpeg.so is correct. Still the problem occurs, the reason could be
you might be using older versions of ffmpeg-php which is buggy. Just download
the latest version of ffmpeg-php source then compile it.