Closed nbutmickey closed 10 months ago
当前 Webcodecs 不支持 alpha,而且 webm + vp8/vp9 是将 alpha 分开编码的,未来实现透明预计也会很麻烦,更多信息参考:https://github.com/w3c/webcodecs/issues/377
现在有一个可行途径,对 mp4 + avc (兼容性最好的组合)的视频,使用 WebAV 进行抠图,再绘制到 canvas 将能得到背景透明的视频。 参考文章:WebGL Chromakey 实时绿幕抠图
文章中包含了 DEMO、源码链接; 实际验证下来,手动调整到合适参数,实际抠图效果、性能都挺好的,可用于生产。
实际场景中存在基于webm的透明通道视频,视频中有人物形象以及透明背景,想基于该视频在其之上加上背景图,生成一个完整的带背景的视频,目前看WebAv应该还暂时不支持这种格式的解复用和最后的封装,想问下有什么比较好的解决思路