Breaking Eggs And Making Omelettes

Topics On Multimedia Technology and Reverse Engineering


Archives:

libvpx 0.9.1 and FFmpeg 0.6

June 17th, 2010 by Multimedia Mike

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 -

Posted in VP8 | 11 Comments »

11 Responses

  1. Robert Swain Says:

    Specifying no options will use 200kbps by default and probably a whole bunch of other crappy defaults. We need some good libvpx presets.

    And people of the world – FFmpeg may be faster when encoding with libvpx than your other encoder of choice but that will only be because FFmpeg specifies faster default values. It’s the same library after all.

  2. Multimedia Mike Says:

    Very valid point, Robert. I thought about including the part about presets but wanted to keep this post as simple as possible. But now I think I should either amend this post or link to a followup post about the presets since this type of post runs the very real risk of becoming the top Google search on he subject.

    Though now that I think about it, I remember that libvpx’s presets were present in WebM’s FFmpeg patches. Now I’m wondering why those presets didn’t make it into the FFmpeg source tree and into the 0.6 release?

  3. Rainer Says:

    Thanks. Great Blog. Helps me fighting with patches and ffmpeg versions. Keep it up!

  4. sharo baro Says:

    Guys,

    Why isn’t the FLV container supported and how can I play the .webm file on the web ?

    Thanks

  5. andres Says:

    Hi, i need install -libvpx- but this fail. I testing a few options but always get the follow errors:

    ./libvpx.a(x86_systemdependent.c.o): In function `vp8_arch_x86_common_init’:
    (.text+0x1da): undefined reference to `vp8_short_inv_walsh4x4_sse2′
    collect2: ld devolvió el estado de salida 1
    make[1]: *** [vpxdec] Error 1
    make: *** [.DEFAULT] Error 2

    I hope that can help me.
    Thanks.

  6. Anonymous Says:

    $ ./ffmpeg -formats 2> /dev/null | grep WebM

    did not show anything, but

    $ ./ffmpeg -formats 2> /dev/null | grep webm

    D matroska,webm
    E webm

  7. Chris Says:

    Hi,

    Thanks for the guide. Please could you advise on this issue?

    I have verified the install and get the following:

    $ ./ffmpeg -formats 2> /dev/null | grep WebM
    E webm WebM file format

    $ ./ffmpeg -codecs 2> /dev/null | grep libvpx
    DEV libvpx libvpx VP8

    However, when I try and convert a video using the format:

    ffmpeg -i

    I get the error:

    Encoder (codec id 146) not found for output stream #0.0

    And the video output is 0kb in size.

    Anyone got any ideas?

    Thanks.

  8. Chris Says:

    Sorry, a little revision:

    I am using the format ‘ffmpeg -i ‘ to convert the videos.

  9. Chris Says:

    Sorry! It’s not showing up. I am using the format:
    ffmpeg -i [input_file] [output_file.webm]

  10. Mayur Says:

    I keep getting this:

    make[1]: Nothing to be done for `all-docs’.
    [INSTALL] /usr/local/lib/libvpx.a
    [INSTALL] /usr/local/bin/ivfdec
    [INSTALL] /usr/local/bin/ivfenc
    make[1]: Nothing to be done for `install’.

    And when I “verify” nothing shows up. What can I do from here?

  11. Aaron Says:

    Mayur:

    Those [INSTALL] lines should mean that the library is being installed correctly to /usr/local/lib/libvpx.a, and there should be ivfdec/ivfenc binaries in /usr/local/bin/.

    I’m not sure if this is pertinent or not, but the ivf[enc|dec] tools were renamed to vpx[enc|dec] a few months ago. You might want to check if all of your source is up to date as well.