存在一个问题,AVAssetExportSession的estimatedOutputFileLength属性总是返回 (并在模拟器上返回)。
我已经尝试了一切,尝试不同的outputFileType,切换shouldOptimizeForNetworkUse,指定(或不指定)outputURL.尽管如此,似乎没有什么是可行的,我开始认为这可能是SDK中的一个bug。
这是我的密码:
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc] initWithAsset:asset presetName:AVAssetExportPresetMediumQuality]; // doesn't matter which preset is used
//exportSession.shouldOptimizeForNetworkUse = YES;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
NSLog(@"bytes = %lld", exportSession.estimatedOutputFileLength);我只是搞不懂为什么这不管用!(iOS 6,iPhone 5)
发布于 2013-10-08 02:26:16
您可以通过在timeRange上设置适当的exportSession来解决这个问题:
exportSession.timeRange = CMTimeRangeMake(kCMTimeZero, asset.duration);在iOS中,在估计文件长度时,AVAssetExportSessionInternal.timeRange似乎没有得到合理的结果。
发布于 2014-10-28 11:08:59
你需要包括计时器。
您打算导出多少文件。如果没有它,它将返回0,
AVAssetExportSession *exporter = [[AVAssetExportSession alloc] initWithAsset: songAsset presetName: AVAssetExportPresetAppleM4A];
exporter.outputFileType = AVFileTypeAppleM4A;
CMTime full = CMTimeMultiplyByFloat64(exporter.asset.duration, 1);
exporter.timeRange = CMTimeRangeMake(kCMTimeZero, full);
long long size = exporter.estimatedOutputFileLength;
fileInfo.fileSize = size;https://stackoverflow.com/questions/14328576
复制相似问题