我正在使用下面的代码,但它不显示准确的大小,假设我的文件大小是50Mb,但它显示大约90MB。如何获取从UIimagePicker获取的视频大小?
NSError *error;
NSURL * mediaURL = [info objectForKey:UIImagePickerControllerMediaURL];
NSDictionary * properties = [[NSFileManager defaultManager] attributesOfItemAtPath:mediaURL.path error:&error];
NSNumber * size = [properties objectForKey: NSFileSize];
而且我想下面的代码
NSDictionary *attribs = [[NSFileManager defaultManager] attributesOfItemAtPath:moviePath error:&error];
if (attribs) {
NSString *string = [NSByteCountFormatter stringFromByteCount:[attribs fileSize] countStyle:NSByteCountFormatterCountStyleFile];
NSLog(@"%@", string);
}
它也同样result.I想确切的文件size.Can任何机构帮助我。 谢谢
有你提到的SO,http://stackoverflow.com/a/27245011/6742121这个答案? @Bittoo – KAR
其实我在压缩视频后得到这个结果。但是在压缩视频尺寸增加之后是有原因的。 – Bittoo