Is it possible to merge 2 webm video streams into one stream (in picture)

强颜欢笑 提交于 2019-12-11 01:13:09

问题


Is it possible to record 2 webm videos (with WebRTC) and then merge them into one stream (picture in picture).

Example:

recording A shows camera A (streams out)

recording B shows camera B (streams out)

stream A shows one frame with A+B as merged stream (interview between two people)


回答1:


Yes, it is by using the Media Recording API.

First you have to create a <canvas> where you will draw the two <video> elements. When creating the MediaRecorder you will pass the canvas stream: new MediaRecorder(canvas.captureStream()).

In a timeout/interval you will draw the two videos in the canvas: canvas.getContext("2d").drawImage(video, 0, 0, width, height);.



来源:https://stackoverflow.com/questions/40966322/is-it-possible-to-merge-2-webm-video-streams-into-one-stream-in-picture

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!