PDA

View Full Version : How to compile libx264.dll for Avidemux?


snd303
2nd December 2008, 16:49
Hi, everyone. Does anyone know how to compile libx264.dll for Avidemux?
-
My System
Windows XP Prof SP3
-
So here is what I did so far

Installed all the programs listed in that guide
Step by step x264 compilation guide for complete newbies: (http://forum.doom9.org/showthread.php?p=723782#post723782)
-
I always tried to install the newest version of each program
binutils-2.19-mingw32-rc1-bin.tar.gz
gcc-part-core-4.3.0-20080502-2-mingw32-alpha-bin.tar.gz
Git-1.6.0.2-preview20080923.exe
MinGW-5.1.4.exe
w32api-3.12-mingw32-dev.tar.gz
yasm-0.7.2-win32.exe
zlib-1.2.3.exe
gpac-0.4.4-rc2.zip (I guess not necessary for Avidemux?)
pthreads-w32-2-8-0-release.exe
-
Get the newest x264 build with Git
git clone git://git.videolan.org/x264.git
-
Open MSYS and start to configure the source
configure --prefix=/mingw --enable-pthread --enable-avis-input --enable-shared
-
Gives me the following result
./version.sh: git: command not found
Platform: X86
System: MINGW
asm: yes
avis input: yes
mp4 output: no
pthread: yes
debug: no
gprof: no
PIC: no
shared: yes
visualize: no

You can run 'make' or 'make fprofiled' now.
-
Then start to compile
make SONAME=libx264.dll
Some warnings appear during compiling but nothing to worry about I guess…
-
Everything’s finished and I have a brand new x264.exe (1,12 MB) and libx264.dll (803 KB).
-
Testing x264.exe
$ x264.exe --version
x264 0.65.x
built on Dec 2 2008, gcc: 4.3.0 20080305 (alpha-testing) mingw-20080502
-
Overwriting the existing libx264.dll in the Avidemux folder and try to encode a video in x264 gives me the following result:
Filter Init Failed
-
Looking forward for some advice. :)
-
snd303

LoRd_MuldeR
2nd December 2008, 18:50
You must make sure that you use the same core version of libx264-xx.dll that Avidemux was compiled for!

Usually the x264 API is unchanged over several revisions, but once it is changed, Avidemux needs to be re-compiled with latest x264.h too!

For example if a Avidemux shipped with libx264-65.dll, then it will only work with libx264 core version 65...


BTW: You need to apply the alignment fix patch to make libx264-xx.dll work properly, otherwise it will crash when executing some of the SSE functions.

And you need GCC 4.2.x or newer to make the alignment fix work. Also Avisynth input is useless for the x264 DLL.


My build script looks like this:
git clone git://git.videolan.org/x264.git
echo
echo --------------------------------------------------------------------------
echo
cd x264
patch -p1 < ../avidemux.diff
echo
echo --------------------------------------------------------------------------
echo
./configure --enable-shared --extra-cflags="-march=pentium2"
echo
echo --------------------------------------------------------------------------
echo
make fprofiled VIDS="../sample.avs ../sample2.avs"
echo
echo --------------------------------------------------------------------------

The patch is as follows:
*** a/encoder/encoder.c Fri Sep 19 23:19:33 2008
--- b/encoder/encoder.c Sat Sep 20 03:38:48 2008
*************** static int x264_slices_write( x264_t *h
*** 1328,1329 ****
--- 1341,1343 ----
****************************************************************************/
+ __attribute__((force_align_arg_pointer))
int x264_encoder_encode( x264_t *h,


Last but not least, latest libx264-65.dll for Avidemux r4494 can be found here:
http://forum.doom9.org/showthread.php?p=1218226#post1218226

snd303
3rd December 2008, 01:50
THX a lot LoRd_MuldeR. I always seeing you around since I’m using Avidemux. My libx264.dll works fine with your latest Avidemux build.

It’s like you said
You must make sure that you use the same core version of libx264-xx.dll that Avidemux was compiled for!

Usually the x264 API is unchanged over several revisions, but once it is changed, Avidemux needs to be re-compiled with latest x264.h too!

For example if a Avidemux shipped with libx264-65.dll, then it will only work with libx264 core version 65...

snd303

LoRd_MuldeR
3rd December 2008, 02:03
My libx264.dll works fine with your latest Avidemux build.

BTW: It's Gruntster's Avidemux build that I mirror on my site. He also came up with the alignment fix patch :D