我正在尝试查看用户选择的视频文件是否是隔行扫描/逐行扫描的,然后根据它进行一些操作。
我试图检查我提取的 cmsamplebuffer 是先定义为顶场还是底场,但这对所有输入都返回 null。
NSMutableDictionary *pixBuffAttributes = [[NSMutableDictionary alloc] init];
[pixBuffAttributes setObject:
[NSNumber numberWithInt:kCVPixelFormatType_422YpCbCr8]
forKey:(NSString*)kCVPixelBufferPixelFormatTypeKey];
myAsset = [[AVURLAsset alloc] initWithURL:urlpath options:pixBuffAttributes];
myAssetReader = [[AVAssetReader alloc] initWithAsset:myAsset error:nil];
myAssetOutput = [[AVAssetReaderTrackOutput alloc]initWithTrack:
[[myAsset tracksWithMediaType:AVMediaTypeVideo]
objectAtIndex: 0]
outputSettings:pixBuffAttributes];
[myAssetReader addOutput:myAssetOutput];
[myAssetReader startReading];
CMSampleBufferRef ref = [myAssetOutput copyNextSampleBuffer];
if(CVBufferGetAttachments(ref, kCVImageBufferFieldDetailKey, nil) == nil)
{
//always the case
}
else
{
//never happens
}
无论输入文件是交错的,上面总是返回 nil。我可能正试图在完全错误的庄园中测试这个,所以非常感谢任何帮助!