Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
mad goal: port avconv to javascript (part 1 of 2)
first install x264, libvpx and avconv the normal way without emscripten:
0. install common dependencies
> sudo apt-get install build-essential checkinstall build-dep
1. install yasm
> wget
> tar xzvf yasm-1.2.0.tar.gz
> cd yasm-1.2.0
> sudo ./configure
> sudo make
> sudo make install
> yasm --version
shows something like
> yasm 1.2.0
2. install x264
> git clone git:// x264 // or git pull when updating
> cd x264
> sudo ./configure --enable-static --enable-shared
> sudo make
> sudo make install
> x264 --version
shows something like
> x264 0.130.31 c832fe9
3. install libvpx
> git clone // or git pull when updating
> cd libvpx
> sudo make clean
> sudo ./configure
> sudo make
> sudo make install
> vpxenc
should show command line options = OK
4. install avconv
> git clone git:// avconv // or git pull when updating
> sudo apt-get install pkg-config // needed so that avconv can detect libraries
> sudo ./configure
> sudo ./configure --enable-gpl --enable-libx264 --enable-libvpx
// when it says it cannot find libx264, try the above command again but with the extra option '--extra-libs=-ldl'
> sudo make
> sudo make install
> avconv -v
shows something like
> avconv version v9-823-g352dbdb, Copyright (c) 2000-2013 the Libav developers
at this point, you have everything ready for local video encoding. now let's focus on emscripten:
5. install emscripten:
- install it into [YOUR PROJECTS FOLDER]/emscripten
- do exactly like prescribed on
- make sure you install clang version 3.2 first (NOT 3.1 or 3.3)
- also run the suggested tests on the tutorial page. including optimizations.
- do not proceed if these tests fail!
6. port x264 to javascript
> sudo make uninstall
> sudo make distclean
> git pull
> git clean -f
> ./../emscripten/emconfigure ./configure --enable-static --disable-thread --disable-asm --extra-cflags="-O2" --extra-ldflags="-v" --host=i686-pc-linux-gnu
> ./../emscripten/emmake make
now turn the bitcode into js with:
> ./../emscripten/emcc -O2 x264.o -o x264.js
when done, type 'ls -ltr' and you should see a 374 kB large JS file named 'x264.js' a the bottom which is good.
now proceed with the next library libvpx ...
7. port libvpx to javascript
> make clean
> git pull
> git clean -f
do these modifications manually in vim for the files /build/make/ and configure exactly like here:
but do not use llvm-ld, it's deprecated. use llvm-link instead.
(i have reported this detour to the makers of libvpx here
okay, now configure and make libvpx!
> sudo ./../emscripten/emconfigure ./configure --target=js1-none-clang_emscripten --disable-examples --disable-docs --disable-multithread --disable-runtime-cpu-detect --disable-optimizations --disable-vp8-decoder --disable-vp9-decoder --extra-cflags="-O2"
> sudo ./../emscripten/emmake make
> ./../emscripten/emcc -O2 libvpx.a -o libvpx.js
then type this to check the js file:
> ls -ltr
you should see a 50kB large libvpx.js file at the bottom. great!
8. final step: port avconv to javascript!!
Copy link

If I want avconv with the whole shebang, then I do this instead:

sudo ./configure \
--enable-gpl --enable-libx264 --enable-libvpx  --enable-libfaac \
--enable-libmp3lame --enable-libopus \
--enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 \
--enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb \
--enable-nonfree --enable-libfreetype --enable-shared --extra-libs="-ldl"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment