objective c - AVAssetExportSession gives -620 error (insufficient physical memory) with 4 gigs free RAM -


this problem has been driving me crazy. trying tag songs in cocoa application using avasset adding tag info , exporting avassetexportsession. however, no matter do, export fails error (osstatus error -620.)" (notenoughmemoryerr: insufficient physical memory). on macbook have 3-4 gigs or more of free ram when doing this, can't right. tried removing tag information, in case causing error somewhere, didn't help.

here code:

avurlasset *asset = [avurlasset urlassetwithurl:[nsurl fileurlwithpath:[tempsongpath stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]] options:nil];  avassetexportsession *session; session = [avassetexportsession exportsessionwithasset:asset presetname:avassetexportpresetapplem4a]; session.outputfiletype = avfiletypeapplem4a;  nsurl *outputurl = [nsurl urlwithstring:[[nsstring stringwithformat:@"%@path/%@", nstemporarydirectory(), @"output.m4a"] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]];  session.outputurl = outputurl; nslog(@"asset: %@", asset); nslog(@"session %@", session); [session exportasynchronouslywithcompletionhandler:^{       if (avassetexportsessionstatuscompleted == session.status) {         nslog(@"completed");     }      nsstring *cause;     nsstring *stringerror;     if (session.error)     {         nslog(@"%@", session.error);         stringerror = [session.error localizeddescription];         cause = session.error.localizedfailurereason;      }     else         stringerror = @"unknown error";     nslog(@"error: %@ because %@", stringerror, cause);     (nsstring *key in session.error.userinfo.allkeys)     {         nslog(@"%@: %@", key, [session.error.userinfo objectforkey:key]);     } }]; 

any @ all? i've been stuck on problem 2 full days.

the out-of-memory error red herring. problem line:

nsurl *outputurl = [nsurl urlwithstring:[[nsstring stringwithformat:@"%@path/%@", nstemporarydirectory(), @"output.m4a"] stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]]; 

try replacing this:

nsurl *outputurl = [nsurl fileurlwithpath:[nsstring stringwithformat:@"%@/%@", nstemporarydirectory(), @"output.m4a"] isdirectory:no]; 

i've tested above , works fine.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -