Hello,
Install build dependency for x264: You need yasm > 1.0
For EL5, you will also need to install git..
First of all, grab the sources of x264 and ffmpeg to create the static libraries :
cd /tmp git clone git://git.videolan.org/ffmpeg.git ffmpeg git clone git://git.videolan.org/x264.git wget http://webm.googlecode.com/files/libvpx-v1.0.0.tar.bz2 cd x264 ./configure --enable-shared --enable-static make && make install cd .. cd ffmpeg ./configure --enable-static --enable-shared --disable-debug --enable-gpl --enable-runtime-cpudetect --disable-doc --disable-ffplay --disable-ffprobe --disable-ffserver --disable-vaapi --disable-vdpau --disable-everything --enable-decoder=h264 make && make install cd .. tar jxvf libvpx-v1.0.0.tar.bz2 cd libvpx-v1.0.0 ./configure --enable-pic --disable-install-docs --enable-shared --enable-static --disable-vp8-decoder make && make install cd ..
The libs are now present in /usr/local.
Apply the following changes to setup.py to change x264 to static:
x264_ENABLED = True if x264_ENABLED: + def pkgconfig(*args): + return {'include_dirs': ["/usr/local/include"], + 'library_dirs': ["/usr/local/lib"], + 'extra_link_args': ["-Wl,-soname,x264lib.so", "-Wl,-Bstatic", "-Wl,-Bsymbolic", "-lx264", "-lswscale", "-lavcodec", "-lavutil", "-Wl,-Bdynamic"] } packages.append("xpra.x264") cython_add(Extension("xpra.x264.codec", ["xpra/x264/codec.pyx", "xpra/x264/x264lib.c"], **pkgconfig("x264", "libswscale", "libavcodec") ))
Apply the following changes to setup.py to change vpx to static:
vpx_ENABLED = True if vpx_ENABLED: + def pkgconfig(*args): + return {'include_dirs': ["/usr/local/include"], + 'library_dirs': ["/usr/local/lib"], + 'extra_link_args': ["-Wl,-soname,vpxlib.so", "-Wl,-Bstatic", "-Wl,-Bsymbolic", "-lvpx", "-lswscale", "-lavcodec", "-lavutil", "-Wl,-Bdynamic"] }
With this technique, you should be able to get:
[root@xf-dev src]# ls -lh build/lib.linux-x86_64-2.4/xpra/x264/codec.so -rwxr-xr-x 1 root root 3.9M Apr 3 14:03 build/lib.linux-x86_64-2.4/xpra/x264/codec.so [root@xf-dev src]# file build/lib.linux-x86_64-2.4/xpra/x264/codec.so build/lib.linux-x86_64-2.4/xpra/x264/codec.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped [root@xf-dev src]# ldd build/lib.linux-x86_64-2.4/xpra/x264/codec.so libpthread.so.0 => /lib64/libpthread.so.0 (0x00002b0ab3591000) libc.so.6 => /lib64/libc.so.6 (0x00002b0ab37ac000) /lib64/ld-linux-x86-64.so.2 (0x00000034ea400000)
Instead of a dynamic codec.so:
-rwxr-xr-x 1 arthur users 43K avril 3 15:01 build/lib.linux-x86_64-2.7/xpra/x264/codec.so arthur@Chani:~/src/xpra/src$ ldd build/lib.linux-x86_64-2.7/xpra/x264/codec.so linux-vdso.so.1 => (0x00007fff5f1ff000) libx264.so.120 => /usr/lib/libx264.so.120 (0x00007fbdd5b16000) libavcodec.so.53 => /usr/lib/libavcodec.so.53 (0x00007fbdd4ca4000) libswscale.so.2 => /usr/lib/libswscale.so.2 (0x00007fbdd4a59000) libpython2.7.so.1.0 => /usr/lib/libpython2.7.so.1.0 (0x00007fbdd469a000) libpthread.so.0 => /lib/libpthread.so.0 (0x00007fbdd447e000) libc.so.6 => /lib/libc.so.6 (0x00007fbdd40dc000) libm.so.6 => /lib/libm.so.6 (0x00007fbdd3de8000) libavutil.so.51 => /usr/lib/libavutil.so.51 (0x00007fbdd3bc5000) libva.so.1 => /usr/lib/libva.so.1 (0x00007fbdd39ad000) libxvidcore.so.4 => /usr/lib/libxvidcore.so.4 (0x00007fbdd3695000) libvpx.so.1 => /usr/lib/libvpx.so.1 (0x00007fbdd33ef000) libvorbisenc.so.2 => /usr/lib/libvorbisenc.so.2 (0x00007fbdd2f1f000) libvorbis.so.0 => /usr/lib/libvorbis.so.0 (0x00007fbdd2cf2000) libtheoraenc.so.1 => /usr/lib/libtheoraenc.so.1 (0x00007fbdd2ab5000) libtheoradec.so.1 => /usr/lib/libtheoradec.so.1 (0x00007fbdd2899000) libspeex.so.1 => /usr/lib/libspeex.so.1 (0x00007fbdd2680000) libschroedinger-1.0.so.0 => /usr/lib/libschroedinger-1.0.so.0 (0x00007fbdd23b5000) libz.so.1 => /usr/lib/libz.so.1 (0x00007fbdd219e000) libopenjpeg.so.1 => /usr/lib/libopenjpeg.so.1 (0x00007fbdd1f7d000) libopencore-amrwb.so.0 => /usr/lib/libopencore-amrwb.so.0 (0x00007fbdd1d69000) libopencore-amrnb.so.0 => /usr/lib/libopencore-amrnb.so.0 (0x00007fbdd1b3e000) libmp3lame.so.0 => /usr/lib/libmp3lame.so.0 (0x00007fbdd18c7000) libgsm.so.1 => /usr/lib/libgsm.so.1 (0x00007fbdd16bc000) libdl.so.2 => /lib/libdl.so.2 (0x00007fbdd14b7000) libutil.so.1 => /lib/libutil.so.1 (0x00007fbdd12b4000) /lib/ld-linux-x86-64.so.2 (0x00007fbdd609f000) libogg.so.0 => /usr/lib/libogg.so.0 (0x00007fbdd10ad000) liborc-0.4.so.0 => /usr/lib/liborc-0.4.so.0 (0x00007fbdd0e32000) libstdc++.so.6 => /usr/lib/libstdc++.so.6 (0x00007fbdd0b2d000) libgcc_s.so.1 => /usr/lib/libgcc_s.so.1 (0x00007fbdd0916000) librt.so.1 => /lib/librt.so.1 (0x00007fbdd070e000)
Looks, good.
done in r701, centos rpms now have static x264/vpx support
(if I have time, I will do the same for the other builds which are missing x264/vpx: opensuse, fedora unreleased, old debian/ubuntu..)
Milestone current deleted
Updated instructions adding libvpx 1.1 and --enable-memalign-hack
and better VPX options (favour realtime, etc):
cd /tmp git clone git://git.videolan.org/ffmpeg.git ffmpeg git clone git://git.videolan.org/x264.git wget http://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2 cd x264 ./configure --enable-shared --enable-static make && make install cd .. cd ffmpeg ./configure --enable-static --enable-shared --disable-debug --enable-gpl \ --enable-runtime-cpudetect --disable-doc --disable-ffplay --disable-ffprobe \ --disable-ffserver --disable-vaapi --disable-vdpau --disable-everything \ --enable-decoder=h264 --enable-memalign-hack make && make install cd .. tar jxvf libvpx-v1.1.0.tar.bz2 cd libvpx-v1.1.0 ./configure --enable-pic --disable-install-docs --enable-shared --enable-static \ --enable-vp8 --enable-realtime-only --enable-onthefly-bitpacking --enable-runtime-cpu-detect make && make install cd ..
Not all versions of x264 work... Here are some that are known to build and work correctly:
x264-snapshot-20120329-2245
x264-snapshot-20120712-2245-stable
Updated instructions valid as of r2681: the latest static builds use the following versions and build commands (loosely based on these ones for osx):
curl -O https://webm.googlecode.com/files/libvpx-v1.1.0.tar.bz2 tar -jxf libvpx-v1.1.0.tar.bz2 cd libvpx-v1.1.0 ./configure --enable-pic --disable-install-docs --enable-shared --enable-static \ --enable-vp8 --enable-realtime-only --enable-onthefly-bitpacking --enable-runtime-cpu-detect make && make install mkdir /usr/local/include/vpx/ cp vpx/vpx_*h /usr/local/include/vpx/ cd .. curl -O http://libav.org/releases/libav-9.1.tar.gz tar -zxf libav-9.1.tar.gz cd libav-9.1 ./configure --enable-runtime-cpudetect --enable-static --enable-shared \ --disable-avdevice --enable-pic make && make install cd .. curl -O ftp://ftp.videolan.org/pub/x264/snapshots/x264-snapshot-20130205-2245-stable.tar.bz2 rm -fr x264-snapshot-20130205-2245-stable tar -jxf x264-snapshot-20130205-2245-stable.tar.bz2 cd x264-snapshot-20130205-2245-stable ./configure --enable-shared --enable-static make && make install cd .. rm -fr libav-9.2 tar -zxf libav-9.2.tar.gz cd libav-9.2 ./configure --enable-runtime-cpudetect --enable-static --enable-shared \ --enable-memalign-hack \ --disable-avdevice --enable-pic --disable-zlib \ --disable-filters --disable-everything \ --enable-libx264 --enable-gpl --enable-decoder=h264 make && make install cd ..
Note: the x264 snapshot name is hardcoded here, you should probably use something newer by the time you read this.
To cross-compile libav for win32, use the following configure command:
./configure --enable-runtime-cpudetect --enable-static --enable-shared --enable-gpl \ --enable-memalign-hack --disable-avdevice \ --disable-dxva2 --disable-everything --enable-decoder=h264 \ --cross-prefix=i486-mingw32- --enable-cross-compile \ --target-os=mingw32 --arch=x86 --prefix=/tmp/mingw32_ffmpeg_ah \ --disable-decoders --enable-decoder=h264 --enable-decoder=h263
This will generate a minimal libav (without dxva2 - enabling it requires manually copying a header file from VLC's source code) usable for dynamic and static linking.
As of this writing, latest libav git requires h263 to be built otherwise we get the following error:
libavcodec/x86/dsputil.o:libavcodec/x86/dsputil.asm:(.text+0x12b0): \ undefined reference to `ff_h263_loop_filter_strength'
the win32 stuff has been moved to #270 (which is now also done) since this is an already closed ticket about CentOS
.
this ticket has been moved to: https://github.com/Xpra-org/xpra/issues/103