它做爲迄今爲止最流行的一個開源多媒體框架之一,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
上面結果可見,不少依賴包被安裝!