FFmpeg is an amazing collection of open-source tools that can record and stream video and audio. However, it can also transcode video and audio (convert the files to different formats), and that is what has me so excited. There’s also a great PHP package calledffmpeg-php that allows for easy use of FFmpeg from inside PHP scripts. Today, I’m going to see if I can’t help you get both of these set up on your system.
Admittedly, it’s been a while since I’ve tried to install FFmpeg, about two years. I recently thought up some ideas on how I’d like to use FFmpeg, so I thought it was time to give it a try yet again. Today, I’m proud to say that installing FFmpeg is so much easier to install compared to the past, that I dare say it’s simple.
Here is my experience with installing FFmpeg on my server and how to fix the pitfalls that I encountered.
Preface
Note that I did all the following steps on a CentOS server. The specific version is CentOS x64 5.2.
These instructions can work for other distros with little or no modifications, but some distros will be completely different. For example, the DAG RPM Repository that I’m using (more info below) has support for the following distros: Red Hat Enterprise Linux, Fedora Core, Yellow Dog Linux, Aurora Linux, CentOS, Scientific Linux (they really need to get a verified SSL cert), TaoLinux, WhiteBox Linux, Lineox, and BLAG. Other distros will need to use a different repository.
If you successfully get FFmpeg running on another distro, please comment your changes here and I’ll update the post (and make sure you get credit of course).
Also note that I experienced some bumps in the road while installing everything. While many of you may not experience these issues, I found it important to document these problems and how I fixed them in case you encounter them.
Preparing
The first thing that you need to do is set up the DAG repository. This repository is an actively-maintained repository that provides a staggering number of packages with current or near current builds. Adding this repository is a great way to run the latest offerings of many packages.
Adding the DAG repository is simple. I’m using yum, so I did the following to add the repository:
- Create and open a new file called /etc/yum.repos.d/dag.repo. I ran “
vi /etc/yum.repos.d/dag.repo
“. - Add the following text to the file:
[dag]
name=DAG RPM Repository
baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
gpgcheck=1
enabled=1 - Finally, save and close the file.
In order to successfully use the DAG repository with tools such as yum, you need to add DAG’s GPG key. Failure to do so will result in an error like the following:
warning: rpmts_HdrFromFdno: Header V3 DSA signature: NOKEY, key ID 6b8d79e6
Public key for faac.x86_64.1.26-1.el5.rf.rpm is not installed
In order to add the GPG key for DAG, run the following:
rpm --import http://apt.sw.be/RPM-GPG-KEY.dag.txt
The DAG: Frequently Asked Questions page has additional instructions on how to get the repository loaded and working on your distro.
Now that DAG is setup, it’s a good idea to update all your packages.
yum update
Depending on the packages you currently have installed, this could potentially upgrade, install, or replace numerous packages that may or may not be very important to you. Make sure you carefully look through that list and do any necessary preparations before telling yum that it can go ahead.
For example, yum told me that it was going to replace my current MySQL interface library for Perl with a new one. I added to my check list a note to verify that my Perl code functioned correctly after the install.
I ran into another hitch when I told yum to go ahead with the update. It informed me that my current version of Subversion conflicted with the new version it wanted to install. When this happens, you need to remove the old package before proceeding. This time, I made backups of all of my repositories and my /etc/sysconfig/svnserve file before proceeding just in case. I then removed Subversion “yum remove subversion
“, ran the update process “yum update
“, and installed Subversion again “yum install subversion
“.
Installing – FFmpeg
Now you are ready to install FFmpeg with yum. I wanted to install all the available FFmpeg packages, so I first asked yum what was available.
yum search ffmpeg
Searching through the results, I found that three packages need to be installed: ffmpeg, ffmpeg-devel, and ffmpeg-libpostproc.
yum install ffmpeg ffmpeg-devel ffmpeg-libpostproc
Note: If you install ffmpeg-libpostproc, the entire FFmpeg software library changes from the LGPL license to the GPL license.
After a couple of minutes, the packages and the packages that they depend on were installed.
I simply ran “ffmpeg
” from the command line, and I took the lack of threatening error or warning messages as a good sign that things were working.
Preparing for ffmpeg-php
I often work with programs through command line calls in code, but I wanted something more robust this time, so I looked around and found ffmpeg-php. Based on the API, it looks to be a great tool to interface PHP and FFmpeg.
There are four things that are required to successfully install and run ffmpeg-php; they are:
- ffmpeg-0.4.9_pre1 or higher
- php-4.3.0 or higher
- gd-2.0 or higher
- php-devel
PHP and FFmpeg should be good to go since at the time of this writing, DAG has PHP version 5.1.6 and FFmpeg version 0.4.9. GDand php-devel can be easily installed by running the following yum command:
yum install php-gd php-devel
In case you are wondering what php-devel is for, it installs the phpize program which is used to install ffmpeg-php.
Installing ffmpeg-php
Now we are ready to install ffmpeg-php. This can be done in six easy steps:
- Download the latest ffmpeg-php release
- Extract the archive:
tar -xjf ffmpeg-php-X.x.x.tbz2
cd ffmpeg-php-X.x.x/
phpize
./configure && make
sudo make install
Finishing Thoughts
This may seem like a lot of work when I earlier described this process as “simple,” but trust me that this is a thousand times easier than when I first tried installing FFmpeg. I think I spent three hours working on installing FFmpeg just to find out that it didn’t work the first time I tried.
Time and time again, package management has proven to be an extremely powerful tool. While I know the value of manually configuring and compiling code, the ease of simply using a package manager can reduce the time needed to install and manage software from hours or days to minutes.
I’m glad to see that FFmpeg has benefited from the use of these package managers and great repositories like the DAG RPM Repository.
相关推荐
windows FFmpeg 免安装压缩包 ffmpeg-6.1.1-full-build-shared
这个压缩包"ffmpeg-n5.1-latest-win64-gpl-shared-5.1" 提供的是FFmpeg库的最新版本5.1,针对64位Windows操作系统,并且是基于GPL(GNU General Public License)许可的共享版本。下面我们将深入探讨FFmpeg库的关键...
在这个“ffmpeg-n4.4-latest-win64-lgpl-shared-4.4.zip”压缩包中,包含的是 FFmpeg 的4.4版本,专为64位的Windows系统设计,并且是“共享”(shared)版本,意味着库是动态链接的,可以与其他程序共用。...
报错 Imageio: 'ffmpeg-win32-v3.2.4.exe' was not found on your computer; downloading it now. 因为代码会检测在C:\Users\Administrator\AppData\Local\imageio\ffmpeg 目录下有没有'fwmpeag-win32-v3.2.4.exe...
在Windows环境下,如果你需要在32位系统上使用FFmpeg进行开发,那么"FFMPEG-WIN32-LIB-4.2.2.zip"这个压缩包提供了必要的库文件和头文件。这个版本是4.2.2,这意味着它包含了该版本的所有功能和修复。 FFmpeg库文件...
这个“ffmpeg-win64-gpl.zip”文件是为Windows 10用户准备的FFmpeg预编译版本,包含了GPL许可证下的软件组件。以下是关于FFmpeg及其在Windows 10环境下使用的相关知识点: 1. **FFmpeg的基本概念**:FFmpeg是一套跨...
MoviePy 是一个用于视频编辑的Python库,其所需要的ffmpeg的exe文件。 解决问题:Imageio: 'ffmpeg-win32-v3.2.4.exe' was not found on your computer; downloading it now.
报错 Imageio: 'ffmpeg-win32-v3.2.4.exe' was not found on your computer; downloading it now. 因为代码会检测在C:\Users\Administrator\AppData\Local\imageio\ffmpeg 目录下有没有'fwmpeag-win32-v3.2.4....
赠送jar包:ffmpeg-4.3.2-1.5.5.jar; 赠送原API文档:ffmpeg-4.3.2-1.5.5-javadoc.jar; 赠送源代码:ffmpeg-4.3.2-1.5.5-sources.jar; 赠送Maven依赖信息文件:ffmpeg-4.3.2-1.5.5.pom; 包含翻译后的API文档:...
FFmpeg sdk 3.2 ,音视频解码器,支持众多格式。内有文档。开发方便。
ffmpeg-6.1.1.tar 是一个包含 FFmpeg 6.1.1 版本源代码的压缩包。FFmpeg 是一套能够处理多媒体数据(音频、视频、字幕等)的开源计算机程序库和命令行工具,广泛应用于音视频处理、转码、流媒体等领域1。 要使用该...
这个"ffmpeg-win32-v3.2.4"是FFmpeg的一个针对Windows 32位系统的版本,版本号为3.2.4。在本文中,我们将深入探讨FFmpeg的功能、使用方法以及它在视频采集、格式转换和帧流处理中的应用。 FFmpeg的核心功能包括: ...
在“ffmpeg-n5.1.2-win64”中,“win64”表明这是为64位Windows操作系统编译的版本。这通常意味着它可以充分利用64位系统的性能优势,处理大型媒体文件或进行复杂的多媒体转换时更加高效。 文件名“ffmpeg-n5.1.2-1...
赠送jar包:ffmpeg-4.3.2-1.5.5.jar; 赠送原API文档:ffmpeg-4.3.2-1.5.5-javadoc.jar; 赠送源代码:ffmpeg-4.3.2-1.5.5-sources.jar; 赠送Maven依赖信息文件:ffmpeg-4.3.2-1.5.5.pom; 包含翻译后的API文档:...
此压缩包包含的版本是 4.2.2,适用于 Windows 64 位操作系统,分为开发版(ffmpeg-4.2.2-win64-dev)和共享版(ffmpeg-4.2.2-win64-shared)。 1. **FFmpeg 命令行工具**: FFmpeg 的核心部分是一组命令行工具,...
在本场景中,我们关注的是"ffmpeg-win32-v3.2.4.exe"这个文件,它是FFmpeg针对Windows 32位系统的可执行版本,版本号为3.2.4。这个压缩包为Python开发者提供了一个便捷的方式,以便在使用MoviePy库进行视频编辑时...
这个压缩包包含两个部分:`ffmpeg_git_master_shared` 和 `ffmpeg-git-static`。 `ffmpeg_git_master_shared` 文件代表动态链接库版本的FFmpeg,这意味着它依赖于系统上的其他库文件来运行。这种构建方式通常占用更...
而 `ffmpeg-php` 是一个 PHP 扩展,允许 PHP 程序直接调用 FFmpeg 命令行工具进行多媒体处理,如视频截图、转码等操作。在 Windows 环境下,这个扩展尤其方便,因为 PHP 与 FFmpeg 的集成可以简化复杂的命令行交互。...
这个压缩包"ffmpeg-master-latest-win64-gpl-shared"是针对Windows 64位操作系统编译的最新FFmpeg版本,包含了动态链接库(shared),这意味着在使用时,程序会依赖这些库文件来执行各种多媒体操作。 FFmpeg 包含了...