小编use*_*149的帖子

使用AVAssetExportSession导出Wav文件

我试图将淡入效果添加到wav文件中,然后使用导出具有添加的淡入效果的新文件AVAssetExportSession。我所看到的所有示例都将导出为m4u甚至可以使用wav或aif进行此操作吗?

我得到的错误是:

AVAssetExportSessionStatusFailed Error Domain=AVFoundationErrorDomain Code=-11822 "Cannot Open" UserInfo=0x1f01c9f0 {NSLocalizedDescription=Cannot Open, NSLocalizedFailureReason=This media format is not supported.} 
Run Code Online (Sandbox Code Playgroud)

我的代码如下所示

 NSString *inpath = [path stringByAppendingFormat:@"/%@",file];

    NSString *ename = [file stringByDeletingPathExtension];
    NSString *incname = [ename stringByAppendingString:@"1t"];
    NSString *outname = [incname stringByAppendingPathExtension:@"wav"];
    NSString *outpath = [path stringByAppendingFormat:@"/%@",outname];

    NSURL *urlpath = [NSURL fileURLWithPath:inpath];
    NSURL *urlout = [NSURL fileURLWithPath:outpath];



    NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES]
                                                        forKey:AVURLAssetPreferPreciseDurationAndTimingKey];
    AVURLAsset *anAsset = [[AVURLAsset alloc] initWithURL:urlpath options:options];


    //check the soundfile is greater than 50seconds
    CMTime assetTime = [anAsset …
Run Code Online (Sandbox Code Playgroud)

iphone objective-c avfoundation ios avassetexportsession

5
推荐指数
1
解决办法
4570
查看次数