Nikolai Manek
Nikolai Manek

Reputation: 1008

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

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)

Upvotes: 3

Views: 2118

Answers (1)

Adrian Ber
Adrian Ber

Reputation: 21380

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);.

Upvotes: 4

Related Questions