{"id":161,"date":"2015-04-27T13:11:45","date_gmt":"2015-04-27T13:11:45","guid":{"rendered":"http:\/\/betakb.veeble.org\/?p=161"},"modified":"2025-04-22T11:59:57","modified_gmt":"2025-04-22T06:29:57","slug":"ffmpeg-mplayer-mencoder-ffmpeg-php","status":"publish","type":"post","link":"https:\/\/www.veeble.com\/kb\/ffmpeg-mplayer-mencoder-ffmpeg-php\/","title":{"rendered":"Install FFmpeg, MPlayer\u00a0&#038;\u00a0FFmpeg\u2011PHP on\u00a0CentOS\u00a05.x"},"content":{"rendered":"\n<p>This article describes how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert\/manipulate videos easily on CentOS 5.x. If you want to run sites like youtube, this article will help you to install the base for your software.<\/p>\n\n\n\n<p>1. Setting-up RPMForge repository.<\/p>\n\n\n\n<p>RPMForge repository (<a class=\"external free\" href=\"http:\/\/dag.wieers.com\/\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/dag.wieers.com<\/a>) is the biggest rpm repository for RHEL, and CentOS for all versions. Set up the RPMForge repository as mentioned <a class=\"external text\" href=\"http:\/\/kb.veeble.org\/Adding_additional_repositories_in_CentOS\" rel=\"nofollow noopener\" target=\"_blank\">here<\/a>.<\/p>\n\n\n\n<p>2. Install ffmpeg, mplayer, mencoder with all supported modules. Now we have rpmforge repository, so we will use yum to install ffmpeg, mplayer, mencoder as well as all dependent software.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">yum -y install ffmpeg ffmpeg-devel mplayer mencoder flvtool2\n<\/pre>\n\n\n\n<p>This command will some time to download and install all packages depending on your internet speed.<\/p>\n\n\n\n<p>3. Install FFMPEG-PHP<\/p>\n\n\n\n<p>ffmpeg-php is an extension for PHP that adds an easy-to-use, object-oriented API for accessing and retrieving information from video and audio files. ffmpeg-devel and php-devel are needed to compile ffmpeg-php from the source code. Use the following steps to install ffmpeg-php<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/usr\/src\nwget <a class=\"external free\" href=\"http:\/\/garr.dl.sourceforge.net\/sourceforge\/ffmpeg-php\/ffmpeg-php-x.x.x.tbz2\" rel=\"nofollow noopener\" target=\"_blank\">http:\/\/garr.dl.sourceforge.net\/sourceforge\/ffmpeg-php\/ffmpeg-php-x.x.x.tbz2<\/a>\ntar jxvf ffmpeg-php-x.x.x.tbz2\ncd ffmpeg-php-x.x.x\nphpize\n.\/configure\nmake\nmake install\n<\/pre>\n\n\n\n<p>It will copy the ffmpeg.so module in php default module location. Now you have to edit php.ini file to enable ffmpeg-php support in it by using ffmpeg.so module.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">vi \/etc\/php.ini\n<\/pre>\n\n\n\n<p>and append the following line<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">extension=ffmpeg.so\n<\/pre>\n\n\n\n<p>Restart Apache service to take effect of php.ini<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/etc\/init.d\/httpd restart\n<\/pre>\n\n\n\n<p>If you are getting the following error while compiling the latest release of ffmpeg-php-0.6.0, follow the below steps.<\/p>\n\n\n\n<p><b>Error<\/b><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c: In function \u00e2zim_ffmpeg_frame_toGDImage\u00e2:\n\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c:336: error: \u00e2PIX_FMT_RGBA32\u00e2 undeclared (first use in this function)\n\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c:336: error: (Each undeclared identifier is reported only once\n\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c:336: error: for each function it appears in.)\n\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c: In function \u00e2zim_ffmpeg_frame_ffmpeg_frame\u00e2:\n\/usr\/src\/ffmpeg-php-0.6.0\/ffmpeg_frame.c:421: error: \u00e2PIX_FMT_RGBA32\u00e2 undeclared (first use in this function)\nmake: *** [ffmpeg_frame.lo] Error 1\n<\/pre>\n\n\n\n<p><b>Solution<\/b><\/p>\n\n\n\n<p>Under the ffmpeg-php-0.6.0 directory modify the file: ffmpeg_frame.c with nano or vi editors and replace every instance of PIX_FMT_RGBA32 with PIX_FMT_RGB32<\/p>\n\n\n\n<p>1. vi ffmpeg_frame.c<\/p>\n\n\n\n<p>2. Search for PIX_FMT_RGBA32 and replace it with PIX_FMT_RGB32<\/p>\n\n\n\n<p>3. Exit from the editor<\/p>\n\n\n\n<p>Then run the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">cd \/usr\/local\/src\/ffmpeg-php-0.6.0\ncp -aP ffmpeg_frame.loT ffmpeg_frame.lo\nmake clean\n.\/configure\nmake\nmake install\n<\/pre>\n\n\n\n<p>This should fix the errors given above. Finally, add the ffmpeg.so extension in php.ini and check phpinfo for the server you should see ffmpeg listed.<\/p>\n\n\n\n<p>Run the following command to ffmpeg module listing in php.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">php -m | grep ffmpeg\n<\/pre>\n\n\n\n<p>Enjoy streaming!!<\/p>\n\n\n\n<div style=\"height:25px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<div class=\"wp-block-uagb-call-to-action uagb-block-c7c86a57 wp-block-button\"><div class=\"uagb-cta__wrap\"><h3 class=\"uagb-cta__title\">Feature-Rich cPanel Hosting<\/h3><p class=\"uagb-cta__desc\">Unlock powerful tools and features with our cPanel hosting. Enjoy easy website management, email accounts, and database control. Our plans are designed for performance and reliability.<\/p><\/div><div class=\"uagb-cta__buttons\"><a href=\"https:\/\/www.veeble.com\/in\/cpanel-hosting\/\" class=\"uagb-cta__button-link-wrapper wp-block-button__link\" target=\"_blank\" rel=\"noopener noreferrer\">Explore cPanel Plans<svg xmlns=\"https:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\"><path d=\"M504.3 273.6l-112.1 104c-6.992 6.484-17.18 8.218-25.94 4.406c-8.758-3.812-14.42-12.45-14.42-21.1L351.9 288H32C14.33 288 .0002 273.7 .0002 255.1S14.33 224 32 224h319.9l0-72c0-9.547 5.66-18.19 14.42-22c8.754-3.809 18.95-2.075 25.94 4.41l112.1 104C514.6 247.9 514.6 264.1 504.3 273.6z\"><\/path><\/svg><\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>This article describes how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert\/manipulate videos easily on CentOS 5.x. If you [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":8654,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_uag_custom_page_level_css":"","site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"set","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[3],"tags":[],"class_list":["post-161","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-installation"],"uagb_featured_image_src":{"full":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x.jpg",1366,768,false],"thumbnail":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x-150x150.jpg",150,150,true],"medium":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x-300x169.jpg",300,169,true],"medium_large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x-768x432.jpg",768,432,true],"large":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x-1024x576.jpg",1024,576,true],"1536x1536":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x.jpg",1366,768,false],"2048x2048":["https:\/\/www.veeble.com\/kb\/wp-content\/uploads\/2015\/04\/Install-FFmpeg-MPlayer-FFmpeg\u2011PHP-on-CentOS-5.x.jpg",1366,768,false]},"uagb_author_info":{"display_name":"Vipin Raj","author_link":"https:\/\/www.veeble.com\/kb\/author\/vipin\/"},"uagb_comment_info":0,"uagb_excerpt":"This article describes how to install ffmpeg, mplayer, mencoder, flvtool2, ffmpeg-php with all supported codecs to convert\/manipulate videos easily on CentOS 5.x. If you [&hellip;]","_links":{"self":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/161","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/comments?post=161"}],"version-history":[{"count":4,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/161\/revisions"}],"predecessor-version":[{"id":8653,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/posts\/161\/revisions\/8653"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media\/8654"}],"wp:attachment":[{"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/media?parent=161"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/categories?post=161"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.veeble.com\/kb\/wp-json\/wp\/v2\/tags?post=161"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}