Centos

在 RHEL/CentOS 上安裝 FFMPEG

  • April 5, 2019

我一直在尋找幾個小時,並嘗試在我的 CentOS 伺服器上安裝 FFMPEG 的各種方法。這是我目前在我的 Ubuntu 桌面上安裝的:

FFmpeg version 0.6.2-4:0.6.2-1ubuntu1.1, Copyright (c) 2000-2010 the Libav developers
 built on Sep 16 2011 17:00:39 with gcc 4.5.2
 configuration: --extra-version=4:0.6.2-1ubuntu1.1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-vaapi --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394 --enable-shared --disable-static
 WARNING: library configuration mismatch
 libavutil   configuration: --extra-version=4:0.6.2-1ubuntu2+medibuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static
 libavcodec  configuration: --extra-version=4:0.6.2-1ubuntu2+medibuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static
 libswscale  configuration: --extra-version=4:0.6.2-1ubuntu2+medibuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static
 libpostproc configuration: --extra-version=4:0.6.2-1ubuntu2+medibuntu1 --prefix=/usr --enable-avfilter --enable-avfilter-lavf --enable-vdpau --enable-bzlib --enable-libdirac --enable-libgsm --enable-libopenjpeg --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx --disable-stripping --enable-runtime-cpudetect --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 --enable-vaapi --enable-libopenjpeg --enable-libfaac --enable-nonfree --enable-gpl --enable-postproc --enable-swscale --enable-x11grab --enable-libfaad --enable-libdirac --enable-libfaad --enable-libmp3lame --enable-librtmp --enable-libx264 --enable-libxvid --enable-libdc1394 --enable-shared --disable-static
 libavutil     50.15. 1 / 50.15. 1
 libavcodec    52.72. 2 / 52.72. 2
 libavformat   52.64. 2 / 52.64. 2
 libavdevice   52. 2. 0 / 52. 2. 0
 libavfilter    1.19. 0 /  1.19. 0
 libswscale     0.11. 0 /  0.11. 0
 libpostproc   51. 2. 0 / 51. 2. 0
Use -h to get full help or, even better, run 'man ffmpeg'
Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

我特別感興趣--enable-librtmp,因為我需要使用 FFMPEG 流式傳輸到 RTMP 伺服器。

我已經學習了許多教程(特別是讓我安裝了一個不再存在 x| 的 DAG 儲存庫),但並沒有太多的運氣。如何在我的伺服器上安裝它並提供我需要的功能?

您可以從原始碼安裝它:

svn checkout svn://svn.ffmpeg.org/ffmpeg/trunk ffmpeg
cd ffmpeg
./configure
make

然後作為根:

make install

在執行上述步驟之前,請檢查 ffmpeg 的依賴項列表。確保您擁有所有必要的軟體包。或者,也可以從原始碼安裝依賴項。例如,要編譯 faac 和 faad,請從 audiocoding.com 下載並提取 faac 和 faad。

如上,執行

./configure
make
su -c 'make install'

如果您需要 mp3 支持,請安裝 LAME。

下載編解碼器:

git clone git://git.videolan.org/x264.git
cd x264
./configure
make

在“配置 ffmpeg”時,您可以指定要啟用的模組,而不僅僅是鍵入“./configure”,如下所示:

./configure –enable-gpl –enable-nonfree –enable-pthreads –enable-libx264 –enable-libfaac –enable-libfaad –enable-libmp3lame

然後做:

su -c 'make install'

引用自:https://unix.stackexchange.com/questions/25381