iOS - change audio assets BeatsPerMinute metadata tag

93 views Asked by At

Problem: I want to modify the iTunes song beats per minute.

Solution that I am trying: modifying the beats per minute of an audio asset AVAsset. I have used this code.

AVMutableMetadataItem *metaBeats = [AVMutableMetadataItem metadataItem];
metaBeats.identifier = AVMetadataIdentifierID3MetadataBeatsPerMinute;
metaBeats.key = AVMetadataIdentifierID3MetadataBeatsPerMinute;
metaBeats.keySpace = AVMetadataKeySpaceID3;
metaBeats.value = [NSNumber numberWithUnsignedInteger:40];

I have also used the other keyAVMetadataIdentifieriTunesMetadataBeatsPerMin but no option is working at all.

AVAssetExportSession export function is working fine.

I have seen other Q/As on stackoverflow which updates the metadata Common key tags that are working fine but this is not working at all.

Can anybody tell me what I am doing wrong? Any help will be appreciated. Thanks

Here is the link to project code https://www.dropbox.com/s/6cdos0k21b2fi3y/MusicEffectBeats.zip?dl=0

1

There are 1 answers

1
MOSES AFONSO On
NSURL *inputURL = [[NSBundle mainBundle] URLForResource:@"sample" 
withExtension:@"m4a"];
AVAsset *asset = [AVAsset assetWithURL:inputURL];

In the above code i cannot see your sample.m4a file

enter image description here