Raspberry PI, Logitech c920 and WebRTC videocall: #fail

I had the idea to create a no-brain and enjoyable setup for my parents to videocall with me. I know I can use Skype, Hangouts or lot of similar apps on any PC / tablet, but for me no-brain and enjoyable means sit down on the living room couch, press a key somewhere, look at the big TV screen and start talking with me.

There are solutions like Chromebox for Meetings (hardware here and here) or the GT Mini 3330, but the price is too high for a whim like mine. After different iterations, I’ve figured out a solution, although final result is still not working for some reason. This post describes what I’ve done so far.

General architecture

TL;DR: A RasPI 2B connected to the TV, Logitech c920 webcam, WebRTC video call in a fullscreen Chromium tab.

An easy way to do bidirectional video call, nowadays, is to use dedicated apps like the before mentioned Skype, Hangouts, Ekiga or many others. But you often need a PC connected to the TV, you cannot automate the connection process, plus most solutions are using proprietary protocols. The alternative is to rely on the promises of WebRTC project and create a multi-party video chat. Nothing more than a browser and a camera is needed. Sounds good!

A Raspberry PI 2B model is powerful and cheap enough for running such setup and, connected to a TV screen via HDMI port, can use the TV for video and audio output.

As for the camera, I went for a Logitech c920. Why? Because it’s supported out of the box on Raspbian, works with fswebcam and it doesn’t need a powered USB hub, has a wide-angle lens very good for video calls, has a good directional microphone and can produce an hardware encoded FullHD H.264 video stream (it can be checked with v4l2-ctl –list-formats), with no additional computational overload on the RPi side. And it costs around 80 euros. Video quality is excellent and audio recored is loud and clean even if the speaker is 3 meters far from the camera: huge enough to cover the average distance between a couch and a TV :)
It may happen to see a rainbow square top right on the display while using the camera: it’s the under-voltage warning of the RPi, so connect it to a more powerful USB port, to an external USB power source or, as last resource, connect the camera to a powered USB hub.

Regarding the software, nothing more than a WebRTC-compatible browser, running on RPi, is required: IceWeasel and Chromium have it. To host the WebRTC call, there are plenty of solutions: AppRTC, Jitsi, OpenTokRTC, just to mention few, are online services that can be used to start a WebRTC video call. Source code is even available for OpenTok and AppRTC, to create a personal server.
Once selected the service, a script can open a fullscreen browser window pointing to the desired chat room url, once the RPi graphic environment starts, so the only action required is to power-up the Raspberry and wait to be connected. Bingo :)

Step-by-step config

Basic system
Downloaded NOOBS offline, formatted the SD card as one FAT32 partition using GParted,  and unzipped the NOOBS archive on SD card. Inserted the SD on the RPi and booted. Selected Raspbian Jessie, waited for the installation to finish. Alternative instruction for Linux here.

Run the usual sudo apt-get update, sudo apt dist-upgrade, sudo rpi-update commands triad

Browser
Regarding the browser to use… Well, it’s complicate.
As first try, I followed this guide that suggested to use Iceweasel. It was as simple as a sudo apt-get install iceweasel, but unfortunately vLine is not active anymore, with appRTC IceWeasel crashes and Jitsi.org doesn’t support Iceweasel < 40 (Jessie has v38 on the repo).
So I installed Chromium following this guide, using the precompiled armhf packages from Ubuntu Ports. But also this guide works, using packages in the Launchpad Librarian.

Why Chromium v45? Because v47 has a annoying bug that prevent a correct render of YouTube, appRTC and Jitsi, among the other.

Time to start my first WebRTC video call: I opened a Jitsi link to launch a test call on RasPI and my PC, authorised the website to use my mic and camera and I had both sides connected, audio and video working as expected. Wow moment, I’m an happy man!!!!

Unfortunately, after 30 to 60 secs, audio from the RasPI side stops working, and only the video is transmitted. I can see video from the RasPI side of the call, but I cannot hear the audio. Instead, on the TV screen, it’s possible to see and hear my stream. After tons of tests, I still don’t know why this is happening and how to solve it. Also a post on Raspberry PI forum isn’t helping. This is the biggest blocker I have right now :(