除了缩略图方法之外还有其他方法可以在Iphone中截取视频吗?

Nik*_*sal 12 iphone image-capture objective-c

除了缩略图方法之外还有其他方法可以截取视频吗?如果是,那么请告诉我,如果没有,那么请告诉我如何调整具有相同分辨率的缩略图图像?我在拍摄视频截图时遇到了问题.我使用过:

如何通过iPhone中的MPMediaPlayerController播放视频截图?

在此之后,我使用合并的图像,我得到了这个解决问题

这里的图像质量是我的大问题.

我要这个

要求的输出

我只想要在上面的屏幕截图中显示的视频和绘图具有相同的结果.请帮忙谢谢:)

Nik*_*sal 6

除了缩略图方法之外,还有一种方法可以获取视频的屏幕截图.!!!

方式是这样的: -

- (UIImage *)imageFromVideoURL 
{
// result 
UIImage *image = nil;

// AVAssetImageGenerator
AVAsset *asset = [[AVURLAsset alloc] initWithURL:appDelegate.videoURL options:nil];; 
AVAssetImageGenerator *imageGenerator = [[AVAssetImageGenerator alloc] initWithAsset:asset];
imageGenerator.appliesPreferredTrackTransform = YES;

// calc midpoint time of video
Float64 durationSeconds = CMTimeGetSeconds([asset duration]);
CMTime midpoint = CMTimeMakeWithSeconds(durationSeconds/2.0, 600); 

// get the image from 
NSError *error = nil; 
CMTime actualTime;
CGImageRef halfWayImage = [imageGenerator copyCGImageAtTime:midpoint actualTime:&actualTime error:&error];

if (halfWayImage != NULL) 
{
    // cgimage to uiimage
    image = [[UIImage alloc] initWithCGImage:halfWayImage];
    [dic setValue:image forKey:kImage];
    NSLog(@"Values of dictonary==>%@", dic);
    NSLog(@"Videos Are:%@",appDelegate.videoURLArray);
    CGImageRelease(halfWayImage);
}
return image;
}
Run Code Online (Sandbox Code Playgroud)

但仍然我的问题是相同的我在绘制视频我不能得到视频的截图与绘图叠加,所以为此,我使用合并的图像.

谢谢 :)