{"id":199,"date":"2011-05-09T20:36:41","date_gmt":"2011-05-09T20:36:41","guid":{"rendered":"http:\/\/www.linuxmaster.tk\/?p=199"},"modified":"2011-05-09T20:37:17","modified_gmt":"2011-05-09T20:37:17","slug":"how-to-install-ffmpeg-in-linux","status":"publish","type":"post","link":"https:\/\/linuxmaster.in\/?p=199","title":{"rendered":"How to Install FFmpeg in Linux"},"content":{"rendered":"<p>yum install ffmpeg ffmpeg-devel<\/p>\n<p>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<\/p>\n<p>[dag]<br \/>\nname=Dag RPM Repository for Red Hat Enterprise Linux<br \/>\nbaseurl=http:\/\/apt.sw.be\/redhat\/el$releasever\/en\/$basearch\/dag<br \/>\ngpgcheck=1<br \/>\nenabled=1<\/p>\n<p>then<\/p>\n<p>yum install ffmpeg ffmpeg-devel<\/p>\n<p>If everything is fine, then the installation should proceed smoothly. If not you will get something like warning GPG public key missing .<\/p>\n<p>To fix rpmforge GPG key warning:<\/p>\n<p>rpm -Uhv http:\/\/apt.sw.be\/redhat\/el5\/en\/i386\/rpmforge\/RPMS\/rpmforge-release-0.3.6-1.el5.rf.i386.rpm<\/p>\n<p>If you get missing dependency error like shown below, in the middle of ffmpeg installation<\/p>\n<p>Error: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package ffmpeg<br \/>\nError: Missing Dependency: libtheora.so.0(libtheora.so.1.0) is needed by package ffmpeg<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package ffmpeg<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package imlib2<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package a52dec<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package imlib2<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package gsm<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package x264<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package xvidcore<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package lame<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package a52dec<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package faad2<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package x264<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package lame<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package xvidcore<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faac<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package faad2<br \/>\nError: Missing Dependency: libgif.so.4 is needed by package imlib2<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package faac<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package gsm<br \/>\nError: Missing Dependency: libpng12.so.0(PNG12_0) is needed by package imlib2<br \/>\nError: Missing Dependency: rtld(GNU_HASH) is needed by package libmp4v2<br \/>\nError: Missing Dependency: libc.so.6(GLIBC_2.4) is needed by package libmp4v2<\/p>\n<p>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<\/p>\n<p>yum list glib*<\/p>\n<p>To fix dependency error:<\/p>\n<p>To fix this error, you might need to check your rpmforge packages compatible to the release of your existing CentOS version.<br \/>\nCheck 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<\/p>\n<p>Note: Backup the original rpmforge.repo file before you edit its content.<\/p>\n<p>[rpmforge]<br \/>\nname = Red Hat Enterprise $releasever &#8211; RPMforge.net &#8211; dag<br \/>\n#baseurl = http:\/\/apt.sw.be\/redhat\/el4\/en\/$basearch\/dag<br \/>\nmirrorlist = http:\/\/apt.sw.be\/redhat\/el4\/en\/mirrors-rpmforge<br \/>\n#mirrorlist = file:\/\/\/etc\/yum.repos.d\/mirrors-rpmforge<br \/>\nenabled = 1<br \/>\nprotect = 0<br \/>\ngpgkey = file:\/\/\/etc\/pki\/rpm-gpg\/RPM-GPG-KEY-rpmforge-dag<br \/>\ngpgcheck = 1<\/p>\n<p>To know what linux type and version you are running<\/p>\n<p>cat \/etc\/redhat-release<\/p>\n<p>Once this is done, do again yum install ffmpeg.<\/p>\n<p>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.<br \/>\nTo check the FFmpeg working:<\/p>\n<p>Finally, check the ffmpeg whether it is working or not.<\/p>\n<p>> ffmpeg<br \/>\n> ffmpeg -formats<br \/>\n> ffmpeg &#8211;help<br \/>\n\/\/ This lists path of mpeg, its modules and other path information<\/p>\n<p>ffmpeg -i Input.file Output.file<br \/>\nTo check what audi\/video formats are supported<\/p>\n<p>ffmpeg -formats > ffmpeg-format.txt<\/p>\n<p>Open the ffmpeg-formats.txt to see the ooutput<\/p>\n<p>D means decode<br \/>\nE means encode<br \/>\nV means video<br \/>\nA means audio<br \/>\nT = Truncated<br \/>\nInstall FFMPEG-PHP Extension<\/p>\n<p>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\/<\/p>\n<p>wget \/path\/to\/this\/file\/ffmpeg-php-0.5.2.1.tbz2<\/p>\n<p>tar -xjf ffmpeg-0.5.2.1.tbz2<\/p>\n<p>phpize<\/p>\n<p>.\/configure<br \/>\nmake<br \/>\nmake install<br \/>\nCommon Errors<\/p>\n<p>1. If you get command not found error for phpize, then you will need to do yum install php-devel<\/p>\n<p>2. If you get error like &#8220;ffmpeg headers not found&#8221; while configuring the source.<\/p>\n<p>configure: error: ffmpeg headers not found. Make sure ffmpeg is<br \/>\ncompiled as shared libraries using the &#8211;enable-shared option<\/p>\n<p>then it means you have not installed ffmpeg-devel packages.<\/p>\n<p>To Fix: Just install ffmpeg-devel using<\/p>\n<p>yum install ffmpeg-devel<\/p>\n<p>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.<\/p>\n<p>configure: error: ffmpeg shared libraries not found. Make sure ffmpeg is compiled as shared libraries using the &#8211;enable-shared option<\/p>\n<p>To Fix:<\/p>\n<p>1. First find out the ffmpeg path with ffmpeg &#8211;help command. The prefix default path should be like \/usr\/local\/cpffmpeg<br \/>\n2. Configure the FFmpeg-php with &#8211;with-ffmpeg option<\/p>\n<p>.\/configure &#8211;with-ffmpeg=\/usr\/local\/cpffmpeg<\/p>\n<p>That should resolve the problem!<br \/>\nEditing PHP.INI<\/p>\n<p>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<\/p>\n<p>nano \/usr\/local\/lib\/php.ini<\/p>\n<p>Put the below two lines at the end of the php.ini file<\/p>\n<p>[ffmpeg]<br \/>\nextension=ffmpeg.so<\/p>\n<p>Then restart the server service httpd restart<\/p>\n<p>To check whether ffmpeg enabled with php, point your browser to test.php file. It should show the confirmation of installed ffmpeg php extension<\/p>\n<p>\/\/ #test.php<\/p>\n<p><?php\n\nphpinfo()\n\n?><\/p>\n<p>Installing Mplayer + Mencoder<\/p>\n<p>Just issue the following yum commands to install the rest of the packages.<\/p>\n<p>yum install mplayer mencoder<br \/>\nInstalling FlvTool2<\/p>\n<p>Flvtool2 is a flash video file manipulation tool. It can calculate metadata and can cut and edit cue points for flv files.<\/p>\n<p>If you are on Centos 5 try yum install flvtool2 with dag repository and if you get package not found you will need to manually download and compile the flvtool2. You can download latest version of flvtool2 here: http:\/\/rubyforge.org\/projects\/flvtool2\/<\/p>\n<p>wget <url-link><\/p>\n<p>ruby setup.rb config<br \/>\nruby setup.rb setup<br \/>\nsudo ruby setup.rb install<\/p>\n<p>If you get command not found error, it probably means that you dont have ruby installed.<\/p>\n<p>yum install ruby<\/p>\n<p>Thats it! Once ffmpeg works fine with php extension, download a sample video, convert to .flv format in the command line.<\/p>\n<p><strong><br \/>\nREFERENCE:<br \/>\nhttp:\/\/www.mysql-apache-php.com\/ffmpeg-install.htm<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &hellip; <a href=\"https:\/\/linuxmaster.in\/?p=199\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;How to Install FFmpeg in Linux&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-199","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/posts\/199","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=199"}],"version-history":[{"count":2,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions"}],"predecessor-version":[{"id":201,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=\/wp\/v2\/posts\/199\/revisions\/201"}],"wp:attachment":[{"href":"https:\/\/linuxmaster.in\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=199"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=199"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/linuxmaster.in\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=199"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}