Cambiar AVMetadataItem

Tengo algunos archivos, -m4a -mp4 -mp3 etc. Quiero cambiar estos detalles

AVMetadataItemAVMetadataCommonKeyArtworkAVMetadataCommonKeyArtist

Puedo hacer conAVAssetExportSession, Pero necesito cambiar el directorio. ¿Hay alguna manera de escribir directamente en el archivo, por favor?

Encontré este programa, pero no funciona :(

NSError *error;
AVAssetWriter *assetWrtr = [[AVAssetWriter alloc] initWithURL:[NSURL fileURLWithPath:self.path] fileType:AVFileTypeAppleM4A error:&error];
NSLog(@"%@",error);

NSArray *existingMetadataArray = assetWrtr.metadata;
NSMutableArray *newMetadataArray = nil;
if (existingMetadataArray)
{
    newMetadataArray = [existingMetadataArray mutableCopy]; // To prevent overriding of existing metadata
}
else
{
    newMetadataArray = [[NSMutableArray alloc] init];
}


 AVMutableMetadataItem *item = [[AVMutableMetadataItem alloc] init];
item.keySpace = AVMetadataKeySpaceCommon;
item.key = AVMetadataCommonKeyArtwork;
item.value = UIImagePNGRepresentation([[UIImage alloc] initWithContentsOfFile:[[NSSearchPathForDirectoriesInDomains (NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0] stringByAppendingPathComponent:@".image"]]);

[newMetadataArray addObject:item];
assetWrtr.metadata = newMetadataArray;



[assetWrtr startWriting];
[assetWrtr startSessionAtSourceTime:kCMTimeZero];

Respuestas a la pregunta(1)

Su respuesta a la pregunta