它做为迄今为止最流行的一个开源多媒体框架之一,FFmpeg有两种基本使用方式——做为库或者做为工具,其中后者的使用场景更多,同时它也被称为多媒体开发的“瑞士军刀”。详见html
FFmpeg有不少使用场景,其中较为典型的有播放器、媒体编辑器、云转码等等。vim
FFmpeg官网bash
下载ffmpeg源码包:地址框架
安装ffmpeg依赖编辑器
yum install -y yasm
# 下载源码包后解压: $ tar xvJf ffmpeg-4.1.tar.xz $ cd ffmpeg-4.1 $ ./configure --enable-shared --prefix=/usr/local/ffmpeg # 时间比较久...
编辑 /etc/ld.so.conf
,将ffmpeg依赖的库加入系统环境:工具
$ vim /etc/ld.so.conf # 输入如下内容 include ld.so.conf.d/*.conf /usr/local/ffmpeg/lib/ $ ldconfig # 使上述配置生效
加入系统命令:post
$ ln -s /usr/local/ffmpeg/bin/ffmpeg /usr/bin/ffmpeg
检查安装结果:ui
[root@trancecode-204 bin]# ffmpeg -version ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36) configuration: --enable-shared --prefix=/usr/local/ffmpeg libavutil 56. 22.100 / 56. 22.100 libavcodec 58. 35.100 / 58. 35.100 libavformat 58. 20.100 / 58. 20.100 libavdevice 58. 5.100 / 58. 5.100 libavfilter 7. 40.101 / 7. 40.101 libswscale 5. 3.100 / 5. 3.100 libswresample 3. 3.100 / 3. 3.100
出现以上输出,表示基础版ffmpeg安装完成,请继续往下看!!!spa
使用上述方法编译安装,只是安装了ffmpeg的基础包,具体生产环境中可能会由于缺乏某些依赖包而报错。固然,你能够逐个安装因此的依赖包,可是这样操做太麻烦了,使用yum安装会一次性把全部依赖装上,接下来使用yum安装:.net
$ yum install -y epel-release # 安装Nux Dextop Yum 源 $ rpm --import http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro $ rpm -Uvh http://li.nux.ro/download/nux/dextop/el7/x86_64/nux-dextop-release-0-5.el7.nux.noarch.rpm ## 配置RPM-GPG-KEY可能报错,可是只要nux-dextop安装成功就能够忽略上述错误 $ yum install -y ffmpeg ffmpeg-devel $ ffmpeg -version ffmpeg version 2.8.15 Copyright (c) 2000-2018 the FFmpeg developers built with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-36) configuration: --prefix=/usr --bindir=/usr/bin --datadir=/usr/share/ffmpeg --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --optflags='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic' --extra-ldflags='-Wl,-z,relro ' --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libvo-amrwbenc --enable-version3 --enable-bzlib --disable-crystalhd --enable-gnutls --enable-ladspa --enable-libass --enable-libcdio --enable-libdc1394 --enable-libfdk-aac --enable-nonfree --disable-indev=jack --enable-libfreetype --enable-libgsm --enable-libmp3lame --enable-openal --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-libschroedinger --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvorbis --enable-libv4l2 --enable-libx264 --enable-libx265 --enable-libxvid --enable-x11grab --enable-avfilter --enable-avresample --enable-postproc --enable-pthreads --disable-static --enable-shared --enable-gpl --disable-debug --disable-stripping --shlibdir=/usr/lib64 --enable-runtime-cpudetect libavutil 54. 31.100 / 54. 31.100 libavcodec 56. 60.100 / 56. 60.100 libavformat 56. 40.101 / 56. 40.101 libavdevice 56. 4.100 / 56. 4.100 libavfilter 5. 40.101 / 5. 40.101 libavresample 2. 1. 0 / 2. 1. 0 libswscale 3. 1.101 / 3. 1.101 libswresample 1. 2.101 / 1. 2.101 libpostproc 53. 3.100 / 53. 3.100
上面结果可见,不少依赖包被安装!