AVAssetExportSession
id3 タグを保持したままmp3 をエクスポートするにはどうすればよいですか? エクスポートする前に id3 タグを編集することはできますか?
このコードはAVAsset
(myMp3Asset) をファイルに書き込みますが、結果の mp3 には id3 タグがありません。
// myMp3Asset is an AVAsset
AVAssetExportSession *exportS = [[AVAssetExportSession alloc]
initWithAsset:myMp3Asset presetName:AVAssetExportPresetPassthrough];
exportS.outputFileType = @"com.apple.quicktime-movie";
NSString *path = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/%@", @"song"];
exportS.outputURL = [NSURL fileURLWithPath:path];;
[exportS exportAsynchronouslyWithCompletionHandler:^{
if (exportS.status == AVAssetExportSessionStatusCompleted)
{
//then rename mov format to the original format.
NSFileManager *manage = [NSFileManager defaultManager];
NSString *mp3Path = [NSHomeDirectory() stringByAppendingFormat:@"/Documents/%@.%@", @"song", @".mp3"];
NSError *error = nil;
[manage moveItemAtPath:path toPath:mp3Path error:&error];
}
}];