Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jasonmvp

macrumors 6502
Original poster
Jun 15, 2015
422
345
Northern VA
Hey gang -

Reference this thread as to the basis of my ask. I'm trying to understand how many Videotoolbox h.264 hardware encoders that MacOS is presenting to the user. On my Mac Pro, I see two. On my Macbook Pro (2018 w/Radeon GPU), I only see one. Forum user casperes1996 took the C program that I linked in my post, ran it on his iMac, and reported back his results. What I'd like to do is get a small collection of other Mac Pro users to do the same. I already know what the Radeon Pro Vega II MPX module looks like, so I don't need another one of those reported. If anyone has any other GPU installed in their system (or sets of GPUs), I'd appreciate the data.

And it's easy. I'll 'splain what needs to be done. First, open a text editor of your choice, and cut and paste the following C code into it. It's all there, so you can easily see what it's doing: querying the Apple Videotoolbox and barfing out all of the encoders available.

start here ---8<---
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);
}
end here ---8<---

Save it as a file called list.c in your home folder. Then pop open a Terminal.app (or iTerm, or whatever terminal you use) and compile it with GCC, assuming you have the XCode command line tools installed:

Code:
gcc -O2 list.c -o list -framework CoreServices -framework VideoToolbox

You don't need to sudo before that. You can do it as your normal user. Now you should have a small Mac binary in your home folder called list. Run it from the command line:

Code:
./list

And you should get a big ol' list of encoders.

Now, I'm specifically interested in the h.264 hardware encoders; the rest aren't a concern right now. Scroll through the output and look for entries that appear like this:

Code:
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva
=========================

Ignore the entries that have (SW) in parens, or any other CODEC. Just the H.264 (HW) ones. What I'd like to know is:
  • What card(s) do you have in your Mac?
  • How many H.264 (HW) entries do you see?
  • What are their Id: lines?
Thanks!
 

cobra521

macrumors 6502
Dec 14, 2016
393
136
FL
Jason,

I have one Apple AMD Radeon Pro W5700X 16 GB video card in my 7,1 Mac Pro.

Running the 'list' software gives two hits for H.264 (HW):

=========================
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000ac5
=========================
Name: Apple H.264 (HW)
Display Name: Apple H.264 (HW)
Id: com.apple.videotoolbox.videoencoder.h264.gva
=========================

Hope this helps,

Tom

PS: Since I'm not versed in the above terminology, it would be nice to get an idea of what it all means ;-)
 

jasonmvp

macrumors 6502
Original poster
Jun 15, 2015
422
345
Northern VA
PS: Since I'm not versed in the above terminology, it would be nice to get an idea of what it all means ;-)
Thanks for running that through Tom. As far as an explanation, I'm not sure what you know/don't know about the encoders on your Mac Pro? I don't want to insult your intelligence with an explanation, but basically Apple has provided an API for programmers to send video frames to:
  • The integrated GPU on your CPU if you have one (Mac Pros don't)
  • The discrete GPU in your system (Mac Pros all have those)
  • Supposedly: the T2 chip. Though that one is still suspect.
What happens next is the aforementioned hardware will either decode those frames for use/playback/etc, or encode the frames for output (saving a file, sending a video stream, etc). All with little to no impact on the CPU.

Your output matches mine with one distinct difference: the ID of the first one is a bit different. Where mine is
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000abc

Yours is:
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000ac5

That would indicate the first encoder is representing the GPU, and the second may be representing the T2 chip. Maybe.

Interesting. As Number 5 would say: "Need more data!"
 
  • Like
Reactions: cobra521

casperes1996

macrumors 604
Jan 26, 2014
7,599
5,770
Horsens, Denmark
Thanks for running that through Tom. As far as an explanation, I'm not sure what you know/don't know about the encoders on your Mac Pro? I don't want to insult your intelligence with an explanation, but basically Apple has provided an API for programmers to send video frames to:
  • The integrated GPU on your CPU if you have one (Mac Pros don't)
  • The discrete GPU in your system (Mac Pros all have those)
  • Supposedly: the T2 chip. Though that one is still suspect.
What happens next is the aforementioned hardware will either decode those frames for use/playback/etc, or encode the frames for output (saving a file, sending a video stream, etc). All with little to no impact on the CPU.

Your output matches mine with one distinct difference: the ID of the first one is a bit different. Where mine is
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000abc

Yours is:
Id: com.apple.videotoolbox.videoencoder.h264.gva.100000ac5

That would indicate the first encoder is representing the GPU, and the second may be representing the T2 chip. Maybe.

Interesting. As Number 5 would say: "Need more data!"

Considering the data I gathered on my iMac and sent in your prior post had two gva with no numbers afterwards, and I do have a T2 in this iMac, I would assume that's the case, yes.
HOWEVER, my iMac has a Radeon Pro 5700XT. Almost the same GPU as the W5700X. But does not show that 10000ac5 one. Which is... Curious. I'm very intrigued by how this develops
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.