Great news: Hot on the heels of FFmpeg’s 0.6 release, the WebM project released version 0.9.1 of their libvpx. I can finally obsolete my last set of instructions on getting FFmpeg-svn working with libvpx 0.9.
Building libvpx 0.9.1
Do this to build libvpx 0.9.1 on Unix-like systems:
libvpx’s build system has been firmed up a bit since version 0.9. It’s now smart enough to install when said target is invoked and it also builds the assembly language optimizations. Be advised that on 32- and 64-bit x86 machines, Yasm must be present (install either from source or through your package manager).
Building FFmpeg 0.6
To build the newly-released FFmpeg 0.6:
- Install Vorbis through your package manager if you care to encode WebM files with audio; e.g., ‘libvorbis-dev’ is the package you want on Ubuntu
- Download FFmpeg 0.6 from the project’s download page
- Configure FFmpeg with at least these options:
./configure --enable-libvpx --enable-libvorbis --enable-pthreads
; the final link step still seems to fail on Linux if the pthreads option is disabled
- ‘make’
Verifying
Check this out:
$ ./ffmpeg -formats 2> /dev/null | grep WebM
E webm WebM file format
$ ./ffmpeg -codecs 2> /dev/null | grep libvpx
DEV libvpx libvpx VP8
That means that this FFmpeg binary can mux a WebM file and can both decode and encode VP8 video via libvpx. If you’re wondering why the WebM format does not list a ‘D’ indicating the ability to demux a WebM file, that’s because demuxing WebM is handled by the general Matroska demuxer.
Doing Work
Encode a WebM file:
ffmpeg -i <input_file> <output_file.webm>
FFmpeg just does the right thing when it seems that .webm extension on the output file. It’s almost magical.
For instant gratification that the encoded file is valid, you can view it immediately using ‘ffplay’, if that binary was built (done by default if the right support libraries are present). If ffplay is not present, you can always execute this command line to see some decode operation:
ffmpeg -i <output_file.webm> -f framecrc -