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
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)
amr No Enable Adaptive Multi-Rate Audio support
bindist No Build binary redistributable version without including nonfree decoders and encoders.
bs2b No Enable media-libs/libbs2b based Bauer
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 Backtraces
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
fdk No Use external fdk-aac library for AAC encoding
fontconfig No Support for configuring and customizing font access via media-libs/fontconfig
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
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
network Yes 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).
opus No Use the external opus library for encoding and decoding.
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.
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 Yes 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.
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
tools No Build and install small tools like aviocat, cws2fws, graph2dot, ismindex, qt-faststart.
truetype Yes Add support for FreeType and/or FreeType2 fonts
twolame No Enable MP2 encoding via media-sound/twolame as an alternative to the internal encoder
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
vorbis Yes Add support for the OggVorbis audio codec
vpx No Enable vp8 encoding support using libvpx.
wavpack No Add support for wavpack audio compression tools
webp No Enable WebP encoding with media-libs/libwebp
x264 Yes Enable h264 encoding using x264
x265 No Enable HEVC encoding with media-libs/x265
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