1

我正在尝试使用 AVFoundation (AVCaptureOutput + AVAssetWriter) 录制视频,同时从 iPod 库而不是麦克风播放音频。我采用了 RosyWriter 示例代码并删除了 AudioInput,而是设置 AVAssetReader 以读取未压缩格式的歌曲,

NSDictionary *outputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
                                    [NSNumber numberWithInt:kAudioFormatLinearPCM], AVFormatIDKey,
                                    [NSNumber numberWithFloat:44100.0], AVSampleRateKey,
                                    [NSNumber numberWithInt:16], AVLinearPCMBitDepthKey,
                                    [NSNumber numberWithBool:NO], AVLinearPCMIsNonInterleaved,
                                    [NSNumber numberWithBool:NO], AVLinearPCMIsFloatKey,
                                    [NSNumber numberWithBool:NO], AVLinearPCMIsBigEndianKey,
                                    nil];



    mAssetReader = [[AVAssetReader alloc] initWithAsset:mAsset error:nil];
    mAssetReaderOutput = [[AVAssetReaderTrackOutput alloc] initWithTrack:audioTrack outputSettings:outputSettings];

    if ([mAssetReader canAddOutput:mAssetReaderOutput]) {
        [mAssetReader addOutput:mAssetReaderOutput];
    } 

    [mAssetReader startReading];

然后定期轮询音频样本。但它不能正常工作。关于 VideoStar 或 Blux Movie 等应用程序如何实现它的任何建议?

4

0 回答 0