A simple way to benchmark decoding is to use the null muxer:
ffmpeg -i input -f null -
NOTE: The following parts of the command forces a null file:
-f null -
Linux and macOS users can add the time command:
time ffmpeg -i input -f null -
returns:
[...] real 0m3.115s user 0m0.223s sys 0m0.244s
NOTE: See man time for more info.
The -benchmark option can be added to output CPU time and maximum memory consumption:
time ffmpeg -i input -benchmark -f null -
returns:
[...] bench: utime=0.154s stime=0.196s rtime=3.000s bench: maxrss=365256kB
If you want to just decode a particular stream then use the map option:
ffmpeg -i input -map 0:a:0 -f null -
NOTE: Another approach to ignore streams is to use:
You can decode with one thread if you want to:
ffmpeg -threads 1 -i input -f null -
NOTE: Not all decoders have threading capabilities and some have several.
You can check decoder details such as
ffmpeg -h decoder=h264
There can be several decoders available for a format.
You can name the decoder if you do not want to rely on the default:
ffmpeg -c:v vp8 -i input -f null - ffmpeg -c:v libvpx -i input -f null -
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -hwaccel_output_format vaapi -i input.mp4 -c:v hevc_vaapi -q:v 28 -f null - -benchmark
returns:
... bench: utime=0.156s stime=0.195s rtime=3.003s bench: maxrss=358944kB
NOTE: maxrss indicates the maximum RAM used during the ffmpeg execution.