【问题标题】:Where is audio SampleBuffer in OpenTok, TokBox ios SDKOpenTok,TokBox ios SDK中的音频SampleBuffer在哪里
【发布时间】:2020-07-21 22:32:45
【问题描述】:

我正在使用 OpenTok iOS sdk 从 iphone 流式传输到 chrome。我想做的是在流式传输时录制视频的高分辨率版本。

通过Example 2 Let's Build OTPublisher 的 OTVideoCapture 接口使用自定义视频捕获器,我可以成功地将视频样本缓冲区记录到文件中。问题是,我找不到对从麦克风收集的音频数据的任何引用。

我假设它使用音频输入(AVCaptureDeviceInput),通过 AVCaptureAudioDataOutputSampleBufferDelegate 到音频输出(AVCaptureAudioDataOutput)在某处使用。

有人知道如何从 OpenTok iOS SDK 访问它吗?

【问题讨论】:

  • 为什么不直接使用归档 API 来记录呢?
  • 我们不使用归档 API 的原因是因为我们想要获得最大分辨率。但是我们不想通过网络发送它,它太大而无法直播。目标是存档低分辨率流,保存高分辨率以供以后使用。

标签: ios opentok tokbox


【解决方案1】:

captureOutput:didOutputSampleBuffer:fromConnection , fromConnection 字段将区分音频和声音连接并提供相应的缓冲区。

要设置音频输入/输出,您可以尝试使用 Let-Build-OTPublisher initCapture 方法

    //add audio input / outputs
AVCaptureDevice * audioDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeAudio];
_audioInput = [AVCaptureDeviceInput deviceInputWithDevice:audioDevice error:nil];
if([_captureSession canAddInput:_audioInput])
{
    NSLog(@"added audio device input");
    [_captureSession addInput:_audioInput];
}

_audioOutput = [[AVCaptureAudioDataOutput alloc] init];
if([_captureSession canAddOutput:_audioOutput])
{
    NSLog(@"audio output added");
    [_captureSession addOutput:_audioOutput];
}


[_audioOutput setSampleBufferDelegate:self queue:_capture_queue];

【讨论】:

  • 不错。这比我想象的要简单得多,我试图找到他们在哪里添加自己的音频输出并中断委托方法。谢谢
猜你喜欢
  • 2019-06-11
  • 2018-10-30
  • 1970-01-01
  • 2023-04-08
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2011-06-01
  • 1970-01-01
相关资源
最近更新 更多