【发布时间】:2016-06-01 01:34:20
【问题描述】:
我正在尝试查看用户选择的视频文件是否是隔行/逐行的,然后根据它进行一些操作。
我试图检查我提取的 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。我可能正在尝试在完全错误的庄园中进行测试,因此非常感谢您的帮助!
【问题讨论】:
标签: objective-c macos video avfoundation interlacing