User Tools

Site Tools


ffmpeg:hardware_acceleration_using_gpu:benchmark

ffmpeg - Hardware Acceleration using GPU - Benchmark

Null muxer

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 -

Timing decoding

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.


Benchmark option

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

Choosing streams

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:

  • -an to ignore audio streams.
  • -vn to ignore video streams.

Threads

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

Choosing a decoder

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 -

Example

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.

  • utime: user time.
    • utime is the sum of processing time across all threads. Since they may operate in parallel, utime can exceed rtime.
  • stime: system time.
  • rtime: real time.
ffmpeg/hardware_acceleration_using_gpu/benchmark.txt · Last modified: 2023/06/13 10:34 by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki