iOS Batch Capture video
// Generate
NSString *path = [Nshomedirectory () stringbyappendingstring:@ "/documents"];
NSLog (@ "path%@", Path);
for (int i = 0; i<[mitems count]; i++) {
Nsmutabledictionary *info = (nsmutabledictionary *) mitems[i]; Video information
NSString *mediapath;
MediaPath = [[NSBundle mainbundle] pathforresource:[info objectforkey:@ "MediaName"]
Oftype:[info Objectforkey:@ "type"];
UIImage *image = [ self getimage:mediapath];
[UIImageJPEGRepresentation (Image, 1) Writetofile:[path stringbyappendingpathcomponent:[nsstring stringWithFormat:@ "File%d.jpg", I]] atomically:YES];
}
Gets the screenshot of the video at the specified location
-(UIImage *) GetImage: (nsstring *) videourl{
avurlasset *asset = [[avurlassetalloc] initwithurl: [ Nsurl fileurlwithpath: videourl] options:nil];
avassetimagegenerator *gen = [[avassetimagegeneratoralloc] Initwithasset : asset];
Gen. Appliespreferredtracktransform =YES;
cmtime Time =cmtimemakewithseconds(20.5, ); The number of seconds to intercept. How many frames per second of video)
nserror *error = nil;
cmtime actualtime;
cgimageref image = [Gen copycgimageattime: Time actualtime: &actualtime Error:&error];
UIImage *thumb = [[UIImagealloc] initwithcgimage: image];
cgimagerelease(image);
return thumb;
}
iOS bulk capture video UIImage mp4 iOS videos