配置ffmpeg的configure時,找不到x265的錯誤
./configure --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libx264 --enable-libx265 --prefix=../ffmpeg
#輸出還是會報錯
ERROR: x265 not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
首先pkg-config --list-all | grep x265看看pkg-config有沒有找到x265.pc
沒找到則需要配置下
pkg-config --list-all | grep x265 #看看有沒有輸出x265相關資訊
echo $PKG_PKG_CONFIG_PATH #看看有沒有找到x265.pc
export PKG_PKG_CONFIG_PATH=$PKG_PKG_CONFIG_PATH:/path/x264/lib/pkgconfig:/path/x265/lib/pkgconfig #替換成你的路徑
pkg-config --list-all | grep x265 #可以找到x265路徑了
以上步驟都是必須確認的 再次執行
./configure --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libx264 --enable-libx265 --prefix=../ffmpeg
#輸出還是會報錯
ERROR: x265 not found using pkg-config
If you think configure made a mistake, make sure you are using the latest
version from Git. If the latest version fails, report the problem to the
ffmpeg-user@ffmpeg.org mailing list or IRC #ffmpeg on irc.freenode.net.
Include the log file "ffbuild/config.log" produced by configure as this will help
solve the problem.
經過查資料得知
configure還需要加上
--extra-libs="-lpthread" --pkg-config-flags="--static"
於是
./configure --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libx264 --enable-libx265 --prefix=../ffmpeg --extra-libs="-lpthread" --pkg-config-flags="--static"
#終於成功了
install prefix ../ffmpeg
source path .
C compiler gcc
C library glibc
ARCH x86 (generic)
big-endian no
runtime cpu detection yes
standalone assembly yes
x86 assembler nasm
MMX enabled yes
MMXEXT enabled yes
3DNow! enabled yes
3DNow! extended enabled yes
SSE enabled yes
SSSE3 enabled yes
AESNI enabled yes
... #中間省略1萬字
Enabled indevs:
alsa fbdev lavfi oss v4l2 xcbgrab
Enabled outdevs:
alsa fbdev oss v4l2
License: nonfree and unredistributable
後面編譯
make -j12 #電腦又多少個核心就-j幾
GEN libavutil/libavutil.version
GEN libswscale/libswscale.version
GEN libswresample/libswresample.version
GEN libpostproc/libpostproc.version
GEN libavcodec/libavcodec.version
GEN libavformat/libavformat.version
GEN libavfilter/libavfilter.version
GEN libavdevice/libavdevice.version
CC libavdevice/alldevices.o
CC libavdevice/alsa.o
CC libavdevice/alsa_dec.o
CC libavdevice/alsa_enc.o
CC libavdevice/avdevice.o
CC libavdevice/fbdev_common.o
CC libavdevice/fbdev_dec.o
CC libavdevice/fbdev_enc.o
CC libavdevice/lavfi.o
CC libavdevice/oss.o
... #中間省略一萬字
...
LD libavcodec/libavcodec.so.58
LD libavformat/libavformat.so.58
LD libavfilter/libavfilter.so.7
LD libavdevice/libavdevice.so.58
LD ffmpeg_g
LD ffprobe_g
STRIP ffprobe
STRIP ffmpeg
#編譯成功
make install #安裝
最後把安裝的路徑新增到PATH裡面就可以隨時呼叫了
https://www.octfgroup.com/