Friday, May 21, 2010

Building the GStreamer VP8 plugins

By now it's old news that Google has launched the WebM project. Despite its shortcomings, this is very exciting as at the very least, we are that much closer to a high quality open and free video format for the web...well, maybe.
In any case, I just wanted to quickly document the steps required to use the new VP8 plugins in GStreamer (also thanks to David Schleef for his feedback). VP8's build system leaves a bit to be desired so bear with me:

-Get the latest tarball of vp8 here.
-Configure with your target architecture, in my case:
./configure --target=x86-linux-gcc
-Build with the make command.
-Do an install (not as root):
make install
The resulting install directory will be called something like vpx-vp8-nodocs-x86-linux-v0.9.0
It will contain the following:
bin build include lib md5sums.txt src
-Go into this new directory
cd vpx-vp8-nodocs-x86-linux-v0.9.0
-Copy include to /usr/local/include/vpx (notice the renaming):
sudo cp -rf include /usr/local/include/vpx
-Copy the library to /usr/local/lib
sudo cp lib/libvpx.a /usr/local/lib
-Build gst-plugins-bad (git version or patch the latest releases).

Note that I use an uninstalled GStreamer source tree from git, which I highly recommend. Refer to for a brief overview on how to get that going.
Make sure that after running or configure, the vp8 plugins are listed under those which will be built. If all has gone well, you should be able to get a plugin description from gst-inspect vp8.

Now to test with your favourite GStreamer pipeline. Run something like:
gst-launch -v v4l2src ! video/x-raw-yuv, width=320, height=240 \
! ffmpegcolorspace ! vp8enc max-latency=1 ! vp8dec \
! xvimagesink sync=false

(hopefully) Success! My thanks go out the GStreamer developers for yet another great contribution.