Tag: avmetadataitem

AVMetadataItem的编码

我有一个AVMetadataItem有CP1251(西里尔)编码的字段。 读取item.stringValue后,我得到垃圾 – 错误编码的string。 我已经尝试将该string转换为原始的UTF8,然后使用CP1251编码创build一个新的string – 没有运气,结果是零。 尝试采取item.dataValue – 没有骰子,它包含一个原始列表数据(从bplist …开始)。 任何想法都非常赞赏。 提前致谢。

Avmetadataitem从iOS上的iTunes或ID3元数据获取trackNumber

我正在尝试获取aac,mp3或mp4文件的trackNumber。 它不在commonMetadata中,所以我开始在其他元数据键中拼写。 我发现了一些看起来像的东西,但是我还是无法读懂它,并理解它。 即使是原始数据对我也没有意义。 目前,我只是想使用这个基本的代码: NSArray *meta = [asset metadataForFormat:AVMetadataFormatiTunesMetadata]; for ( AVMetadataItem* item in meta ) { id key = [item key]; NSString *value = [item stringValue]; NSLog(@"key = %@, value = %@", key, value); } 知道我正在寻找AVMetadataiTunesMetadataKeyTrackNumber。

如何从ios开发中的mp3文件中提取元数据

我正在使用云存储的ios音乐播放器。 我需要提取标题,艺术家,艺术品等音乐信息。 我有一个叫playit的动作,播放和暂停mp3文件。 它也应该填充一些与mp3文件相关的元数据的UILables和UIImage。 问题是我无法从超过不同的25个mp3文件中提取元数据。 这是我的代码: 文件的URL是正确的,因为audio播放器能够find并播放它,但我不知道为什么avmetadataitem无法获得元数据。 – (IBAction)playIt:(id)sender { AVAudioPlayer *audioPlayer; AVAsset *assest; NSString * applicationPath = [[NSBundle mainBundle] resourcePath]; NSString *secondParentPath = [applicationPath stringByDeletingLastPathComponent]; NSString *soundFilePath = [[secondParentPath stringByAppendingPathComponent:@"fisal1407"] stringByAppendingPathComponent:[musicFiles objectForKey:@"show_id"] ]; NSURL *fileURL = [NSURL URLWithString:[soundFilePath stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding]]; assest = [AVURLAsset URLAssetWithURL:fileURL options:nil]; NSArray *metadata = [assest commonMetadata]; for (NSString *format in […]

更改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 = […]

Xcode AVCapturesession扫描特定帧中的条形码(rectOfInterest不起作用)

我正试图为我目前正在使用的应用程序devise一款条形码扫描器。 我希望扫描仪预览填充设备的整个屏幕,并提供一个更小的框架指向条形码。 所有的工作是如何我想要的,但我不能得到的利益框架的工作。 这里是条码扫描器的实现: #import "GEScannerViewController.h" @import AVFoundation; @interface GEScannerViewController () <AVCaptureMetadataOutputObjectsDelegate> { AVCaptureSession *_session; AVCaptureDevice *_device; AVCaptureDeviceInput *_input; AVCaptureMetadataOutput *_output; AVCaptureVideoPreviewLayer *_prevLayer; UIView *_greyView; UIView *_highlightView; UIView *_scopeView; UILabel *_label; } @end @implementation GEScannerViewController – (void)viewDidLoad { [super viewDidLoad]; _label = [[UILabel alloc] init]; _label.frame = CGRectMake(0, self.view.bounds.size.height – 40, self.view.bounds.size.width, 40); _label.autoresizingMask = […]