Skip to content

Compiling From Source

Alasdair Macmillan edited this page Jun 26, 2016 · 13 revisions

Compiling native dependencies

WebM/VP8 encoder

  • Download the video encoder codec (version 1.3.0) from http://code.google.com/p/webm/downloads/list

  • Install "yasm" compiler

  • There is a bug in the WebM encoder that generates videos with an incorrect length. In webmenc.c, in function write_webm_seek_info(), change:

    frame_time = (uint64_t)1000 * ebml->framerate.den / ebml->framerate.num;

To be:

 frame_time = (uint64_t)1000 * ebml->framerate.num / ebml->framerate.den;
  • Build against a target: ./configure --target=x86_64-linux-gcc --enable-shared && make -j 4
  • Run the tests - ./test_libvpx - some of them errored for me, not sure its an issue? (360 failures)

WebM encoder

Download a version of the webm encoder from the project page (using version 1.0.0.27):

https://github.com/webmproject/libwebm/tree/libwebm-1.0.0.27

Follow the insructions on the project page.

If your local PC has GCC, then you may need to pass some additional options to CMake:

CXXFLAGS="-std=c++11 -fPIC" cmake .

I also had to add this line to webm2pes.h, to avoid errors involving memcpy and the std namespace: #include

Convert the static library into a shared library:

g++ -Wl,--whole-archive libwebm.a -Wl,--no-whole-archive -shared -fPIC -o libwebm_mine.so

======================== OLD:

For whatever reason, this code isn't included in the above library:

gcc webmenc.c third_party/libmkv/EbmlWriter.c -I . -shared -fPIC -o libmkv.so

YUV Library

We need this to convert from RGB Java screenshots to YUV images, which the encoder requires.

Follow the instructions at https://code.google.com/p/libyuv/wiki/GettingStarted

  • Modify the "libyuv.gyp" file
    • In the 'targets' section, modify 'type' to be 'shared_library'
    • Comment out 'standalone_static_library'
    • Uncomment LIBYUV_USING_SHARED_LIBRARY (in 'defines' section)
  • Re-run gclient runhooks in the root gclient directory (one above the actual libyuv checkout)
  • Proceed to compile step (which errors for me when linking test code), but you should find the generated library at "out/Release/lib/libyuv.so"

Compiling native code interface

TODO: This should really be integrated into the build system

gcc src/main/c/encoder_interface.c -I /home/aim/dev/libvpx-v1.3.0/ -I /home/aim/dev/libyuv/trunk/include/ -I /home/aim/dev/libvpx-v1.3.0/third_party/libmkv -fPIC -shared -o src/main/resources/libinterface.so

Compiling Xvfb acceleration module

This is only applicable under Linux.

Install (on Debian):

apt-get install x11proto-core-dev

Then compile:

gcc src/main/c/xvfb_interface.c -shared -fPIC -o src/main/resources/libxvfb_interface.so

Clone this wiki locally