Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use the hardware acceleration for ffmepg on m1-max?

Since there aren't m1 builds available from ffmpeg.org, I had to compile my own. Obviously, I'd like to get the best possible performance.

  • Does ffmpeg use the "Hardware-accelerated H.264" on the m1 max?
  • Is there anything I need to do, like compiler flags, to get it?
  • Any switch at run time?
  • How can I verify that it's being used?

To compile ffmpeg, I just did the basics:

./configure --prefix=/tmp/ff       --enable-gpl --enable-nonfree   --enable-libx264
make
make install

For x264, I just did ./configure --prefix=/tmp/ff make make install

to run:

ffmpeg -i random.wmv -c:v libx264 -preset ultrafast  -c:a aac  output-ultra.mp4 

Anything else I should be doing?

like image 776
ThoughtfulHacking Avatar asked Sep 02 '25 10:09

ThoughtfulHacking


1 Answers

It looks like what I wanted was videotoolbox

Usage is documented here, basically

To use H.264/HEVC hardware encoding in macOS, just use the encoder -c:v h264_videotoolbox

Example:

ffmpeg -i random.wmv -c:v h264_videotoolbox    -c:a aac  junk-vt.mp4

Seems to be slightly faster than "ultrafast" with software, and much smaller files.

like image 166
ThoughtfulHacking Avatar answered Sep 05 '25 05:09

ThoughtfulHacking