View Full Version : Building ffmpeg/l-smash/ffmpegsource for compiling x264
jpsdr
23rd December 2014, 10:32
After a lot of struggles and google searches, i'm still beaten, unable to succed.
I've two goals :
- Being able to build on my own library package for x264.
- Build a full version of x264 t_mod.
I've used this guideline (https://github.com/BrunoReX/build-scripts/blob/master/L-SMASH/readme.md) as starting point.
First, i describe my config.
I've two setups :
- One with the standard/original(...old ?) msys (msys+7za+wget+svn+git+mercurial+cvs-rev13 provided by LordMulder on a thread somewhere if my memory is correct) and with the mingw/gcc packages provided by komisar, this one i used to build x264. Setup A.
- Another with msys2 (msys2-i686-20141113) and mingw/gcc package get by "pacman", using the method described in the guideline. Setup B.
Thing i've tried out of curiosity, build ffmpeg with :
- Setup A. Configure works, but make doesn't, it throw an error reading the makefile.
- Setup B, with removing the mingw/gcc and replaced it with komisar package. Same result.
Actualy :
I build ffmpeg/l-smash/ffmpegsource with Setup B, and x264 with Setup A.
If i use the libpack provided by komisar, and just add the missing libraries needed by t_mod version i've build :
- With Setup A, all libraries (libav,lavc,ffms,l-smash...) are perfectly detected during configuration, and build is Ok with a 15MB file.
- With Setup B, all libraries are detected during configuration, except ffms2, where there is "no". Build is Ok with a 10MB file.
Now, if i'm using my own build for all libraries :
- With Setup A, all libraries are not detected during configuration, and i've a warning message about libav not supported without swscale (even if i've not disabled it during compile). Build failed with unresolved dependancy during link.
- With Setup B all libraries are not detected during configuration, but no warning message. Build failed with unresolved dependancy during link.
This is where i'm stuck, and asking for help, because i don't know what to do more, and what i'm missing or where i'm doing wrong.
My configuration command lines (with Setup B) for :
ffmpeg :
./configure --prefix=/mingw32/local-x264/posix --extra-ldflags="-static" --target-os=mingw32 --arch=i686 --disable-programs --enable-static --disable-shared --disable-w32threads --enable-pthreads --enable-avresample --disable-doc --disable-debug --enable-gpl --enable-version3 --enable-nonfree --enable-protocol=file --enable-swscale
l-smash :
./configure --prefix=/mingw32/local-x264/posix --extra-ldflags="-static"
ffms2 :
PKG_CONFIG_PATH="/mingw32/local-x264/posix/lib/pkgconfig" ./configure LDFLAGS="-static" --prefix=/mingw32/local-x264/posix --enable-avresample --enable-static --disable-shared
Build order is ffmpeg,l-smash,ffms2.
Please, help...
:thanks:
komisar
23rd December 2014, 18:03
configure ffmpeg, post you ffmpeg/config.log, build ffmpeg, install ffmpeg, configure ffmpegsource, post ffmpegsource/config.log
p.s. "post" on pastebin.org or spoiler
jpsdr
24th December 2014, 15:10
For ffmpeg, here the config.log (http://pastebin.com/pda6gg4Z) result file.
For ffms2, here the config.log (http://pastebin.com/TxCTVhf8) file and config.status (http://pastebin.com/LuF30uip) file.
And merry Christmas everyone.
komisar
24th December 2014, 15:51
checking for LIBAV result: yes
checking whether linking with FFmpeg or Libav result: FFmpeg
checking whether FFmpeg works result: yes
seems all OK... build ffmpegsource and post error message...
qyot27
24th December 2014, 16:13
Some things to note:
- Build a full version of x264 t_mod.
Not all of the patches on the tMod branch apply cleanly to x264 upstream, especially after this last push. TriAQ in particular is one nasty mess of changing macros and has to be updated to fix that. So you'd have to build the tMod branch as-is, but that's not up-to-date. I've migrated most of the patches onto the 'patches' and 'patches_silent' (the repo default) branches of my Github x264 repo (https://github.com/qyot27/x264). These are rebased against current upstream.
As I said, not all of the patches are there - either they're no longer necessary because they were committed to x264 upstream (--aq-mode 3), were cosmetic changes I didn't personally care for, or are patches I oppose philosophically (AVI output and SEI verbosity level). Or are broken against upstream and I don't want to try fixing them myself (TriAQ, and the iqmin/iqmax patch).
My configuration command lines (with Setup B) for :
ffmpeg :
./configure --prefix=/mingw32/local-x264/posix --extra-ldflags="-static" --target-os=mingw32 \
--arch=i686 --disable-programs --enable-static --disable-shared --disable-w32threads --enable-pthreads \
--enable-avresample --disable-doc --disable-debug --enable-gpl --enable-version3 --enable-nonfree --enable-protocol=file --enable-swscale
--enable-static and --disable-shared aren't necessary; FFmpeg defaults to only building static libs by default. --enable-pthreads should be automatically detected (if you have them) if you --disable-w32threads. --enable-nonfree does nothing here except make the binary unredistributable (it's only needed for five* external libraries, none of which you're building against). All protocols are enabled by default, so --enable-protocol=file is meaningless, and --enable-swscale isn't necessary either; it's also built by default.
*OpenSSL, fdk-aac, aacplus, faac, and nvenc. Four of which are encoders and thus wouldn't be relevant for this anyway. Only OpenSSL *might* have an effect, if you were to build and enable it, but I just wouldn't bother.
And generally, that's going to be a hefty addition in size just for use in FFMS2 and x264, because those have no need for FFmpeg's muxers and encoders. A better idea is to build a minimal FFmpeg with only the parts FFMS2 and x264 need, and then if you want a fully-featured FFmpeg you can do that afterward/in a separate prefix/some other time. Also noting that the patched x264 has the --device feature enabled, and FFmpeg doesn't like that - FFmpeg requires a patch just to allow it to build against a device-enabled x264 (https://github.com/qyot27/FFmpeg/commit/92223742b9012da0ddb3a3abc073f8cc32050ed9).
ffms2 :
PKG_CONFIG_PATH="/mingw32/local-x264/posix/lib/pkgconfig" ./configure LDFLAGS="-static" --prefix=/mingw32/local-x264/posix --enable-avresample --enable-static --disable-shared
Don't put LDFLAGS after configure. Put LDFLAGS before configure with PKG_CONFIG_PATH. --enable-avresample does nothing for FFMS2, that's not even an option given by FFMS2.
Build order is ffmpeg,l-smash,ffms2.
It really doesn't matter when you build L-SMASH, as long as it's before x264. Just saying. And depending on the situation, static FFMS2, MinGW, and Windows don't like one another (hence why it would sometimes not detect it; it has to do with fixes for shared builds of FFMS2 on MinGW).
But for the sake of the illustration, this is how I usually do it (sans the parts optimizing for my ancient PIII) when cross-compiling for Windows under Ubuntu:
Basic compilation toolchain and environment setup with tons of library info (https://github.com/qyot27/mpv/blob/extra-new/DOCS/crosscompile-mingw-tedious.txt) (aside from pthreads-w32, zlib, and bzip2, there's nothing more needed for just FFMS2, a simple build of FFmpeg for FFMS2 and LAVF input, and x264). That guide is intended for as fully-featured FFmpeg and mpv builds as possible without using nonfree stuff.
Obviously, you'd probably want to do all this under a VM, unless you have a Linux partition sitting around.
FFmpeg (basic):
PKG_CONFIG_PATH=/usr/i686-w64-mingw32/lib/pkgconfig ./configure --prefix=$HOME/win32_build --cross-prefix=i686-w64-mingw32- \
--enable-gpl --enable-version3 --disable-w32threads --enable-avresample --disable-encoders --disable-muxers --disable-doc \
--disable-debug --disable-network --disable-hwaccels --disable-indevs --disable-outdevs \
--extra-cflags="-DPTW32_STATIC_LIB" --target-os=mingw32 --arch=x86
make
make install
FFMS2 (non-autotools, static library):
git checkout c_plugin
PKG_CONFIG_PATH=$HOME/win32_build/lib/pkgconfig:/usr/i686-w64-mingw32/lib/pkgconfig ./configure --prefix=$HOME/win32_build \
--cross-prefix=i686-w64-mingw32- --host=i686-pc-mingw32
make
make install
L-SMASH:
./configure --prefix=/usr/i686-w64-mingw32 --cross-prefix=i686-w64-mingw32- --target-os=mingw32
make
sudo checkinstall --pkgname=lsmash-mingw --pkgversion="0:$(git rev-list --count HEAD)-g$(git rev-parse --short HEAD)" \
--backup=no --deldoc=yes --delspec=yes --deldesc=yes --strip=yes --fstrans=no --default
x264:
PKG_CONFIG_PATH=$HOME/win32_build/lib/pkgconfig:/usr/i686-w64-mingw32/lib/pkgconfig ./configure \
--prefix=$HOME/x264_build --cross-prefix=i686-w64-mingw32- --host=i686-w64-mingw32 --qtsdk=$HOME/qtsdk \
--enable-nonfree --enable-static --enable-strip --disable-opencl --extra-cflags="-DPTW32_STATIC_LIB"
make
make install
make distclean
PKG_CONFIG_PATH=$HOME/win32_build/lib/pkgconfig:/usr/i686-w64-mingw32/lib/pkgconfig ./configure \
--prefix=$HOME/x264_build/x264-10bit --cross-prefix=i686-w64-mingw32- --host=i686-w64-mingw32 --qtsdk=$HOME/qtsdk \
--enable-nonfree --enable-static --enable-strip --disable-opencl --extra-cflags="-DPTW32_STATIC_LIB" --bit-depth=10
make
make install
jpsdr
24th December 2014, 16:36
@komisar :
I've build the ffms2 and installed it. Ok.
All these were done with Setup B.
After, everything is done with Setup A.
x264 result config.log (http://pastebin.com/tnLHKSPz) file (as it can be seen, ffms2 is not detected, and i've a warning message about libavformat is not supported without swscale support) for standard master version.
x264 result config.log (http://pastebin.com/1tEiWzeW) file for t_mod version. As it can be seen, final config result in a lot of "no".
And now, i don't have the link error anymore... I'll hang myself !
If i switch back your libraries package, the configuration command produce this config.log (http://pastebin.com/bPeeVJMt) result file. This time, a lot of "yes".
@qyot27 : Thanks for your informations. I'll take a close look on them.
I've rebased the t_mod, but didn't realy see any issue with TriAQ (doesn't mean there isn't)...
But i've had trouble the 1rst time, indeed, so, the second time i've tried to rebase, i've "removed" the official aq-mode 3, to keep the old one, and everything seemed fine after. The trick is not to fix TriAQ, but old aq-modes.
You have mi github here (https://github.com/jpsdr/x264/tree/t_mod_Custom).
Totaly agree with 'as-is'...
komisar
24th December 2014, 20:14
undefined reference to `_imp__FFMS_DestroyVideoSource@4'
You build FFMS shared?
Try to add `--prefix=` to x264 configure (or add `--extra-cflags="-I/path/to/libs/include" --extra-ldflags="-L/path/to/libs/lib"`)
P.S. `--disable-protocols --enable-protocol=file` need for AVI-output patch
jpsdr
25th December 2014, 08:06
You build FFMS shared?
If you look at my configure option on first post, in theory, no, but maybe my configure line is not good according qyot27 comment. I'll retry.
jpsdr
25th December 2014, 08:14
--enable-avresample does nothing for FFMS2, that's not even an option given by FFMS2.
One part of the configure file :
Optional Features:
--disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-silent-rules less verbose build output (undo: "make V=1")
--disable-silent-rules verbose build output (undo: "make V=0")
--enable-maintainer-mode
enable make rules and dependencies not useful (and
sometimes confusing) to the casual installer
--enable-debug Enable debug build. [default=no]
--enable-dependency-tracking
do not reject slow dependency extractors
--disable-dependency-tracking
speeds up one-time build
--enable-static[=PKGS] build static libraries [default=yes]
--enable-shared[=PKGS] build shared libraries [default=no]
--enable-fast-install[=PKGS]
optimize for fast installation [default=yes]
--disable-libtool-lock avoid locking (might break parallel builds)
--enable-avresample use libavresample for audio resampling
jpsdr
25th December 2014, 08:56
Try of today :
Under Setup B :
ffmpeg configuration :
./configure --prefix=/mingw32/local-x264/posix --extra-ldflags="-static" --target-os=mingw32 --arch=i686 --disable-programs --enable-static --disable-shared --disable-w32threads --enable-pthreads --enable-avresample --disable-doc --disable-debug --enable-gpl --enable-version3 --enable-nonfree --disable-protocols --enable-protocol=file --enable-swscale --disable-encoders --disable-muxers --disable-hwaccels --disable-indevs --disable-outdevs --disable-network
Result is config.log (http://pastebin.com/UXGnpQ6k) file.
Make & install.
ffm2s configuration :
LDFLAGS="-static" PKG_CONFIG_PATH="/mingw32/local-x264/posix/lib/pkgconfig" ./configure --prefix=/mingw32/local-x264/posix --enable-avresample --enable-static --disable-shared
Result is config.log (http://pastebin.com/a0RhGgMw) file.
Make & install.
Replace all the lib with these new.
Now switch to Setup A.
x264 (t_mod version) configuration :
./configure --disable-opencl
Result is config.log (http://pastebin.com/gjPJsAwM) file.
Again... a lot of "no", no change... :(
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.