+ (CMVideoCodecType)videoCodecTypeForURL:(NSURL *)url {
AVURLAsset *videoAsset = (AVURLAsset *)[AVURLAsset URLAssetWithURL:url
options:nil];
NSArray *videoAssetTracks = [videoAsset tracksWithMediaType:AVMediaTypeVideo];
AVAssetTrack *videoAssetTrack = videoAssetTracks.firstObject;
CMFormatDescriptionRef desc = (__bridge CMFormatDescriptionRef)videoAssetTrack.formatDescriptions.firstObject;
CMVideoCodecType codec = CMVideoFormatDescriptionGetCodecType(desc);
return codec;
}
网友评论