【问题标题】:Creating RTCVideoframe with CVPixelBuffer使用 CVPixelBuffer 创建 RTCVideoframe
【发布时间】:2018-05-31 05:50:01
【问题描述】:

在创建 RTCVideoframe 时需要帮助

这是 RTCVideoframe 的 init 方法 RTCVideoFrame(buffer: RTCVideoFrameBuffer, rotation: RTCVideoRotation, timeStampNs: Int64)

我能够将输入缓冲区作为 CVPixelBuffer

如何将CVpixelBuffer 转换为RTCVideoFrameBuffer

谢谢,非常感谢任何帮助

【问题讨论】:

  • 您找到解决方案了吗?
  • @OgulcanOrhan 请看我的回答。如有其他问题,请随时发布。谢谢
  • @Dutt 你能告诉我如何获取我使用 CMSampleBufferGetPresentationTimeStamp(sampleBuffer) 但 webRTC 视频在一段时间后冻结的时间戳:(

标签: swift webrtc replaykit


【解决方案1】:

使用我们从

收到的 cmSampleBuffer

`

sharedRecorder.startCapture(handler: { (cmSampleBuffer, rpSampleType, error) in
   switch rpSampleType {
  case RPSampleBufferType.video:

{
 let pixelBuffer = CMSampleBufferGetImageBuffer(cmSampleBuffer)!
 let rtcpixelBuffer = RTCCVPixelBuffer(pixelBuffer: pixelBuffer)
 videoFrame = RTCVideoFrame(buffer: rtcpixelBuffer, rotation: RTCVideoRotation._0, timeStampNs: Int64(timestamp))
}
} )}

`

【讨论】:

    猜你喜欢
    • 2018-06-08
    • 2015-10-27
    • 2014-02-01
    • 1970-01-01
    • 1970-01-01
    • 2016-09-23
    • 2011-12-23
    • 2016-02-18
    • 2016-03-08
    相关资源
    最近更新 更多