내가 선택한 동영상을 내보내는 데 AVAssetExportSession을 사용하고 있습니다. 내 보낸 영화가 실제로 취하는 바이트 수는 어떻게 얻습니까?내 보낸 영화가 iOS에서 사용하는 메모리 크기를 찾는 방법은 무엇입니까?
이것은 내 코드의 스 니펫입니다. 내가 알기로 : "exportSession.estimatedOutputFileLength",하지만 0 만 제공합니다. 또한 정확한 크기와 예상치가 필요하지 않으므로 제대로 작동한다고해도 올바른 방법이라고 확신하지 못합니다.
if ([compatiblePresets containsObject:AVAssetExportPresetLowQuality])
{
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough];
NSArray* paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString* docsDir = [paths objectAtIndex:0];
NSString* targetFileName = [[mediaPath.description lastPathComponent] stringByDeletingPathExtension];
NSString* formattedFileName = [NSString stringWithFormat:@"%@.mp4", targetFileName];
NSString* videoPath = [NSString stringWithFormat:@"%@/%@", docsDir, formattedFileName];
exportSession.outputURL = [NSURL fileURLWithPath:videoPath];
exportSession.outputFileType = AVFileTypeMPEG4;
exportSession.shouldOptimizeForNetworkUse = NO;
NSLog(@"file size = %lld", exportSession.estimatedOutputFileLength);}
이 작업을 수행하는 방법 : NSData * videoData = [NSData dataWithContentsOfURL : exportSession.outputURL]; float movieSizeInKiloBytes = (float) [videoData length]/1024.0f; 내가 필요한 것을 제공합니까? 정확합니까? – gStation