I am trying to find the codec used to compress a movie. I am sure if I need to somehow use CMFormatDescription and get a CMVideoCodecType key. I am stuck as to how to get pa
I think it's definitely harder than it should be
#define FourCC2Str(code) (char[5]){(code >> 24) & 0xFF, (code >> 16) & 0xFF, (code >> 8) & 0xFF, code & 0xFF, 0}
if ([assetTrack.mediaType isEqualToString:AVMediaTypeVideo])
{
for (id formatDescription in assetTrack.formatDescriptions)
{
NSLog(@"formatDescription: %@", formatDescription);
CMFormatDescriptionRef desc = (__bridge CMFormatDescriptionRef)formatDescription;
//CMMediaType mediaType = CMFormatDescriptionGetMediaType(desc);
// CMVideoCodecType is typedefed to CMVideoCodecType
CMVideoCodecType codec = CMFormatDescriptionGetMediaSubType(desc);
NSString* codecString = [NSString stringWithCString:(const char *)FourCC2Str(codec) encoding:NSUTF8StringEncoding];
NSLog(@"%@", codecString);
}
}