From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help by expanding it.

Libav is a complete, cross-platform solution to record, convert and stream audio and video. It includes an implementation of libavcodec — the leading audio/video codec library.

Software not building with Libav

Some software might not be compatible with the 0.8 or even the 0.7 Libav API.

The most outstanding issues include:

  • libavutil specific function being used without including the required header:
include <libavutil/mathematics.h> to include av_rescale_q()
include <libavutil/avstring.h> to include the av_str functions
  • FFmpeg only calls used:
avformat_alloc_output_context2() might be the most used, it is a shortcut for calling avformat_alloc_context() followed by using av_guess_format() and an av_strlcpy of the filename.


USE flags

Some packages know the libav USE flag for Preferring media-video/libav over media-video/ffmpeg whenever both are supported.

USE flags for media-video/libav Complete solution to record, convert and stream audio and video

X Add support for X11
aac Use external vo-aacenc library for AAC encoding
alsa Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
altivec Add support for optimizations for G4 and G5/ppc970 processors
amr Enable Adaptive Multi-Rate Audio support
armv5te Enable optimizations for armv5te processors
armv6 Enable optimizations for armv6 processors
armv6t2 Enable optimizations for armv6t2 processors
armvfp Enable VFP optimizations for ARM processors
bs2b Enable media-libs/libbs2b based Bauer stereo-to-binaural audio filter
bzip2 Use the bzlib compression library
cdio Enable audio CD grabbing with dev-libs/libcdio.
cpudetection Enables runtime CPU detection (useful for bindist, compatibility on other CPUs).
custom-cflags Build with user-specified CFLAGS (unsupported)
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
encode Add support for encoding of audio or video files
faac Use external faac library for AAC encoding
fdk Use external fdk-aac library for AAC encoding and decoding
fontconfig Support for configuring and customizing font access via media-libs/fontconfig
frei0r Enable frei0r wrapping in libavfilter
gpl Build all GPL licensed code. Without this flag set the package is build under LGPL license.
gsm Add support for the gsm lossy speech compression codec
hardcoded-tables Use pre-calculated tables rather than calculating them on the fly.
ieee1394 Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
jack Add support for the JACK Audio Connection Kit
jpeg2k Support for JPEG 2000, a wavelet-based image compression format
libressl Use dev-libs/libressl instead of dev-libs/openssl when applicable (see also the ssl useflag)
mp3 Add support for reading mp3 files
neon Enable optimization support for ARM NEON processors
network Enable network streaming support.
openssl Prefer dev-libs/openssl over net-libs/gnutls to provide SSL/TLS support (notice: the resulting binaries are unredistributable).
opus Use the external opus library for encoding and decoding.
oss Add support for OSS (Open Sound System)
pic Force shared libraries to be built as PIC (this is slower).
pulseaudio Enable pulseaudio input support.
rtmp Enable Real Time Messaging Protocol using librtmp instead the native implementation.
sdl Add support for Simple Direct Layer (media library)
speex Add support for the speex audio codec (used for speech)
ssl Enable SSL/TLS support using dev-libs/openssl or net-libs/gnutls.
static-libs Build static versions of dynamic libraries as well
test Enable dependencies and/or preparations necessary to run tests (usually controlled by FEATURES=test but can be toggled independently)
theora Add support for the Theora Video Compression Codec
threads Add threads support for various packages. Usually pthreads
tools Build and install small tools like aviocat, cws2fws, graph2dot, ismindex, qt-faststart.
truetype Add support for FreeType and/or FreeType2 fonts
twolame Enable MP2 encoding via media-sound/twolame as an alternative to the internal encoder
v4l Enable support for video4linux (using linux-headers or userspace libv4l libraries)
vaapi Enable Video Acceleration API for hardware decoding
vdpau Enable the Video Decode and Presentation API for Unix acceleration interface
vorbis Add support for the OggVorbis audio codec
vpx Enable vp8 encoding support using media-libs/libvpx.
wavpack Add support for wavpack audio compression tools
webp Add support for the WebP image format
x264 Enable h264 encoding using x264
x265 Enable HEVC encoding with media-libs/x265.
xvid Add support for's open-source mpeg-4 codec
zlib Add support for zlib (de)compression


After setting appropriate USE flags, run the emerge command:

root #emerge --ask media-video/libav


Libav provides a new command-line tool to manipulate streams called avconv. Its aim is similar to the ffmpeg command from FFmpeg, but the syntax had been changed to be more regular and it aims to solve some long standing issues regarding time stamp guessing/generation that had been a bane for everybody trying to transcode live streams in the past.

See also

  • FFmpeg — a cross platform, free, open source media encoder/decoder toolkit.

External resources