除了缩略图方法之外还有什么方法可以在Iphone中截取视频的屏幕截图吗? [英] Is there any way other than thumbnail method to take a screenshot of an video in Iphone?
问题描述
除缩略图方法之外还有其他方法可以截取视频吗?如果是,那么请告诉我,如果没有,那么请告诉我如何调整具有相同分辨率的缩略图图像?我在拍摄视频截图时遇到了问题。我使用过这个: -
Is there any way other than thumbnail method to take a screenshot of an video? If yes then please tell me if not then please tell me how to resize an thumbnail image with a same resolution? i have getting an issue while taking screenshot of video.i have used this:-
如何通过iPhone中的MPMediaPlayerController播放视频截图?
在此之后,我使用了合并我得到的图像
After this i ve used merging of an image by which i'm getting this
这里图像质量是我的大问题。
here image quality is my big issue.
我想要这个
我只想要在上面的屏幕截图中显示的视频和绘图具有相同的结果。
请帮助谢谢:)
I want only video and drawing shown in above screenshot with same resultion. Please help Thanks :)
推荐答案
除了缩略图方法之外我还可以通过它获取截图视频。!!!
There is a way other than thumbnail method by which i can get screenshot of a video.!!!
方式如下: -
- (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;
}
但是我的问题仍然是我在视频上绘图我无法获取视频的截图绘制叠加层,所以我必须使用合并图像。
But still my problem is same i m drawing on video i cant get video's screenshot with drawing overlay,so for that i ve to use merging of images.
谢谢:)
这篇关于除了缩略图方法之外还有什么方法可以在Iphone中截取视频的屏幕截图吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!