我正在开发一个需要修改音频文件元数据的应用程序。我玩过 Apple 的官方演示 AVReaderWriterOSX。我尝试设置 and 的元数据AVAssetWriterInput
,AVAssetWriter
但仍然无法将元数据写入输出文件。有没有人有这方面的例子?
先感谢您。
我正在开发一个需要修改音频文件元数据的应用程序。我玩过 Apple 的官方演示 AVReaderWriterOSX。我尝试设置 and 的元数据AVAssetWriterInput
,AVAssetWriter
但仍然无法将元数据写入输出文件。有没有人有这方面的例子?
先感谢您。
我想我已经找到了解决方案。最简单的解决方案是使用AVAssetExportSession
.
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]
initWithAsset:asset presetName:AVAssetExportPresetMediumQuality];
exportSession.outputURL = ...;
exportSession.outputFileType = AVFileTypeQuickTimeMovie;
exportSession.timeRange = CMTimeRangeMake(startTime, duration);
exportSession.metadata = ...;
[exportSession exportAsynchronouslyWithCompletionHandler:handlerBlock];