Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
![]() |
#1 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
compiling FFMPEG with libx264... in MSYS.
i've been googling quite a lot, and unfortunately can't seem to find this specific topic covered.
i'm using ffmpeg/avconv (i'm using both really, as there's often features in one that haven't made it into the other) for a lot of fancy encoding tasks using libx264. recently, i stupidly updated my msys, and now i cannot get ffmpeg's configure to find libx264. i get "ERROR: libx264 not found". pkg-config --list-all reveals that it exists and is findable, and ffmpeg will configure and compile without it, but i really really want to have a working ffmpeg with libx264 in it... i've followed various compiling guides and reinstalled my msys environment many, many times, but somehow i seem to have lost the ability to do what i want. i'm not a coder - just barely a compiler, so i was wondering if anyone was doing this successfully from the current git versions of ffmpeg, libav, and x264. thanks! [edit] btw, i don't really have the option to just do it in linux - this is a work computer and stuck in 32 bit winxp. installing cygwin would be a bit sledgehammer-to-crack-an-egg, but i'll do it if there's no other way. i could try on my ubuntu eeepc, but i'd lose the ability to fprofile meaningfully on the machine i'm actually going to run it on.
__________________
sucking the life out of your videos since 2004 |
![]() |
![]() |
![]() |
#2 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
What does config.log say? I think I'm going to guess at a mismatch between pthreads and win32 threads.
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. |
![]() |
![]() |
![]() |
#3 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
oh, i've read a little of that pthreads thing while googling for this issue, but tried compiling without threads for both libx264 and ffmpeg and didn't seem to get anywhere with it. i'll definitely give it a shot.
i'm just running a make clean and running configure again to give you a log file (i've since compiled this tree without libx264 so i could rush out some mpeg-2 stuff). if this is a pthreads thing, what would be a good way to fix it? here's the last bit of config.log: Code:
gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -std=c99 -fno-common -fomit-frame-pointer -c -o /tmp/ffconf.HAcWEfVO.o /tmp/ffconf.PZXVhpnj.c gcc -Wl,--as-needed -o /tmp/ffconf.pRVOZOgl.exe /tmp/ffconf.HAcWEfVO.o -lm -lbz2 -lz -lpsapi check_mathfunc truncf check_ld cc check_cc BEGIN /tmp/ffconf.PZXVhpnj.c 1 #include <math.h> 2 float foo(float f) { return truncf(f); } 3 int main(void){ return (int) foo; } END /tmp/ffconf.PZXVhpnj.c gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -std=c99 -fno-common -fomit-frame-pointer -c -o /tmp/ffconf.HAcWEfVO.o /tmp/ffconf.PZXVhpnj.c gcc -Wl,--as-needed -o /tmp/ffconf.pRVOZOgl.exe /tmp/ffconf.HAcWEfVO.o -lm -lbz2 -lz -lpsapi check_lib x264.h x264_encoder_encode -lx264 check_header x264.h check_cpp BEGIN /tmp/ffconf.PZXVhpnj.c 1 #include <x264.h> 2 int x; END /tmp/ffconf.PZXVhpnj.c gcc -D_ISOC99_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U__STRICT_ANSI__ -std=c99 -fno-common -fomit-frame-pointer -E -o /tmp/ffconf.HAcWEfVO.o /tmp/ffconf.PZXVhpnj.c C:/DOCUME~1/<myname>/LOCALS~1/Temp/ffconf.PZXVhpnj.c:1:18: fatal error: x264.h: No such file or directory compilation terminated. ERROR: libx264 not found i'm not sure why it's referring something in my local settings folder when nothing else appears to... quite strange.
__________________
sucking the life out of your videos since 2004 |
![]() |
![]() |
![]() |
#4 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
Okay, I was wrong about the threads issue.
Did you install x264? Where did you install it to? Does gcc know to look there for it? You should either set up your environment so that gcc looks in this place for it or use: --extra-cflags=-I/path/to/x264/header --extra-ldflags=-L/path/to/x264/library
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. Last edited by J_Darnley; 13th July 2012 at 11:34. |
![]() |
![]() |
![]() |
#5 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
oh, really? i thought pkg-config would deal with that stuff.
i've had it work in the past, but it's possible it was picking up a different x264 than the git version i had been compiling. i'll try the flags you've given me. i never could figure out what all those ldflags and stuff meant. i'll let you know tomorrow when i get to my winxp machine. thanks!
__________________
sucking the life out of your videos since 2004 |
![]() |
![]() |
![]() |
#6 | Link |
もこたんインしたお!
Join Date: Jan 2008
Location: Finland / Japan
Posts: 512
|
I usually use a standard msys folder setup, where a mingw toolchain of my choice mounted into /mingw, and set my --prefix to /mingw/<32bit/64bit cross-prefix in your toolchain>/ (or somewhere separate in case something needs separation).
Then I use some pre-made pkg-config binary and usually set the PKG_CONFIG_PATH variable accordingly to my setup (PKG_CONFIG_PATH=/herp/derp/lib/pkgconfig f.ex.) when running configuration scripts. I don't remember in which case this would be needed, but I also remember making copies of the pkg-config binary with the cross-prefixes that have to be set separately (usually 64bit cross-prefixes). I think this was for configuration scripts that wouldn't fall back on the non-prefixed pkg-config binary. Also, as far as cflags and ldflags go, in most cases the stuff you'll get to meet at one point are -l, -L (ldflags) and -I (a cflag). Small L tells the linker to link to a certain library (in general, the compiler option -lNAME will attempt to link object files with a library file ‘libNAME.a’ in the linker's pre-set library search path, although of course you can specify a file name or even a full path), and the big L tells the linker to look for the libraries in an additional directory (-L/herp/derp/lib). Large I on the other hand adds directories to the header search path (-I/herp/derp/include). And indeed, pkg-config can save you from the headache of dealing with these things, in case pkg-config is used accordingly.
__________________
[I'm human, no debug]
|
![]() |
![]() |
![]() |
#7 | Link |
Registered User
Join Date: May 2006
Posts: 957
|
In that case, did you tell pkg-config where you installed x264 to? I'm sure JEEB's answer will help you with that.
__________________
x264 log explained || x264 deblocking how-to preset -> tune -> user set options -> fast first pass -> profile -> level Doom10 - Of course it's better, it's one more. |
![]() |
![]() |
![]() |
#8 | Link |
interlace this!
Join Date: Jun 2003
Location: i'm in ur transfers, addin noise
Posts: 4,555
|
Code:
$ pkg-config --list-all liblzma liblzma - General purpose data compression library libswscale libswscale - FFmpeg image rescaling library libavutil libavutil - FFmpeg utility library libavdevice libavdevice - FFmpeg device handling library libavformat libavformat - FFmpeg container format library libavcodec libavcodec - FFmpeg codec library openssl OpenSSL - Secure Sockets Layer and cryptography libraries and tools libpostproc libpostproc - FFmpeg postprocessing library libavresample libavresample - Libav audio resampling library ffms ffms2-avs-cplugin - The Fabulous FM Library guile-1.8 GNU Guile - GNU's Ubiquitous Intelligent Language for Extension libarchive libarchive - library that can create and read several streaming archive formats libcrypto OpenSSL-libcrypto - OpenSSL cryptography library libxml-2.0 libXML - libXML library version2. zlib zlib - zlib compression library libavfilter libavfilter - FFmpeg video filtering library x264 x264 - H.264 (MPEG4 AVC) encoder library autoopts AutoOpts - A semi-automated generated/library option parser libswresample libswresample - FFmpeg audio rescaling library libssl OpenSSL - Secure Sockets Layer and cryptography libraries not sure what the deal is there, if pkg-config is supposed to pick everything up. i wouldn't rule out something being whack in my setup though. i just got into work so i haven't tried manually pointing configure to where x264 is installed at. [edit] Code:
$ ./configure --disable-everything --enable-gpl --enable-libx264 --extra-cflags=-I/local/lib --extra-ldflags=-L/local/lib ERROR: libx264 not found i guess i'm still doing it wrong. i've half a mind to just nuke msys and mingw and start again, but i have a suspicion that will not help.
__________________
sucking the life out of your videos since 2004 Last edited by Mug Funky; 16th July 2012 at 02:51. |
![]() |
![]() |
![]() |
#9 | Link |
...?
Join Date: Nov 2005
Location: Florida
Posts: 1,461
|
I tested here, with an MSys that does not have x264 or FFmpeg locally installed. I can verify that the 'cannot find libx264' error occurs as per the thread topic. I don't think it's anything you're doing wrong, I'm more inclined to blame MSys.
However, I was able to get around it by using custom prefixes*. I'm guessing that FFmpeg doesn't like the fact that MSys treats the entire root as /usr, and therefore it doesn't want to treat /local/lib and /local/include as valid search paths. This is why it's probably advisable to install x264 to your MinGW installation rather than the default location(s), like JEEB said. I'm not sure if explicitly giving it -I/usr/local/include and -L/usr/local/lib for your --extra-*flags arguments would work, but maybe it's worth trying. *in my case, x264: Code:
./configure --prefix=$HOME/win32_build --enable-strip --enable-static make make install Code:
./configure --prefix=$HOME/win32_build --enable-gpl --enable-version3 --disable-w32threads \ --enable-memalign-hack --enable-avisynth --enable-libx264 --cpu=pentium3 \ --extra-cflags="-I$HOME/win32_build/include -march=pentium3 -mtune=pentium3 -DPTW32_STATIC_LIB" \ --extra-ldflags="-L$HOME/win32_build/lib" But to break it down, FFmpeg is told to look for x264's include/lib in the relevant subdirectories of $HOME/win32_build. It doesn't have any issues with this. Last edited by qyot27; 16th July 2012 at 21:05. |
![]() |
![]() |
![]() |
#10 | Link | |
Registered User
Join Date: Dec 2001
Posts: 145
|
Quote:
Code:
... SOURCE_DIR=`pwd` COMMONOPTS="--enable-win32thread --enable-static --enable-strip --extra-cflags=-I${SOURCE_DIR}/lib/include --extra-ldflags=-L${SOURCE_DIR}/lib/lib" PREFIX="--prefix=${SOURCE_DIR}/dist" ... CONFIGURE="nice -19 ./configure $PREFIX $CROSSPREFIX $HOST $COMMONOPTS" ... I do the same thing for ffmpeg. Edit: forgot I have for ffmpeg used also: Code:
PKG_CONFIG_PATH="${SOURCE_DIR}/lib/lib/pkgconfig" ...separate hosts (depending on config) get also... PKG_CONFIG_PATH="${PKG_CONFIG_PATH}:/mingw/i686-w64-mingw32/lib/pkgconfig" ... export PKG_CONFIG_PATH=$PKG_CONFIG_PATH Last edited by Maccara; 19th July 2012 at 18:05. |
|
![]() |
![]() |
![]() |
Tags |
avconv, ffmpeg, libav, libx264, msys |
Thread Tools | Search this Thread |
Display Modes | |
|
|