Skip to main content
FFmpeg provides comprehensive support for encoding and decoding a wide variety of audio, video, and subtitle codecs. The codec system is built on the libavcodec library, which handles all codec-related operations.

Codec Types

FFmpeg supports three main types of codecs:
  • Video Codecs: Handle video compression and decompression
  • Audio Codecs: Process audio data encoding and decoding
  • Subtitle Codecs: Manage subtitle format conversion and rendering

Codec Properties

Codecs in FFmpeg can have various properties:
PropertyDescription
LOSSYCodec uses lossy compression (some data is discarded)
LOSSLESSCodec preserves all original data
INTRA_ONLYCodec only uses intra-frame compression
REORDERCodec can reorder frames (B-frames)
FIELDSCodec supports field-based encoding

Major Video Codec Families

MPEG Family

  • MPEG-1 Video (mpeg1video) - Classic MPEG-1 video compression
  • MPEG-2 Video (mpeg2video) - Broadcast-quality video with field support
  • MPEG-4 Part 2 (mpeg4) - Advanced video compression with B-frames
  • H.261 (h261) - Early ITU video codec
  • H.263 (h263) - Improved ITU codec with variants (H.263+, H.263i)
  • H.264/AVC (h264) - Modern high-efficiency video codec
  • H.265/HEVC (hevc) - Next-generation high-efficiency codec

Modern Codecs

  • VP8/VP9 (vp8, vp9) - Google’s open video codecs
  • AV1 (av1) - Royalty-free next-gen codec
  • VVC (vvc) - Versatile Video Codec (H.266)

Professional Codecs

  • ProRes (prores) - Apple’s professional video codec
  • DNxHD/DNxHR (dnxhd) - Avid’s professional codec
  • JPEG 2000 (jpeg2000) - High-quality still and motion codec
  • FFV1 (ffv1) - Lossless video archival codec

Legacy & Specialized

  • Microsoft Codecs: WMV1, WMV2, WMV3, MSMPEG4v1/v2/v3
  • RealVideo: RV10, RV20, RV30, RV40, RV60
  • Animation: Cinepak, QTRLE, Animation, GIF
  • Screen Capture: Flash Screen Video, ScreenPresso

Major Audio Codec Families

Lossy Audio

  • AAC (aac) - Advanced Audio Coding, standard for modern audio
  • MP3 (mp3) - MPEG-1/2 Layer III audio
  • MP2 (mp2) - MPEG-1 Layer II audio
  • Opus (opus) - Modern low-latency audio codec
  • Vorbis (vorbis) - Open-source lossy audio codec

Lossless Audio

  • FLAC (flac) - Free Lossless Audio Codec
  • ALAC (alac) - Apple Lossless Audio Codec
  • WavPack (wavpack) - Hybrid lossless/lossy codec
  • TTA (tta) - True Audio lossless codec

Professional Audio

  • PCM (various) - Uncompressed pulse-code modulation
  • DTS (dts) - Digital Theater Systems
  • AC-3/E-AC-3 (ac3, eac3) - Dolby Digital audio
  • TrueHD (truehd) - Dolby TrueHD lossless
  • MLP (mlp) - Meridian Lossless Packing

Speech & Telephony

  • AMR-NB/WB (amrnb, amrwb) - Adaptive Multi-Rate
  • Speex (speex) - Speech compression
  • G.723.1 (g723_1) - ITU telephony codec
  • G.729 (g729) - ITU low-bitrate codec
  • ILBC (ilbc) - Internet Low Bitrate Codec

PCM Variants

FFmpeg supports extensive PCM formats:
  • Signed/unsigned integers: 8, 16, 24, 32, 64-bit
  • Floating point: 16, 24, 32, 64-bit
  • Both big-endian and little-endian byte order
  • Planar and interleaved formats
  • Special formats: A-law, μ-law, Blu-ray, DVD

ADPCM Family

Adaptive Differential PCM variants for various platforms:
  • Gaming: 4XM, ADX, AFC, AGM, DTK, PSX, Xbox
  • Multimedia: IMA WAV, MS, Yamaha, Creative ADPCM
  • Proprietary: EA, Westwood, Microsoft variants

Subtitle Codecs

Text-Based

  • ASS/SSA (ass, ssa) - Advanced SubStation Alpha
  • SRT (srt) - SubRip text format
  • WebVTT (webvtt) - Web Video Text Tracks
  • MOVText (mov_text) - MP4 timed text
  • TTML (ttml) - Timed Text Markup Language

Bitmap-Based

  • DVD Subtitles (dvdsub) - MPEG-2 DVD bitmap subtitles
  • DVB Subtitles (dvbsub) - Digital Video Broadcasting subtitles
  • XSUB (xsub) - DivX XSUB format

Hardware Acceleration Support

Many codecs support hardware acceleration through:
  • QSV: Intel Quick Sync Video
  • NVENC/NVDEC: NVIDIA GPU encoding/decoding
  • VideoToolbox: Apple hardware acceleration
  • V4L2 M2M: Video4Linux2 memory-to-memory
  • MediaCodec: Android hardware codecs
  • AMF: AMD Advanced Media Framework
  • RKMPP: Rockchip Media Process Platform

Checking Available Codecs

To list all available codecs in your FFmpeg build:
# List all codecs
ffmpeg -codecs

# List all encoders
ffmpeg -encoders

# List all decoders
ffmpeg -decoders

# Get detailed information about a specific codec
ffmpeg -h encoder=libx264
ffmpeg -h decoder=h264

Codec Selection

When using FFmpeg, specify codecs with the -c or -codec option:
# Video codec
ffmpeg -i input.mp4 -c:v libx264 output.mp4

# Audio codec
ffmpeg -i input.wav -c:a aac output.m4a

# Multiple streams
ffmpeg -i input.mkv -c:v libx265 -c:a opus output.mkv

# Copy codec (no re-encoding)
ffmpeg -i input.mp4 -c copy output.mp4

See Also

  • Encoders - Available video and audio encoders
  • Decoders - Available video and audio decoders
  • Formats - Container format support

Build docs developers (and LLMs) love