3

この問題は私を夢中にさせてきました。タグ情報を追加し、AVAssetExportSession でエクスポートする AVAsset を使用して、Cocoa アプリケーションでいくつかの曲にタグを付けようとしています。ただし、何をしてもエクスポートはエラーで失敗します(OSStatus error -620.)" (notEnoughMemoryErr: insufficient physical memory)。私の MacBook では、これを行っているときは常に 3 ~ 4 ギガ以上の空き RAM があるため、これは正しくありません。どこかでエラーが発生している場合に備えて、すべてのタグ情報を削除しようとしましたが、役に立ちませんでした。

コードは次のとおりです。

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);
    for (NSString *key in session.error.userInfo.allKeys)
    {
        NSLog(@"%@: %@", key, [session.error.userInfo objectForKey:key]);
    }
}];

何か助けはありますか?私はこの問題に丸2日間立ち往生しています。

4

1 に答える 1