This is Gentoo's testing wiki. It is a non-operational environment and its textual content is outdated.

Please visit our production wiki at https://wiki.gentoo.org

FFmpeg

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

FFmpeg is a cross platform, free, open source media encoder/decoder toolkit. It contains the programs and libraries necessary to convert audio and video into a wide range of formats. FFmpeg was written by Fabrice Bellard (creator of QEMU and BPG).

Installation

USE flags

Some packages know the ffmpeg USE flag for enabling ffmpeg/libav-based audio/video codec support.

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

+bzip2 Enable bzip2 compression support
+dav1d Enable AV1 decoding support via media-libs/dav1d
+drm Enable use of x11-libs/libdrm for various hardware accelerated functions and Kernel Mode Setting screen capture
+encode Add support for encoding of audio or video files
+fontconfig Support for configuring and customizing font access via media-libs/fontconfig
+gnutls Enable using net-libs/gnutls for TLS/HTTPS support and other minor functions (has no effect if USE=openssl is set)
+gpl Enable use of GPL licensed code, should be kept enabled unless LGPL binaries are needed
+iconv Enable support for the iconv character set conversion library
+libass SRT/SSA/ASS (SubRip / SubStation Alpha) subtitle support
+network Enables network streaming support
+pic Force shared libraries to be built as PIC (this is safer)
+postproc Enable libpostproc video post processing library support (should not disable this unless need to disable USE=gpl)
+threads Add threads support for various packages. Usually pthreads
+truetype Enable drawtext filter support via media-libs/freetype and media-libs/harfbuzz
+xml Enable Dynamic Adaptive Streaming over HTTP (DASH) stream support using dev-libs/libxml2
+zlib Add support for zlib compression
X Add support for X11
alsa Add support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
amf Enable AMD's Advanced Media Framework support via media-video/amdgpu-pro-amf
amr Enable Adaptive Multi-Rate Audio support via media-libs/opencore-amr
amrenc Enable Adaptive Multi-Rate Audio encoding support via media-libs/vo-amrwbenc
appkit Enable Apple AppKit framework
bluray Enable Blu-ray filesystems reading support via media-libs/libbluray
bs2b Enable Bauer Stereo-to-Binaural filter support via media-libs/libbs2b
cdio Enable audio CDs reading via dev-libs/libcdio-paranoia
chromaprint Enable audio fingerprinting support via media-libs/chromaprint
chromium Builds libffmpeg.so to enable media playback in Chromium-based browsers like Opera and Vivaldi.
codec2 Enable codec2 low bit rate speech codec support via media-libs/codec2
cpudetection Enables runtime CPU detection (useful for bindist, compatibility on other CPUs)
cuda Enable support for various GPU-accelerated filters using NVIDIA PTX compiled with llvm-core/clang
debug Enable extra debug codepaths, like asserts and extra output. If you want to get meaningful backtraces see https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
doc Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
dvd Add support for DVDs
fdk Enable AAC (Advanced Audio Coding) encoding support via media-libs/fdk-aac in addition to FFmpeg's own implementation (warning: if USE=gpl is enabled, this produces a non-redistributable build)
flite Enable text-to-speech filter support via app-accessibility/flite
frei0r Enable use of filters through media-plugins/frei0r-plugins
fribidi Enable Bidi support for the drawtext filter via dev-libs/fribidi
gcrypt Enable using dev-libs/libgcrypt for rtmp(t)e support (not needed if using any of USE=gmp,librtmp,openssl), and for obtaining random bytes (not needed if USE=openssl)
glslang Use dev-util/glslang to compile GLSL
gme Enables various game music formats support via media-libs/game-music-emu
gmp Add support for dev-libs/gmp (GNU MP library)
gsm Add support for the gsm lossy speech compression codec
hardcoded-tables Use pre-calculated tables rather than calculating them on the fly. It results in an increase of approximately 15% in the size of libavcodec, the main library impacted by this change. It enables savings in table generation time, done once at codec initialization, since by hardcoding the tables, they do not need to be computed at runtime. However, the savings are often negligible (~100k cycles is a typical number) especially when amortized over the entire encoding/decoding operation. Improvements are being made to the runtime initialization, and so over time, this option will have an impact on fewer and fewer codecs.
iec61883 Enable FireWire DV/HDV input device support via media-libs/libiec61883
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
jpegxl Add JPEG XL image support
kvazaar Enable H.265/HEVC encoding support via media-libs/kvazaar
ladspa Enable the ability to support ladspa plugins
lame Prefer using LAME libraries for MP3 encoding support
lcms Enable ICC profile support via media-libs/lcms
libaom Enable AV1 de/encoding via media-libs/libaom (warning: this is the reference implementation and is slower than the alternatives)
libaribb24 Enable ARIB text and caption decoding via media-libs/aribb24
libcaca Add support for colored ASCII-art graphics
libdrm Enables x11-libs/libdrm support for better screen grabbing and hardware accelerated codecs.
libdvdnav Uses media-libs/libdvdnav to enable DVD demuxing
libdvdread Uses media-libs/libdvdread to enable DVD demuxing
libilbc Enable internet Low Bitrate Codec de/encoding support via media-libs/libilbc
liblc3 Enable Low Complexity Communication Codec de/encoding support via media-sound/liblc3
libplacebo Enable use of GPU-accelerated filters from media-libs/libplacebo
librtmp Enable Real Time Messaging Protocol support via media-video/rtmpdump in addition to FFmpeg's own implementation
libsoxr Enable use of the audio resampler from media-libs/soxr
libtesseract Enable Optical Character Recognition (OCR) filter support via app-text/tesseract
libv4l Uses media-libs/libv4l for video4linux instead of direct calls. Adds support for more devices via the userspace library.
libxml2 Uses dev-libs/libxml2 to enable dash demuxing support.
lv2 Enable use of filters through media-libs/lv2
lzma Support for LZMA compression algorithm
mipsdspr1 Enables MIPS DSP ASE R1 optimizations.
mipsdspr2 Enables MIPS DSP ASE R2 optimizations.
mipsfpu Enables floating point MIPS optimizations.
mmal Enables Multi-Media Abstraction Layer (MMAL) decoding support: Available e.g. on the Raspberry Pi.
modplug Add libmodplug support for playing SoundTracker-style music files
mp3 Add support for reading mp3 files
npp Enable Nvidia Performance Primitives-based filters via dev-util/nvidia-cuda-toolkit (warning: if USE=gpl is enabled, this produces non-redistributable build)
nvenc Add support for NVIDIA Encoder/Decoder (NVENC/NVDEC) API for hardware accelerated encoding and decoding on NVIDIA cards (requires x11-drivers/nvidia-drivers)
openal Add support for the Open Audio Library
opencl Enable OpenCL support (computation on GPU)
opengl Add support for OpenGL (3D graphics)
openh264 Enable H.264 encoding support via media-libs/openh264
openmpt Enable MPTM tracked music files decoding support via media-libs/libopenmpt
openssl Enable using dev-libs/openssl for TLS/HTTPS support and other minor functions (USE=gnutls has no effect if set)
opus Enable Opus audio codec support
oss Add support for OSS (Open Sound System)
pulseaudio Add sound server support via media-libs/libpulse (may be PulseAudio or PipeWire)
qrcode Enable QR encode generation support via media-gfx/qrencode
qsv Enable Intel Quick Sync Video support via media-libs/libvpl
quirc Enable QR decoding support via media-libs/quirc
rabbitmq Enable AMQP stream support via net-libs/rabbitmq-c
rav1e Enable AV1 encoding support via media-video/rav1e
rubberband Enable time-stretching and pitch-shifting audio filter support via media-libs/rubberband
samba Add support for SAMBA (Windows File and Printer sharing)
sdl Enable use of the Simple Direct Layer library (required for the ffplay command)
shaderc Enable support for various GPU-accelerated filters using Vulkan compiled with media-libs/shaderc
snappy Enable Snappy compression support via app-arch/snappy (required for Vidvox Hap encoder support)
sndio Enable audio output support via media-sound/sndio
soc Apply additional patches for efficient playback on some SoCs (e.g. ARM, RISC-V)
speex Add support for the speex audio codec (used for speech)
srt Enable Secure Reliable Transport (SRT) support via net-libs/srt
ssh Enable SSH/SFTP support via net-libs/libssh
static-libs Build static versions of dynamic libraries as well
svg Add support for SVG (Scalable Vector Graphics)
svt-av1 Enable AV1 encoding support via media-libs/svt-av1
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
twolame Enable MP2 encoding support via media-sound/twolame in addition to FFmpeg's own implementation
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
verify-sig Verify upstream signatures on distfiles
vidstab Enable video stabilization filter support via media-libs/vidstab
vmaf Enable Netflix's perceptual video quality assessment filter support via media-libs/libvmaf
vorbis Add support for the OggVorbis audio codec
vpx Enable VP8 and VP9 de/encoding support via media-libs/libvpx in addition to FFmpeg's own implementation (for decoding only)
vulkan Add support for 3D graphics and computing via the Vulkan cross-platform API
webp Add support for the WebP image format
x264 Enable h264 encoding using x264
x265 Enable H.265/HEVC encoding support via media-libs/x265
xvid Add support for xvid.org's open-source mpeg-4 codec
zeromq Enable ZMQ command receiver filter and streaming support via net-libs/zeromq
zimg Enable zscale filter support using media-libs/zimg
zvbi Enable teletext decoding support via media-libs/zvbi

The above list is non-comprehensive. Use equery (part of app-portage/gentoolkit) to see all available flags:

user $equery uses media-video/ffmpeg

Emerge

If not already pulled in as a dependency of other packages, and after setting appropriate USE flags, emerge FFmpeg:

root #emerge --ask media-video/ffmpeg

Configuration

This section needs some help.

Usage

Media player (ffplay)

If built with USE=sdl, a command line media player called ffplay is available.

user $curl http://www.dradio.de/streaming/dlf_hq_ogg.m3u | xargs ffplay

For more information consult the following commands:

user $man 1 ffplay
user $ffplay -h

See also

  • libav - An alternative to FFmpeg.

External resources