Previous Entry Add to Memories Share Next Entry
xiphmont

Ogg and WebM technical alert: default FFmpeg Vorbis encoder is broken

Overview:

FFmpeg's built-in Vorbis encoder produces low enough quality output to be considered broken. This encoder is used by default in the majority of FFmpeg builds, and will produce .ogv and WebM videos with low to unusably poor audio quality.

This alert is intended for all users of FFmpeg (via the command line or GUI wrappers) and all application developers that make use of the FFmpeg command line tool. Application developers that use the FFmpeg libraries should also take care that the libavcodec built-in Vorbis encoder library is not used by accident.

Scope:

All past and present builds of FFmpeg and libavcodec up to but not including the upcoming 0.6 release. Default builds of the upcoming FFmpeg 0.6 release will not use the built-in encoder by default, but it will still be possible to accidentally use or restore the built-in encoder to default status during the FFmpeg build. It should be assumed that any build of FFmpeg and any application using FFmpeg could be producing videos with substandard Vorbis audio unless the FFmpeg build and usage is verified to be using system Vorbis libraries, such as those provided by Xiph.Org or aoTuV.

Workaround / Fix:

FFmpeg can be forced to use the external/system libVorbis library by passing:

-acodec libvorbis

as part of the FFmpeg command line.

Note that passing '-acodec vorbis' is incorrect and requests the low-quality built-in FFmpeg-internal Vorbis encoder. Also, FFmpeg may be built without libvorbis support, meaning that many FFmpeg builds only have the internal encoder available. In this case, requesting '-acodec libvorbis' will fail with the error 'Unknown encoder 'libvorbis''.

FFmpeg can be built with working libvorbis support and the internal Vorbis encoder disabled as follows:

./configure --disable-encoder=vorbis --enable-libvorbis; make; make install

Such a build completely removes the internal Vorbis encoder from libavcodec, eliminating the possibility of accidental use on the command line or in libavcodec-based applications.

Verification:

Use of a good Vorbis encoder in .ogg, .oga, .ogv and WebM files may be verified as follows. This test will work on any Ogg or WebM file to verify the encoder that produced the audio. Note that 'Vorbis' is case-sensitive:

strings file_to_be_checked | grep Vorbis

A file that was encoded using a good encoder will output a line containing 'Xiph.Org libVorbis' or 'AoTuV', such as:

boatanchor$ strings test2.ogg |grep Vorbis
Xiph.Org libVorbis I 20100325 (Everywhere)

or

boatanchor$ strings test3.ogg |grep Vorbis
AO; aoTuV b5d [20090301] (based on Xiph.Org's libVorbis)

A file encoded by FFmpeg's internal Vorbis encoder will produce no grep output as it does not set a vendor string.


You are viewing xiphmont