I'm working on an app which needs to modify metadata of audio files. I have played with Apple's official demo AVReaderWriterOSX. I have tried to set the metadata of AVAssetWriterInput
and AVAssetWriter
, but I still can't make it work to write metadata to the output file. Does anyone have any examples for this?
Thank you in advance.
I think I have found the solution. The simplest solution is to use AVAssetExportSession
.
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]
initWithAsset:asset presetName:AVAssetExportPresetMediumQuality];
exportSession.outputURL = ...;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
exportSession.timeRange = CMTimeRangeMake(startTime, duration);
exportSession.metadata = ...;
[exportSession exportAsynchronouslyWithCompletionHandler:handlerBlock];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With