iOS 如何获取本地视频的参数信息
2023-08-06 本文已影响0人
假若我年少有为不自卑
NSArray <AVAssetTrack *> *videoTracks = [asset tracksWithMediaType:AVMediaTypeVideo];
if (0 == videoTracks.count) {
return ;
}
AVAssetTrack *videoTrack = [videoTracks firstObject];
CMFormatDescriptionRef formatDescription = NULL;
NSArray *formatDescriptions = [videoTrack formatDescriptions];
if ([formatDescriptions count] > 0) {
formatDescription = (__bridge CMFormatDescriptionRef)[formatDescriptions objectAtIndex:0];
}
// 数据速率
float bps = [videoTrack estimatedDataRate];
// 分辨率
float fps = [videoTrack nominalFrameRate];