5

I am attempting to load a file called output.mov (created on the iPhone) as an AVURLAsset using the following code:

NSURL *outputURL = [NSURL fileURLWithPath:[NSString stringWithFormat:@"%@%@", NSTemporaryDirectory(), @"output.mov"]];

AVURLAsset *videoAsset = [AVURLAsset URLAssetWithURL:outputURL options:nil];

The file is located in the tmp directory of the app. No errors appear, but it seems that the asset is not loaded as no metadata is available (i.e. calling NSLog(@"%@", [videoAsset commonMetadata]) returns nothing) so I can't do anything with the asset.

I have used the following code to ensure that the resource is reachable via the URL, and it definitely seems to be:

if ([outputURL checkResourceIsReachableAndReturnError:&err] == NO)
        NSLog(@"Not reachable!");

so I am unsure why the asset is not loading. I have also tried loading the asset using [AVAsset assetWithURL:] but that also doesn't work.

Any help would be greatly appreciated.

Skoota
  • 5,280
  • 9
  • 52
  • 75
  • 4
    That might be so, but it doesn't solve the problem. Using `NSURL *outputURL = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingPathComponent:@"output.mov"]];` yields exactly the same problem. I also don't think that's particularly reasonable grounds to down vote this question - the question is perfectly legitimate and valid. – Skoota Mar 16 '13 at 10:16
  • Did you manage to figure out the issue Skoota? – KingPolygon Aug 20 '16 at 22:39

1 Answers1

0

It might be because of the encoding of your file. For example, if that file was encoded with Sorenson 3 (SVQ3) codec you need to modernize media file before passing it to AVURLAsset. You could do it using the QTMovieModernizer class.