`
bzhang
  • 浏览: 254923 次
  • 性别: Icon_minigender_1
  • 来自: 大连
社区版块
存档分类
最新评论

how to install ffmpeg

阅读更多
A little while back, I posted a basic install of ffmpeg for CentOS 5. After working with that build over the last month, I found I needed to expand it to include many different video codecs. Because of licensing restrictions, binaries of the build cannot be distributed. However, instructions for a similar build can! I spent several days (or more) researching the packages I would need and I must have combed dozens of blogs to find this information. The build I made strips sound from videos [See update at the end of this post for more information on this subject], this decreases the final file size. If you need sound, you will not want to follow these steps exactly. I also stripped ffserver and ffplay from my build.

These packages were executed in the following order. I cannot say for certain this exact order must be followed, it was the order in which ffmpeg threw the errors. This tutorial assumes you have wget, bzip2, tar and subversion installed on your system. If you do not, please find and install the lastest versions of these utilities for CentOS 5. Additionally, I have allowed all packages to install into their default directories, typically this is /usr/local/[bin | lib]. If at any point during the process of a ‘make’ you run into errors, be sure and run ‘make clean’ before running ‘make’ again. You will either need root access of su access to install ffmpeg. The marker ‘codec:$’ is my prompt, it is merely to indicate separate commands.

    * Package a52
    * Package FAAD2
    * Package FAAC
    * Package LAME
    * Package yasm
    * Package X264
    * Package Xvid
    * Package libraw1394
    * Package libdc1394

Getting Started


codec:$
codec:$ mkdir -p ./tmp/ffmpeg-packages
codec:$ cd ./tmp/ffmpeg-packages

Installing a52


codec:$ wget http://liba52.sourceforge.net/files/a52dec-0.7.4.tar.gz
codec:$ tar -zxf a52dec-0.7.4.tar.gz
codec:$ cd a52dec-0.7.4
codec:$ ./configure --enable-shared=PKGS
codec:$ make && make install
codec:$ cd ..

Installing FAAD2


codec:$ wget http://downloads.sourceforge.net/faac/faad2-2.6.1.tar.gz
codec:$ tar zxf faad2-2.6.1.tar.gz
codec:$ cd faad2
codec:$ autoreconf -vif
codec:$ ./configure --disable-drm --disable-mpeg4ip
codec:$ make && make install
codec:$ cd ..

Installing FAAC


codec:$ wget http://downloads.sourceforge.net/faac/faac-1.26.tar.gz
codec:$ tar zxfv faac-1.26.tar.gz
codec:$ cd faac
codec:$ ./bootstrap
codec:$ ./configure --disable-mp4v2
codec:$ make && make install
codec:$ cd ..

Installing LAME


codec:$ wget \
http://superb-east.dl.sourceforge.net/sourceforge/lame/\
lame-3.98b8.tar.gz
codec:$ tar zxfv lame-3.98b8.tar.gz
codec:$ cd lame-3.98b8
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing yasm

YASM is a modular assembler, it is required by the x264 package.


codec:$ wget \
http://www.tortall.net/projects/yasm/releases/yasm-0.7.0.tar.gz
codec:$ tar zfvx yasm-0.7.0.tar.gz
codec:$ cd yasm-0.7.0
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing x264
The x264 package is under git revision control, which is much like CVS or SVN. Thankfully, they provide daily tarballs. I grabbed this one:


codec:$ wget \
ftp://ftp.videolan.org:21//pub/videolan/x264/snapshots/\
x264-snapshot-20080513-2245.tar.bz2

I just did a little exploring via an FTP program to find the snapshot I was after. If you are feeling adventurous, download git and try checking out the latest version from their repository.


codec:$ bzip2 -d x264-snapshot-20080513-2245.tar.bz2
codec:$ tar xfv x264-snapshot-20080513-2245.tar
codec:$ cd x264-snapshot-20080513-2245
codec:$ ./configure --enable-mp4-output --enable-shared --enable-pthread
codec:$ make && make install
codec:$ cd ..

Installing Xvid


codec:$ wget http://downloads.xvid.org/downloads/xvidcore-1.1.3.tar.gz
codec:$ tar zxfv xvidcore-1.1.3.tar.gz
codec:$ cd xvidcore-1.1.3/build/generic
codec:$ ./configure
codec:$ make && make install
codec:$ cd ../../..

Installing libraw1394


codec:$ wget http://www.linux1394.org/dl/libraw1394-1.3.0.tar.gz
codec:$ tar zxfv libraw1394-1.3.0.tar.gz
codec:$ cd libraw1394-1.3.0
codec:$ ./configure
codec:$ make dev
codec:$ make && make install
codec:$ cd ..

Installing libdc1394

This project requires libraw1394, you must build it first. This project is a little confusing there is both a libdc1394 and a libdc1394-2. I have only installed the former. Visit Sourceforge here. I grabbed the tarball here:


codec:$ wget \
http://superb-west.dl.sourceforge.net/sourceforge/libdc1394/\
libdc1394-1.2.2.tar.gz
codec:$ tar zxfv libdc1394-1.2.2.tar.gz
codec:$ cd libdc1394-1.2.2
codec:$ ./configure
codec:$ make && make install
codec:$ cd ..

Installing ffmpeg

For FFMPEG, you will need to get the latest out of SVN. FFMPEG doesn’t ever make releases. To do so, run:


codec:$ svn checkout svn://svn.mplayerhq.hu/ffmpeg/trunk ffmpeg
codec:$ cd ffmpeg


codec:$ ./configure --enable-gpl --enable-postproc --enable-nonfree --enable-postproc --enable-libfaad --enable-swscale --enable-avfilter --enable-pthreads --enable-libxvid --enable-libx264 --enable-libmp3lame --enable-libdc1394 --enable-liba52 --enable-libfaac --disable-ffserver --disable-ffplay
codec:$ make
codec:$ make install

It usually takes at least 5 mins for ‘make’ to run, be sure you have a good file before attempting to install. You will need to be sure and run the ldconfig setting if you have to re-compile, otherwise ffmpeg will throw an error that it cannot find library files. Here is a good resource for using ffmpeg.

Post-Installation Actions

After the install in complete, you may need to add the /usr/local/lib directory to your ld.so.config file. Do the following:


codec:$ cd /etc/
codec:$ cd ld.so.conf.d
codec:$ vi ffmpeg.conf

You need to add ‘/usr/local/lib’ [sans-quotes] to this file and save it. Press Esc, :, x to do so in vi. Afterwords you need to run the following from the commandline


codec:$ ldconfig

That’s it, you now have a fairly robust build of ffmpeg that can take almost anything you can throw at it. Sadly, licensing restrictions prevent binaries from being made of the above steps. Happy (video) encoding!

Update: This build doesn’t actually strip sound from videos, I am doing that with a flag when I run ffmpeg, however, it should be noted that all the audio codecs you may find in many common video formats may not be supported in this build of ffmpeg, which is why I am choosing to strip audio entirely from videos.


-------------------------------------------------------------------------------

下边是另一篇

1. 所需的 RPM 包
引用:

    gcc, gcc-c++, gcc-g77, glibc, glibc-devel, autoconf, automake, libtool, libtool-libs, freetype freetype-devel, libvorbis, libvorbis-devel, libogg, libogg-devel

上述 RPM 包可以通过 yum (仅限 CentOS Linux)自动安装,如果是 Red Hat Linux,请从安装光盘中提取这些 RPM 包手动安装。

2. 以 root 身份登录服务器

3. 创建软件包存放处理目录
复制内容到剪贴板
代码:
# mkdir /usr/local/src/video
二、安装播客视频/音频环境
1. 下载并解压 FFmpeg 集合包
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/FFmpeg.tar.bz2
# tar xjvf FFmpeg.tar.bz2
2. 安装 MP3 编码器
复制内容到剪贴板
代码:
# cd /usr/local/src/video/FFmpeg/lame-3.97
# ./configure   --prefix=/usr --enable-shared
# make
# make install
3. 安装 XVid 编码器
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/xvidcore-1.1.0.tar.gz
# tar xzvf xvidcore-1.1.0.tar.gz
# cd xvidcore-1.1.0/build/generic
# ./configure --prefix=/usr
# make
# make install
4. 安装 yasm 汇编器
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/yasm-0.6.0.tar.gz
# tar xzvf yasm-0.6.0.tar.gz
# cd yasm-0.6.0
# ./configure --prefix=/usr/local/yasm
# make
# make install
将 yasm 加入系统环境变量
复制内容到剪贴板
代码:
# export PATH="$PATH:/usr/local/yasm/bin"
5. 安装 x264 编码器
*注:截至本文档发布日期止,x264 官方最新版存在问题,无法在 2 路以上 CPU 的 Intel 系统架构(如:双至强 CPU,四至强 CPU 服务器)中正常编译安装。Comsenz 为此特别对软件进行了修正,请下载 Comsenz 修正版的 x264 软件包!
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/x264-linux-Comsenz.tar.bz2
# tar xjvf x264-linux-Comsenz.tar.bz2
# cd x264-linux-Comsenz
# ./configure --prefix=/usr --enable-shared
# make
# make install
6. 安装 LibDTS 编码器
复制内容到剪贴板
代码:
# cd /usr/local/src/video/FFmpeg/libdts
# ./configure --prefix=/usr
# make
# make install
7. 安装 MPEG-4 AAC 编码器
*注:截至本文档发布日期止,MPEG-4 AAC 编码支持所需的 faad 和 faac 最新软件代码存在问题,无法正常编译安装成功。Comsenz 为此特别对软件进行了修正,请下载 Comsenz 修正版的 faad 和 faac!
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/faac-1.25-Comsenz.tar.bz2
# wget http://download.discuz.net/env/video/faad2-2.5-Comsenz.tar.bz2
(1) 安装 faad
复制内容到剪贴板
代码:
# tar xjvf faad2-2.5-Comsenz.tar.bz2
# cd faad2-Comsenz
# autoreconf -vif
# ./configure --prefix=/usr --with-mp4v2 --enable-shared
# make
# make install
(2) 安装 faac
复制内容到剪贴板
代码:
# cd /usr/local/video/
# tar xjvf faac-1.25-Comsenz.tar.bz2
# cd faac-Comsenz
# autoreconf -vif
# ./configure --prefix=/usr --with-mp4v2 --enable-shared
# make
# make install
8. 安装 FFmpeg 编码器
复制内容到剪贴板
代码:
# cd /usr/local/src/video/FFmpeg/FFmpeg
# ./configure \
   '--prefix=/usr' \
   '--enable-gpl' \
   '--enable-shared' \
   '--enable-mp3lame' \
   '--enable-amr_nb' \
   '--enable-amr_wb' \
   '--enable-amr_if2' \
   '--enable-libogg' \
   '--enable-vorbis' \
   '--enable-xvid' \
   '--enable-a52' \
   '--enable-a52bin' \
   '--enable-faadbin' \
   '--enable-dts' \
   '--enable-pp' \
   '--enable-faad' \
   '--enable-faac' \
   '--enable-x264' \
   '--enable-pthreads' \
   '--disable-ffserver' \
   '--disable-ffplay'
# make
# make install
至此,博客视频/音频转码支持安装完毕!


三、设定视频转换计划任务
1. 下载视频文件转换脚本程序
复制内容到剪贴板
代码:
# cd /usr/local/src/video
# wget http://download.discuz.net/env/video/convert-linux.zip
2. 准备脚本程序
复制内容到剪贴板
代码:

# unzip convert-linux.zip
# cp convert /usr/local/sbin/convert_av.sh
# chmod 777 /usr/local/sbin/convert_av.sh

mencoder安装篇

1、下载主程序: MPlayer-1.0rc1.tar.bz2

2、下载essential-20061022.tar.bz2,安装:
tar vjxf essential-20061022.tar.bz2
mv essential-20061022 /usr/lib/codes
chmod 644 /usr/lib/codes/*
chown root.root /usr/lib/codes/*

3、下载windows-essential-20061022.zip,安装:
unzip windows-essential-20061022.zip
mv windows-essential-20061022 /usr/lib/wincodes
chmod 644 /usr/lib/wincodes/*
chown root.root /usr/lib/wincodes/*

4、安装mplayer

tar vjxf MPlayer-1.0rc1.tar.bz2
cd MPlayer-1.0rc1
./configure --prefix=/usr/local/mplayer/ --enable-freetype --with-codecsdir=/usr/lib/codes/ --with-win32libdir=/usr/lib/wincodes/ --disable-gcc-check --language=zh_CN

make

make install

如果你需要使用mplayer在linux下播放视频,还需要加上--enable-gui(图形界面),不过这样就要安装多很多东西了,这里我们只使用它的mencoder,所以--enable-gui可以省略
分享到:
评论

相关推荐

    ffmpeg-20191215-ed9279a-win64-static.zip

    How to Install FFmpeg on Windows? https://blog.csdn.net/mangobar/article/details/103574745 FFmpeg is the leading multimedia framework, able to decode, encode, transcode, mux, demux, stream, ...

    ffmpeg-7.0.2源码

    ffmpeg-7.0.2.tar.gz

    ffmpeg-6.1.1.tar,ffmpeg-master-latest-win64-gpl-shared

    ffmpeg-6.1.1.tar 是一个包含...ffmpeg_path = r"C:\path\to\ffmpeg\bin\ffmpeg.exe" # Windows路径示例 # ffmpeg_path = "/path/to/ffmpeg/bin/ffmpeg" # Linux/macOS路径示例 验证: 在命令行中运行ffmpeg -version

    ffmpeg_2_8_15_install.tar.gz

    在给定的压缩包 "ffmpeg_2_8_15_install.tar.gz" 中,包含了在 CentOS 7 系统上离线安装 FFmpeg 2.8.15 版本的步骤。这个版本可能是一个特定日期或为特定需求优化的稳定版本。 首先,让我们了解如何在 CentOS 7 上...

    ffmpeg linux下安装包

    sudo yum install ffmpeg 或 sudo dnf install ffmpeg ``` 但是,有时你可能想要安装FFmpeg的最新开发版本,因为它包含了最新的特性和改进。这时,你可以从源代码编译安装。 3. 从源代码编译FFmpeg: - 下载源...

    ffmpeg, use to publish stream, play stream

    ffmpeg

    ffmpeglib_ffmpegcmake_ffmpeg.cmake_ffmpeglib_

    include_directories(/path/to/ffmpeg/sources) # 链接FFmpeg库 add_library(ffmpeg REQUIRED /path/to/ffmpeg/sources/libavcodec/libavcodec.a /path/to/ffmpeg/sources/libavformat/libavformat.a /path/to/...

    Linux下安装ffmpeg所需解码器以及ffmpeg安装包(最全)

    sudo apt-get install ffmpeg ``` 对于基于RPM的系统(如Fedora、CentOS),则使用: ```bash sudo yum install ffmpeg ``` 或者,如果你的系统是较新的Fedora或CentOS,可能需要使用`dnf`: ```bash sudo dnf ...

    qt整合ffmpeg实现点击按钮显示ffmpeg版本

    在Linux系统中,通常通过包管理器安装,例如在Ubuntu上使用`sudo apt-get install libqt5serialport5-dev`和`sudo apt-get install ffmpeg`。在Windows或macOS上,可以从官方网站下载安装包。 接下来,我们需要为Qt...

    Linux一键安装ffmpeg脚本

    FFmpeg 是一个强大的开源项目,包含了众多用于处理音视频的工具,如ffmpeg命令行工具、ffprobe、ffplay等。它支持多种编码格式,可以进行音视频的编码、解码、转换、流传输等操作。在Linux环境中,手动编译安装...

    Android FFmpeg 6.1+FFmpeg 4.0.2

    FFmpeg 是一个强大的开源项目,用于处理音视频数据,包括编码、解码、转换、流媒体等任务。在Android平台上,FFmpeg的使用为开发者提供了处理多媒体内容的强大工具。本资源包含了FFmpeg 6.1和4.0.2两个版本,支持32...

    linux下ffmpeg获取视频流

    sudo apt-get install ffmpeg ``` 在CentOS/RHEL上: ```bash sudo yum install epel-release sudo yum install ffmpeg ``` 三、获取视频流 获取视频流通常涉及从网络源或本地文件读取视频数据。以下是一些基本的...

    ffmpeg3.3 linux版本

    sudo apt-get install ffmpeg 或 sudo yum install ffmpeg ``` 如果你已经下载了名为`ffmpeg-3.3`的压缩包,需要先解压并编译安装。解压命令如下: ```bash tar -zxvf ffmpeg-3.3 cd ffmpeg-3.3 ./configure --...

    linux 下ffmpeg安装包

    sudo apt-get install ffmpeg ``` 对于Fedora或CentOS用户,可以使用: ``` sudo yum install ffmpeg ``` 或者使用DNF(在较新的版本中): ``` sudo dnf install ffmpeg ``` 2. 编译源代码安装:如果需要最新版或...

    FFmpeg使用手册(FFmpeg官方文档中文翻译)

    - 编译安装:遵循官方文档的编译步骤,通常包括configure、make和make install三步。 - 包管理器安装:Linux系统下可使用apt、yum等包管理器进行安装。 综上所述,FFmpeg使用手册(FFmpeg官方文档中文翻译)提供了...

    linux上使用ffmpeg 实现视频截图

    sudo apt-get install ffmpeg ``` 在Java程序中,我们可以使用Runtime类或者更高级的ProcessBuilder类来执行FFmpeg命令。以下是一个简单的示例,展示了如何在特定时间点截取视频: ```java import java.io....

    Linux服务器安装ffmpeg+libx264+libmp3lame

    最后,解压 FFmpeg 包,运行 `./configure` 带上必要的选项,如 `--enable-gpl --enable-libx264 --enable-libmp3lame`,然后 `make` 和 `make install`。安装完成后,通过 `ffmpeg --version` 检查版本。 7. **...

    Linux下FFmpeg的安装包

    编译完成后,使用`sudo make install`将FFmpeg安装到系统路径: ```bash sudo make install ``` 安装完成后,FFmpeg的命令行工具就可以在全局路径下使用了。你可以通过`ffmpeg -version`来检查安装是否成功。 ...

    simplest_ffmpeg_audio_player_2.2_qt-framework

    $> 移植的原因:要在Qt框架下使用FFmpeg开发嵌入式Linux流媒体的应用,但官方用例是纯C的,网上很多是在Win平台下的, 又或者是基于STD C++的. ...$> 最简单的安装是 sudo apt install ffmpeg //但不是最优的。

    演示C#如何调用ffmpeg API_FFmpeg.AutoGen_ffmpeg

    在本文中,我们将深入探讨如何在C#环境中利用FFmpeg.AutoGen库来调用FFmpeg API,以便处理视频和音频任务。FFmpeg是一个强大的开源工具集,用于处理多媒体数据,包括转换、编码、解码、流媒体等。而FFmpeg.AutoGen是...

Global site tag (gtag.js) - Google Analytics