我没有运气让带有 RGBA 像素的 h264 视频在 iOS 上运行(在 iOS 10.2 上测试过)这可能吗? Apple 文档对此没有过多说明:https://developer.apple.com/library/content/documentation/Miscellaneous/Conceptual/iPhoneOSTechOverview/MediaLayer/MediaLayer.html
我没有太多有趣的代码可以分享,因为它只是 AVPlayer 不显示具有 RGBA 像素的视频。
最佳答案
然而,不可能将 H264 解码为准确的“RGBA”: AVPlayerItemVideoOutput 可以设置为:kCVPixelFormatType_32BGRA 使用 kCVPixelBufferPixelFormatTypeKey
和
VTDecompressionSessionCreate 还允许:kCVPixelFormatType_32BGRA。
然后在渲染时我会像这样调整像素:gl_FragColor.bgra = texture2D(SamplerRGB, v_textureCoordinate);
所以答案是肯定的,但您必须进行渲染和调配。
/一个
(编辑。添加代码链接):
这是 Apple 的一个非常棒的项目,可以让您继续...... Real-time Video Processing Using AVPlayerItemVideoOutput
只需将它从 YUV 更改为 RGB 并绕过着色器的“colorConversionMatrix”部分。
祝你好运!
关于iOS - 可以播放 RBGA 视频吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42821909/