Skip to main content
FFmpeg’s behavior can be controlled at runtime through environment variables, command-line options, and configuration settings. This page covers the runtime configuration options available.

Environment Variables

FFmpeg recognizes several environment variables that affect its runtime behavior:

FFREPORT

Control detailed logging and report generation:
# Generate a report with default settings
export FFREPORT=1
ffmpeg -i input.mp4 output.mp4

# Custom report file and log level
FFFREPORT=file=ffreport.log:level=32 ffmpeg -i input.mp4 output.mp4

# Report with timestamp
FFFREPORT=file=%p-%t.log:level=48 ffmpeg -i input.mp4 output.mp4
  • file - Set the report filename
    • %p - Expands to program name (e.g., “ffmpeg”)
    • %t - Expands to timestamp
    • %% - Literal percent sign
  • level - Set log verbosity level (numerical value)
    • 8 - Fatal errors only
    • 16 - Errors
    • 24 - Warnings
    • 32 - Info (default)
    • 40 - Verbose
    • 48 - Debug

Log Coloring

Control colored output in terminal:
# Force colored output
export AV_LOG_FORCE_COLOR=1
ffmpeg -i input.mp4 output.mp4

# Disable colored output
export AV_LOG_FORCE_NOCOLOR=1
ffmpeg -i input.mp4 output.mp4
By default, FFmpeg automatically detects terminal capabilities and enables colors when supported. Use these variables to override auto-detection.

NO_COLOR

Respects the NO_COLOR standard:
export NO_COLOR=1
ffmpeg -i input.mp4 output.mp4

FATE_SAMPLES

Specify location of test samples for FATE testing:
export FATE_SAMPLES=/path/to/fate-samples
make fate

Common Runtime Options

These options control FFmpeg’s behavior during execution:

Global Options

# Show version information
ffmpeg -version

# List all codecs
ffmpeg -codecs

# List all formats
ffmpeg -formats

# List all filters
ffmpeg -filters

# List all devices
ffmpeg -devices

# Show help for specific codec
ffmpeg -h encoder=libx264

Logging Options

# Set log level
ffmpeg -loglevel debug -i input.mp4 output.mp4
ffmpeg -loglevel info -i input.mp4 output.mp4   # Default
ffmpeg -loglevel warning -i input.mp4 output.mp4
ffmpeg -loglevel error -i input.mp4 output.mp4
ffmpeg -loglevel quiet -i input.mp4 output.mp4  # Silent

# Show repeated log messages
ffmpeg -loglevel repeat+info -i input.mp4 output.mp4

# Generate detailed report (alternative to FFREPORT)
ffmpeg -report -i input.mp4 output.mp4
LevelValueDescription
quiet-8Show nothing
panic0Only show fatal errors
fatal8Fatal errors
error16All errors
warning24Warnings and errors
info32Informational messages (default)
verbose40Verbose info
debug48Debugging information
trace56Extremely verbose debugging
# Hide banner (version info, copyright)
ffmpeg -hide_banner -i input.mp4 output.mp4

# Show progress statistics
ffmpeg -stats -i input.mp4 output.mp4  # Default

# Hide progress statistics
ffmpeg -nostats -i input.mp4 output.mp4

# Show periodic progress
ffmpeg -progress pipe:1 -i input.mp4 output.mp4

CPU Flags

Modifying CPU flags can affect performance and compatibility. Only use for testing or troubleshooting.
# Disable all SIMD optimizations
ffmpeg -cpuflags 0 -i input.mp4 output.mp4

# Disable SSE, enable MMX
ffmpeg -cpuflags -sse+mmx -i input.mp4 output.mp4

# Enable only basic optimizations
ffmpeg -cpuflags mmx -i input.mp4 output.mp4

Overwrite Behavior

# Automatically overwrite output files
ffmpeg -y -i input.mp4 output.mp4

# Never overwrite output files
ffmpeg -n -i input.mp4 output.mp4

# Prompt before overwriting (default)
ffmpeg -i input.mp4 output.mp4

Performance Options

Threading

# Set number of threads (auto-detect by default)
ffmpeg -threads 4 -i input.mp4 output.mp4

# Use all available CPU cores
ffmpeg -threads 0 -i input.mp4 output.mp4

# Disable multithreading
ffmpeg -threads 1 -i input.mp4 output.mp4

Buffer Sizes

# Set input buffer size
ffmpeg -buffer_size 1024k -i input.mp4 output.mp4

# Set maximum demux-decode delay
ffmpeg -fflags +discardcorrupt -i input.mp4 output.mp4

Hardware Acceleration

# Auto-select hardware acceleration
ffmpeg -hwaccel auto -i input.mp4 output.mp4

# Use specific hardware acceleration
ffmpeg -hwaccel cuda -i input.mp4 output.mp4
ffmpeg -hwaccel vaapi -i input.mp4 output.mp4
ffmpeg -hwaccel videotoolbox -i input.mp4 output.mp4

# Specify hardware device
ffmpeg -hwaccel cuda -hwaccel_device 0 -i input.mp4 output.mp4

# Hardware decode only (not encode)
ffmpeg -hwaccel cuda -i input.mp4 -c:v libx264 output.mp4
Hardware acceleration must be enabled at build time. Check available options with ffmpeg -hwaccels.

Input/Output Options

Format Options

# Force input format
ffmpeg -f rawvideo -i input.raw output.mp4

# Force output format
ffmpeg -i input.mp4 -f matroska output.mkv

# Disable format auto-detection
ffmpeg -f mpegts -i input.ts output.mp4

Stream Selection

# Map specific streams
ffmpeg -i input.mp4 -map 0:v:0 -map 0:a:1 output.mp4

# Disable audio
ffmpeg -i input.mp4 -an output.mp4

# Disable video
ffmpeg -i input.mp4 -vn output.mp3

# Disable subtitles
ffmpeg -i input.mkv -sn output.mp4

Duration and Time Options

# Set output duration
ffmpeg -i input.mp4 -t 30 output.mp4

# Start from specific time
ffmpeg -ss 00:01:00 -i input.mp4 output.mp4

# Fast seek (less accurate)
ffmpeg -ss 00:01:00 -i input.mp4 -t 30 output.mp4

# Accurate seek
ffmpeg -i input.mp4 -ss 00:01:00 -t 30 output.mp4

Configuration Files

FFmpeg does not use traditional configuration files. All settings are specified via command-line options or environment variables.
However, you can use shell scripts or wrapper scripts for common configurations:
#!/bin/bash
# ffmpeg-hq.sh - High-quality encoding wrapper

ffmpeg -hide_banner -loglevel info \
  -i "$1" \
  -c:v libx264 -preset slow -crf 18 \
  -c:a aac -b:a 256k \
  "$2"

Preset Files

FFmpeg supports preset files for encoder settings. See the Presets page for details.

Maximum Memory and Cache

# Set maximum memory for buffering
ffmpeg -max_alloc 100000000 -i input.mp4 output.mp4

# Set protocol whitelist (security)
ffmpeg -protocol_whitelist file,http,https,tcp,tls -i input.m3u8 output.mp4

Advanced Runtime Options

Debug Options

# Show timestamps
ffmpeg -debug_ts -i input.mp4 output.mp4

# Dump input format information
ffmpeg -dump -i input.mp4 output.mp4

# Show all frames
ffmpeg -showinfo -i input.mp4 -f null -

Error Handling

# Continue on decoding errors
ffmpeg -err_detect ignore_err -i input.mp4 output.mp4

# Exit on specific errors
ffmpeg -xerror -i input.mp4 output.mp4

# Abort on certain flags
ffmpeg -abort_on empty_output -i input.mp4 output.mp4

Frame Dropping

# Drop frames if CPU is slow
ffmpeg -framedrop -i input.mp4 output.mp4

# Don't drop frames
ffmpeg -noframedrop -i input.mp4 output.mp4

Runtime Statistics and Monitoring

# Show periodic progress to file
ffmpeg -progress progress.txt -i input.mp4 output.mp4

# Show benchmarking information
ffmpeg -benchmark -i input.mp4 -f null -

# Show bitstream filter information
ffmpeg -vstats -i input.mp4 output.mp4

Examples

Silent Encoding with Report

FFFREPORT=file=encode.log:level=32 ffmpeg -loglevel quiet -y -i input.mp4 output.mp4

High-Performance Conversion

ffmpeg -hide_banner -threads 0 -hwaccel auto \
  -i input.mp4 \
  -c:v h264_nvenc -preset fast \
  -c:a copy \
  -y output.mp4

Debugging Failed Conversion

FFFREPORT=file=debug-%t.log:level=48 ffmpeg \
  -loglevel debug \
  -debug_ts \
  -err_detect explode \
  -i problematic.mp4 \
  output.mp4

Resource-Constrained Encoding

ffmpeg -threads 2 -max_alloc 50000000 \
  -i input.mp4 \
  -c:v libx264 -preset veryfast -crf 28 \
  -c:a aac -b:a 96k \
  output.mp4

Build docs developers (and LLMs) love