7

I have a MacBook Pro with a Kaby Lake processor running macOS High Sierra (10.12). Is it possibe somehow to setup FFmpeg to utilize hardware encoding of HEVC with toolbox, instead of libx265?

5

On macOPS there’s videotoolbox.

Check this out for the encoder options:

ffmpeg -hide_banner -h encoder=hevc_videotoolbox

Output:

Supported pixel formats: videotoolbox_vld nv12 yuv420p
hevc_videotoolbox AVOptions:
  -profile           <int>        E..V.... Profile (from 0 to 3) (default 0)
     main                         E..V.... Main Profile
     main10                       E..V.... Main10 Profile
  -allow_sw          <boolean>    E..V.... Allow software encoding (default false)
  -realtime          <boolean>    E..V.... Hint that encoding should happen in real-time if not faster (e.g. capturing from camera). (default false)
  -frames_before     <boolean>    E..V.... Other frames will come before the frames in this session. This helps smooth concatenation issues. (default false)
  -frames_after      <boolean>    E..V.... Other frames will come after the frames in this session. This helps smooth concatenation issues. (default false)

Maybe you can test with that, if you have a recent Mac.

More on videotoolbox: https://developer.apple.com/documentation/videotoolbox

As you can see, it taps into the hardware-based encoders available on macOS, offering a unified API for video encoding across multiple abstractions (Intel's QuickSync on supported Intel IGPs, etc).

Grab a build here: https://evermeet.cx/ffmpeg/

  • Are args like -crf or -b:v available in hevc_videotoolbox? Or how to check an arg is common or specific to an encoder? Thanks! – amdyes Aug 19 '19 at 3:45
  • @amdyes Nope. I am running macOS Mojave (10.15) on a 2019 MacBook Air with the latest install of FFmpeg from Homebrew, and honestly using hevc_videotoolbox is quite horrible. Speed is 2x to 3x playback speed of the source video, which is great! But the quality of the output is abysmal to be honest. The only way I got it to show decent (but still not great) quality for 720p video was by using -profile:v main -b:v 5500k but the filesize is not much different than the source 1080p video. Might be useful for streaming crappy video but seems like a experimental feature for now. – JakeGould Dec 13 '19 at 4:16
1

Not sure if this has changed since the OP's comment, but in FFmpeg 4.x the command is:

ffmpeg -hide_banner -h encoder=hevc_videotoolbox

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.