How to Suppress FFmpeg Output in Bash
This article provides a quick overview of how to silence FFmpeg’s verbose console output to keep your Linux Bash scripts clean and readable. You will learn how to reduce logging levels using internal FFmpeg flags, redirect standard output and error streams to discard data, and combine these techniques for optimal script performance.
Using FFmpeg Log Level Flags
FFmpeg provides a built-in -loglevel flag that allows
you to control the verbosity of its terminal output. By default, FFmpeg
outputs a substantial amount of configuration and metadata information
to stderr.
To suppress everything except actual errors, you can set the log
level to error:
ffmpeg -loglevel error -i input.mp4 output.aviIf you want absolute silence—meaning FFmpeg will not output anything
to the console even if the command fails—you can use the
quiet log level:
ffmpeg -loglevel quiet -i input.mp4 output.aviRedirecting Standard Streams
Another common Linux method to clean up terminal output is stream
redirection. FFmpeg sends its banner and progress metrics to
stderr (Standard Error) rather than stdout
(Standard Output).
You can hide this output by redirecting stderr to
/dev/null, which acts as a black hole for data:
ffmpeg -i input.mp4 output.avi 2> /dev/nullIf you want to ensure that absolutely no output or potential system
errors escape into your Bash script, you can redirect both
stdout and stderr simultaneously:
ffmpeg -i input.mp4 output.avi > /dev/null 2>&1Best Practices for Bash Scripts
While completely silencing FFmpeg makes your console look clean, it
can make debugging difficult if a conversion fails. A robust approach
for Bash automation is combining the -hide_banner flag with
the error log level. The -hide_banner flag
specifically removes the build configuration and library versions while
preserving normal progress details and errors.
ffmpeg -hide_banner -loglevel error -i input.mp4 output.aviThis approach keeps your script logs uncluttered during successful runs but ensures you still receive critical diagnostic information if something goes wrong.