Hey folks -
This question is centered around the Apple Videotoolbox (VT) hardware encoders that MacOS provides an API to. Specifically around the h.264 hardware encoders as found on the various consumer-level CPUs and discrete AMD GPUs. Per my signature, my Mac Pro 7,1 has the single AMD Radeon Pro Vega II GPU in it. While running the latest (v 27.0.1) version of OBS Studio, I found that the VT h.264 Hardware Encoder is listed twice. In previous versions, it was only listed once.
In discussions with the OBS devs, they explained that between v. 26 and v. 27, they started indexing the encoders based on what the OS tells it. And on the Mac Pro specifically, the OS is showing two h.264 hardware encoders, not one. As proof, one of the devs whipped me up a simple C program that just indexes and pukes out the encoders available from the VT. The code is:
When I run it on my Mac Pro, among the output is this:
Two encoders, one with a strange name. Let's run it on my 2018-era Macbook Pro that has the consumer-level CPU with the iGPU as well as the discrete Radeon GPU in it:
One encoder. And sure enough when I run OBS studio on either of these machines, I see two encoders on the Mac Pro, and one on the laptop.
My question is: why? What is it about the Pro that's causing VT to puke out two h.264 hardware encoders vs one? Any ideas?
Thanks.
This question is centered around the Apple Videotoolbox (VT) hardware encoders that MacOS provides an API to. Specifically around the h.264 hardware encoders as found on the various consumer-level CPUs and discrete AMD GPUs. Per my signature, my Mac Pro 7,1 has the single AMD Radeon Pro Vega II GPU in it. While running the latest (v 27.0.1) version of OBS Studio, I found that the VT h.264 Hardware Encoder is listed twice. In previous versions, it was only listed once.
In discussions with the OBS devs, they explained that between v. 26 and v. 27, they started indexing the encoders based on what the OS tells it. And on the Mac Pro specifically, the OS is showing two h.264 hardware encoders, not one. As proof, one of the devs whipped me up a simple C program that just indexes and pukes out the encoders available from the VT. The code is:
C:
#include <stdio.h>
#include <stdlib.h>
#include <CoreFoundation/CoreFoundation.h>
#include <VideoToolbox/VideoToolbox.h>
#include <VideoToolbox/VTVideoEncoderList.h>
#include <CoreMedia/CoreMedia.h>
int main() {
CFArrayRef encoder_list;
VTCopyVideoEncoderList(NULL, &encoder_list);
CFIndex size = CFArrayGetCount(encoder_list);
for (CFIndex i = 0; i < size; i++) {
CFDictionaryRef encoder_dict = CFArrayGetValueAtIndex(encoder_list, i);
#define VT_PRINT(key, name) \
CFStringRef name##_ref = CFDictionaryGetValue(encoder_dict, key); \
CFIndex name##_len = CFStringGetLength(name##_ref); \
char *name = malloc(name##_len + 1); \
memset(name, 0, name##_len + 1); \
CFStringGetFileSystemRepresentation(name##_ref, name, name##_len);
VT_PRINT(kVTVideoEncoderList_EncoderName, name);
printf("Name: %s\n", name);
VT_PRINT(kVTVideoEncoderList_DisplayName, dn);
printf("Display Name: %s\n", dn);
VT_PRINT(kVTVideoEncoderList_EncoderID, id);
printf("Id: %s\n", id);
printf("=========================\n");
}
CFRelease(encoder_list);
exit(0);
}
When I run it on my Mac Pro, among the output is this:
Code:
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000abc
=========================
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva
Two encoders, one with a strange name. Let's run it on my 2018-era Macbook Pro that has the consumer-level CPU with the iGPU as well as the discrete Radeon GPU in it:
Code:
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva
One encoder. And sure enough when I run OBS studio on either of these machines, I see two encoders on the Mac Pro, and one on the laptop.
My question is: why? What is it about the Pro that's causing VT to puke out two h.264 hardware encoders vs one? Any ideas?
Thanks.