I cannot get a precise CMTime for Generating Still Image from 1.8 second Video -


every time try generate still frame video asset, generated @ time of 0.000.. seconds. can see log message. thing can image @ time 0.000.. show in uiimageview called "myimageview." thought problem avurlassetpreferprecisedurationandtimingkey not set, after figured out how that, still not function..

here have..

time, actualtime, , generate declared in header

nsstring *path = [nshomedirectory() stringbyappendingpathcomponent:[nsstring stringwithformat:@"documents/videotest4.m4v"]]; //uisavevideoatpathtosavedphotosalbum(path, self, @selector(video:didfinishsavingwitherror:contextinfo:), nil); nsurl *url = [nsurl fileurlwithpath:path];  nsdictionary *options = [nsdictionary dictionarywithobject:[nsnumber numberwithbool:yes] forkey:avurlassetpreferprecisedurationandtimingkey]; avurlasset *asset = [[avurlasset alloc] initwithurl:url options:options];  float64 durationseconds = cmtimegetseconds([asset duration]);  generate = [[avassetimagegenerator alloc] initwithasset:asset]; nserror *err = nil;  time = cmtimemake(600,600.0); cgimageref imgref = [generate copycgimageattime:time actualtime:&actualtime error:&err]; uiimage *currentimg = [[uiimage alloc] initwithcgimage:imgref]; myimageview.image = currentimg;  nslog(@"the total video duration %f",durationseconds); nslog(@"the time want image %f",cmtimegetseconds(time)); nslog(@"the actual time image take %f",cmtimegetseconds(actualtime)); 

and console reads..

2011-04-28 18:49:59.062 videotest[26553:207] total video duration 1.880000

2011-04-28 18:49:59.064 videotest[26553:207] time want image 1.000000

2011-04-28 18:49:59.064 videotest[26553:207] actual time image take 0.000000

..........................

thank guys in advance.. :)

to resolve need set requestedtimetolerancebefore , requestedtimetoleranceafter kcmtimezero avassetimagegenerator.

avassetimagegenerator class reference


Comments

Popular posts from this blog

objective c - Change font of selected text in UITextView -

php - Accessing POST data in Facebook cavas app -

c# - Getting control value when switching a view as part of a multiview -