Tuesday, April 30, 2019

Streaming Custom Videos in Google Hangouts

Summary:

With this method, I was able to send Google Hangouts any video contents, such as me with a news broadcast background, while the small TV in that background is showing my desktop playing a live Youtube video.

Update: now there's an easier way: use OBS's v4l2sink plugin + v4l2loopback kernel module. See this article.


OBS is a fine tool that enables us to overlay various visual/audio sources, on the fly, for streaming and/or recording. Unfortunately, it doesn't support a virtual cam under Linux (there is a plugin that only works under Windows), i.e. I can't send a complex composition of a live desktop screen, webcam, video, etc. to Google Hangouts.

Webcamoid is another fine tool that supports output to a virtual cam under Linux, which Google Hangouts can directly use.

Several attempts were made, but I wasn't able to get a result with low enough latency for video conferencing. The video latency caused an unacceptable out-of-sync problem with the audio.

I reached an easy workaround, which is resource heavy, but works quite well.
  1. Use OBS to construct the target scene, say, a chroma keyed webcam, with a video background, and a logo foreground, as well as a live chat overlay.
  2. In OBS, right click on the preview, and project it under a separate screen.
  3. In Webcamoid, choose that screen as the source.
  4. In Google Hangouts, choose Webcamoid's virtual cam instead of the real webcam.
  5. Voila! Now I have full control of what others see in my video conferencing.
This solution needs one whole screen just to link OBS and webcamoid. Any of the following improvement of either project will make this workflow even better:
Hopefully either will come soon.