Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Compiling FFMPEG x265 not found using pkg-config

I'm trying to compile FFMPEG with x265 on Win10. I am using the latest full MinGW build from xhmikosr found at:

http://xhmikosr.1f0.de/tools/msys/

FFMEPG without x265 compiles without problems and compiling x265 standalone works without problems too. However when i --enable-libx265 in ffmpeg i get the following error:

ERROR: x265 not found using pkg-config

and this from the config.log:

require_pkg_config libx265 x265 x265.h x265_api_get
check_pkg_config libx265 x265 x265.h x265_api_get
test_pkg_config libx265 x265 x265.h x265_api_get
false --exists --print-errors x265
ERROR: x265 not found using pkg-config

my config paths seem to be all set correct.

$ echo $PKG_CONFIG_PATH
C:\MYSYS\local\x86_64-w64-mingw32\lib\pkgconfig

and when i look for the libraries x265 is there:

$ pkg-config --list-all
...
x265          x265 - H.265/HEVC video encoder
...

and here the debug log:

$ pkg-config --debug
...
File 'x265.pc' appears to be a .pc file
Will find package 'x265' in file 'C:/MYSYS/local/x86_64-w64-mingw32/lib/pkgconfig\x265.pc'
...

Why does pkg-config still not find the x265 libraries when i try to compile?

like image 289
secondplace Avatar asked Aug 19 '18 13:08

secondplace


3 Answers

x265.pc sometimes doesn't located in "/usr/local/lib/pkgconfig" and instead it is located in "/usr/lib/arm-linux-gnueabihf/pkgconfig/", so, you needs to include it in the export also .

export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig/:/usr/local/lib/pkgconfig/
like image 50
M Y Avatar answered Oct 26 '22 11:10

M Y


After much trial and error, I believe I have found a solution and the root cause under Ubuntu 16.04. This solution may work for other variants of Ubuntu as well.


If you run into the Package Config error described in this thread, try installing the default (repository based) libraries first, and then install your custom version with your ffmpeg build script.

Run these commands as needed prior to running your custom script to compile ffmpeg and your dependent libraries (e.g. x265) from source:

apt install -y libx265-dev

If another library fails, try the same technique and then run your script again to see if it works. For example, some people report compiling ffmpeg from source complains about gnutls. The solution for Ubuntu 16.04 is to first install it via apt and then run your script.

apt install -y gnutls-dev

If you're hung up at compiling the x264 libraries (for H.264 support), simply run this before running your script:

apt install -y libx264-dev

As long as your new script overwrites the old files and does not purge them, this method will work.

Background/History

The source of the problem dates back to at least 2017, and despite numerous claims it does not appear to have actually been fixed. One can find references in various forums and websites of frustrated users unable to get their compile to work correctly regardless of the version of the ffmpeg build, such as here.

It's a difficult problem to solve partly because the VLC Developer instructions for installing x265 library support are broken. Furthermore, the archive of information explaining this problem and how to solve it is no longer available, due to BitBucket's decision to sunset Mercurial support earlier this year. Most archived forum posts explaining the problem and how to solve it are gone. There are a few clues still to be found on GitHub, but they are incomplete snippets of information on the topic; none offer a complete perspective.

Installing ffmpeg from scratch is bound to cause headaches for nearly anyone. NONE of the scripts I found online (dozens) worked correctly as described. Most of the problems with them are incorrect/outdated links. Solutions with GitHub links appear to be the most consistently reliable. Others should be avoided (e.g. hg, which is no longer supported as mentioned above).

like image 34
MrPotatoHead Avatar answered Oct 26 '22 11:10

MrPotatoHead


It's need more library. Please install "libnuma".

like image 36
Patrickz Avatar answered Oct 26 '22 12:10

Patrickz