从我所读到的苹果不暴露api允许开发人员使用当前的sdk获取电影的缩略图.
任何人都可以分享一些关于他们如何处理这个问题的代码吗?我听说你可以访问相机选择器视图,并在ui图像选择器关闭之前找到图像视图.这看起来有点难看.
我还考虑过使用ffmpeg从电影中抓取一个帧但是不知道如何将其编译为iphone的库.任何指针都将非常感激
谁能告诉我如何从视频中提取图像?我到现在为止尝试的是我遵循这些:
之后我做了这个:
源代码:
- (void)viewDidLoad
{
videoPicker = [[UIImagePickerController alloc] init];
[videoPicker setDelegate:self];
videoPicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
NSArray *mediaTypesAllowed = [UIImagePickerController availableMediaTypesForSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
videoPicker.mediaTypes = mediaTypesAllowed;
videoPicker.view.hidden = YES;
}
-(IBAction)imgPickerController
{
[self presentModalViewController:videoPicker animated:YES];
videoPicker.view.hidden = NO;
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// e.g.
NSString *tempFilePath = [(NSURL *)[info valueForKey:UIImagePickerControllerMediaURL] absoluteString];
NSLog(@"didFinishPickingMediaWithInfo: %@",tempFilePath);
// e.g. /private/var/mobile/Applications/D1E784A4-EC1A-402B-81BF-F36D3A08A332/tmp/capture/capturedvideo.MOV
tempFilePath = [tempFilePath substringFromIndex:16];
NSLog(@"didFinishPickingMediaWithInfo: %@",tempFilePath);
NSLog(@"===Try to save video to camera roll.==="); …
Run Code Online (Sandbox Code Playgroud)