From Gentoo Wiki
Jump to: navigation, search
This article is a stub. You can help Gentoo Wiki 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 issue are:

  • 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

Due to current limitations on the Wiki, the USE flag list had to be divided into two separate sections.

Optional USE configuration for media-video/libav:
USE flag (what is that?) Default Recommended Description
3dnow Yes Use the 3DNow! instruction set
3dnowext Yes Enable manually-optimised routines using the AMD 3DNow!Ex SIMD instruction set, present in modern AMD CPUs. (Check for 3dnowext in /proc/cpuinfo to know whether your CPU supports it).
X Yes Add support for X11
aac Yes Use external vo-aacenc library for AAC encoding
alsa Yes Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
altivec No Add support for optimizations for G4 and G5/ppc970 processors
amr No Enable Adaptive Multi-Rate Audio support
avx No Adds support for Advanced Vector Extensions instructions (Intel Sandy Bridge, AMD Bulldozer and later chips)
bindist No Build binary redistributable version without including nonfree decoders and encoders.
bzip2 Yes Use the bzlib compression library
cdio No Enable audio CD grabbing with dev-libs/libcdio.
cpudetection No Enables runtime CPU detection (useful for bindist, compatibility on other CPUs).
custom-cflags No No Build with user-specified CFLAGS (unsupported)
debug No No Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see
dirac No Enable Dirac video support (an advanced royalty-free video compression format) via the reference library: dirac.
doc No Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
encode Yes Add support for encoding of audio or video files
faac No Use external faac library for AAC encoding
frei0r No Enable frei0r wrapping in libavfilter
gpl Yes Build all GPL licensed code. Without this flag set the package is build under LGPL license.
gsm No Add support for the gsm lossy speech compression codec
hardcoded-tables Yes Use pre-calculated tables rather than calculating them on the fly.
ieee1394 No Enable FireWire/iLink IEEE1394 support (dv, camera, ...)
jack No Add support for the JACK Audio Connection Kit
jpeg2k No Support for JPEG 2000, a wavelet-based image compression format
mmx Yes Use the MMX instruction set
mmxext Yes Enable mmx2 support.
mp3 Yes Add support for reading mp3 files
Optional USE configuration for media-video/libav section 2:
USE flag (what is that?) Default Recommended Description
neon No Enable optimization support for ARM NEON processors
network No Enable network streaming support.
openssl No Prefer dev-libs/openssl over net-libs/gnutls to provide SSL/TLS support (notice: the resulting binaries are unredistributable).
oss No Add support for OSS (Open Sound System)
pic No Force shared libraries to be built as PIC (this is slower).
pulseaudio No Enable pulseaudio input support.
qt-faststart Yes Build and install qt-faststart application.
rtmp No Enable Real Time Messaging Protocol using librtmp instead the native implementation.
schroedinger No Enable Dirac video support (an advanced royalty-free video compression format) via libschroedinger (high-speed implementation in C of the Dirac codec).
sdl No Add support for Simple Direct Layer (media library)
speex No Add support for the speex audio codec (used for speech)
ssl Yes Enable SSL/TLS support using dev-libs/openssl or dev-libs/gnutls.
ssse3 Yes faster floating point optimization for SSSE3 capable chips (Intel Core 2 and later chips).
static-libs No No Build static versions of dynamic libraries as well
test No Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set it in make.conf/package.use anymore
theora No Add support for the Theora Video Compression Codec
threads No Add threads support for various packages. Usually pthreads
truetype Yes Add support for FreeType and/or FreeType2 fonts
v4l No Enable support for video4linux (using linux-headers or userspace libv4l libraries)
vaapi No Enable VAAPI (Video Acceleration API) for hardware decoding.
vdpau No Enable the Video Decode and Presentation API for Unix acceleration interface
vis No Adds support for SIMD optimizations for UltraSPARC processors.
vorbis Yes Add support for the OggVorbis audio codec
vpx No Enable vp8 encoding support using libvpx.
x264 Yes Enable h264 encoding using x264
xvid Yes Add support for's open-source mpeg-4 codec
zlib Yes Add support for zlib (de)compression


After setting appropriate USE flags, run the emerge command:

root #emerge --ask libav


Libav provides a new commandline 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 timestamp guessing/generation that had been a bane for everybody trying to transcode live streams in the past.

See also

External resources