ios - Creating Thumbnail from Video - Improving Speed Performance via MPMoviePlayerController -
this code using. want generate thumbnail after create video via these thumbnail drawing done on "drawimage" uiimageview.
while([self.thunbnailarray count]) { id times = [self.thunbnailarray objectatindex:0];////self.thumbnailarray contains duratin of player @ thumbnail generate////// [self.thunbnailarray removeobjectatindex:0]; uiimage* thumbnail = [player1 thumbnailimageattime:[times floatvalue] timeoption:mpmovietimeoptionexact]; uigraphicsbeginimagecontext(drawimage.frame.size);////drawimage uiimageview make drawing [drawimage.layer renderincontext:uigraphicsgetcurrentcontext()]; uiimage *viewimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); cgimageref firstimageref = thumbnail.cgimage;/////merge thumbnail , drawing both cgfloat firstwidth = cgimagegetwidth(firstimageref); cgfloat firstheight = cgimagegetheight(firstimageref); cgsize mergedsize = cgsizemake(firstwidth, firstheight); uigraphicsbeginimagecontext(mergedsize); [thumbnail drawinrect:cgrectmake(0, 0, firstwidth, firstheight)]; [viewimage drawinrect:cgrectmake(0, 0, firstwidth, firstheight)]; uiimage *newimage = uigraphicsgetimagefromcurrentimagecontext(); uigraphicsendimagecontext(); [self.imagearray addobject:newimage];///self.imagearray used generate video }
Comments
Post a Comment