更改AVMetadataItem
我有一些文件,-m4a -mp4 -mp3等。我想改变这些细节
AVMetadataItem
-
AVMetadataCommonKeyArtwork
-
AVMetadataCommonKeyArtist
我可以用AVAssetExportSession
做,但我需要改变目录。 有没有办法可以直接在文件上写?
我发现这个程序,但不工作:(
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];
将UIImagePNGRepresentation更改为UIImageJPEGRepresentation ,则需要jpeg数据而不是png。
- 从iOS AVAssetWriter生成的原始H264 mdat获取PTS
- GPUImageMovieWriter – 崩溃时,状态为2时无法调用方法
- 使用GPUImage过滤video
- AVAssetWriter如何写下采样/压缩m4a / mp3文件
- .wav转换为AVAssetWritter ios的压缩格式
- AVAssetWriterinputH.264直通到QuickTime(.mov) – 传入SPS / PPS来创buildavcCprimefaces?
- OpenGL ES 2.0到iPad / iPhone上的video
- 使用AVCaptureVideoDataOutput和AVCaptureAudioDataOutput时的性能问题
- 如何将AVAssetReader和AVAssetWriter同时用于多个音轨(audio和video)?