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:-
How to take a screenshot from an video playing through MPMediaPlayerController in iPhone?
After this i ve used merging of an image by which i'm getting this
here image quality is my big issue.
I want this
I want only video and drawing shown in above screenshot with same resultion. Please help Thanks :)
On the “Touch Settings” screen, scroll down until you see the “Back Tap” option, then tap it. In “Back Tap” settings, you have a choice of assigning the screenshot action to either two taps (“Double Tap”) or three taps (“Triple Tap”) on the back of the case.
Launch Settings on your iPhone and go to Accessibility. Tap Touch and scroll down to select Back Tap. You will have two options here, Double Tap and Triple Tap; select the option you prefer. Now, choose Screenshot from the given list of options.
There is a way other than thumbnail method by which i can get screenshot of a video.!!!
The way is this :-
- (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.
Thanks :)
Try the following code.
moviePlayer = [[MPMoviePlayerController alloc] init];
containerView =[[UIView alloc]initWithFrame:CGRectMake(40,130, 240,219)];
[moviePlayer setContentURL:[NSURL fileURLWithPath:moviePath]];
[[moviePlayer view] setFrame:CGRectMake(0, 0, containerView.frame.size.width, containerView.frame.size.height)]; // frame must match parent view
[self.view addSubview:containerView];
[containerView addSubview: [moviePlayer view]];
[moviePlayer setFullscreen:YES animated:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With