centos6.3安裝ffmpeg+x264

一.編譯安裝過程

注意是參考[1],但有問題。

  1. 安裝nasm
    wget https://www.nasm.us/pub/nasm/releasebuilds/2.14/nasm-2.14.tar.gz
    tar xvf nasm-2.14.tar.gz
    cd nasm-2.14/
    ./configure --enable-shared --prefix=/home/work/zxc/video_install/ffmpeg/x64/
    make && make install
    export PATH=$PATH:/home/work/zxc/video_install/ffmpeg/x64/bin
    或者修改/etc/profile,執行source /etc/profile
  2. 安裝x264
    wget http://download.videolan.org/pub/videolan/x264/snapshots/last_stable_x264.tar.bz2
    bzip2 -d last_stable_x264.tar.bz2
    tar -xvf last_stable_x264.tar
    cd x264-snapshot-20181112-2245-stable/
    ./configure --enable-shared --prefix=/home/work/zxc/video_install/ffmpeg/x64/
    make && make install
  3. 安裝ffmpeg
    wget https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2
    bzip2 -d ffmpeg-4.1.tar.bz2
    tar -xvf ffmpeg-4.1.tar
    cd ffmpeg-4.1/
    ./configure --enable-shared --enable-gpl --enable-libx264 --prefix=/home/work/zxc/video_install/ffmpeg/x64/ --extra-cflags=-I/home/work/zxc/video_install/ffmpeg/x64/include --extra-ldflags=-L/home/work/zxc/video_install/ffmpeg/x64/lib
    make && make install

二.ffmpeg編譯安裝報錯

(1)執行ffmpeg報錯, ffmpeg: error while loading shared libraries: libavdevice.so.55: cannot open shared object file: No such file or directory。
原因:沒有添加編解碼器庫 ldconfig 路徑
解決方法:參考[2],編輯/etc/ld.so.conf,然後執行ldconfig保存,我這裏發現兩個地方有libavdevice.so文件,都添加才執行ffmpeg成功。

# vim /etc/ld.so.conf
/usr/local/lib
/home/work/zxc/video_install/ffmpeg/x64/lib

另外,需要注意如果想用ffplay播放視頻,是需要圖形界面的,linux不支持。

三.references

[1] https://blog.csdn.net/smilefyx/article/details/32714743
[2] https://stackoverflow.com/questions/12901706/ffmpeg-error-in-linux ffmpeg出錯解決

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章