【问题标题】:How to produce YUVI420 frame to SurfaceTexture in similar manner like camera produces frames to SurfaceTexture?如何以类似于相机为 SurfaceTexture 生成帧的方式生成 YUVI420 帧到 SurfaceTexture?
【发布时间】:2020-03-02 13:34:49
【问题描述】:

我可以使用 openGL 在 GLSurfaceView 上渲染 YUVI420 帧,但我的要求是在 SurfaceTexture 上渲染帧。 基本上我想将帧生成到SurfaceTexture,而不是像渲染到TextureView 等,我有来自WebRTC 的YUV 数据流,我希望这个流在SurfaceTexture 中,以便稍后我可以在@987654327 中访问它@在消费者层面。 我找不到任何关于在 SurfaceTexture 上生成帧的来源。是否可以将 YUV 帧生成到 SurfaceTexure?

【问题讨论】:

    标签: android opengl-es yuv


    【解决方案1】:

    可以将YUVI420帧转成byteArray,在canvas上绘制,放到TextureView上

    val canvas: Canvas = textureView.lockCanvas()
    canvas.drawBitmap(sourceBitmap, 200f, 100f, Paint())
    textureView.unlockCanvasAndPost(canvas)
    

    【讨论】:

    • sourceBitmap 是 YUVI420 还是 RGB 帧? SurfaceTexture 的消费者可以使用它吗?
    • sourceBitmap 是 YUVI420 但可以随时转换。我找到了这个问题/答案stackoverflow.com/questions/30510928/…
    • 嘿,我知道如何转换为 RGB,只需阅读 SurfaceTexture 的文档即可。 SurfaceTexture 使用 EXTERNAL_TEXTURE_OES,它使用 YUV 格式。转换为 RGB 操作缓慢,这不是解决此问题的方法,请参阅 SurfaceTexture。 TextureView 我知道如何使用 EGL Context 渲染 YUV 以及位图。
    • 抱歉,在最初的问题中不清楚。只需要忽略 OpenGL 进行转换。但你是对的,我的结论不符合那个额外的要求。
    猜你喜欢
    • 1970-01-01
    • 2017-02-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-07-16
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多