Streaming from Linux to a Chromecast

The Google Chromecast is an impressive little device. If you haven’t encountered one already, it’s a small HDMI dongle which, when connected to a TV screen, allows to play audio, video, or visual content of a compatible webapp from a computer or mobile device.

Google Chromecast
The first generation of the Google Chromecast (Model number H2G2-42 – Get it ?)

However, it is primarily designed to only stream content from the Web, and not from your computer itself, which follows the current trend that everything should be “in the cloud” and is infuriatingly limiting. As you can guess, that dubious ideology is not my cup of tea.

Luckily, the excellent library PyChromecast allows to control the device from a Python program. Yet the issue is that it only works for codecs the Chromecast is able to decode natively, i.e., H.264 and VP8. Besides, the Chromecast is only able to handle a few containers like MP4 and WebM. What if you want to stream other video formats ? Besides, what if you want to stream dynamically-generated content, for instance your screen or a live video from a camera ?

Introducing ffmpeg!

Continue reading Streaming from Linux to a Chromecast

A telepresence robot – Programming

In this article we are going to program the Telebot we have built in the previous article.

We will use WebRTC, which is the new standard for real-time communication in Web browsers, and take advantage of the necessary signaling channel to also transmit commands to move the robot.

General schematic of the whole control system
General schematic of the whole control system

Programming the robot actually consists of three different steps:

  • Writing Arduino-flavored C++ code for the Arduino-like controller to properly move and balance the robot
  • Building a specific Android application to handle a WebRTC session on the smartphone and relay commands to the controller via Bluetooth
  • Setting up a node.js server to serve an HTML5 control page over HTTPS allowing visioconference and remote control
The Telebot ready to be programmed
The Telebot ready to be programmed

Therefore, the project will be a mix of Arduino, Android Java, and Javascript (client-side and server-side). The source code is free software, licensed under BSD 2-clause license and GPLv3 (Arduino code). The complete source for the projet is available on my repository on GitHub.

Continue reading A telepresence robot – Programming

A telepresence robot – Building

Telepresence robots are pretty cool, so let’s build my own Telebot!

The telepresence robot allows visioconferencing while moving around
The telepresence robot allows visioconferencing while moving around

The robot will be built as a base with 4 wheels, on top of which a vertical pole allows to stick a smartphone. The smartphone, connected to the base via Bluetooth, will permit visioconference via WebRTC and remote control at the same time, allowing to move around. Even if the center of gravity is quite high, a gyroscope will prevent the robot from falling over. The base will be powered by lithium-polymer batteries and rechargeable via a USB connector.

The finished robot going around

This article covers building the robot, while the next article focuses on programming it.

Continue reading A telepresence robot – Building

A Minitel as a Linux terminal

The Minitel (from the French Médium Interactif par Numérisation d’Information TÉLéphonique) was an interactive videotex online service accessible through phone lines, operated in France from 1982 by the state-owned PTT (Postes, Télégraphes et Téléphones), the ancestor of France Télécom. The service was retired in 2012, after more than 30 years of existence. It might have been the world’s most successful early online service, before the World Wide Web era. It offered services like telephone directory, purchases, reservations, mail, and chat just like the Web offers today.

Minitel 1
The first version of the Minitel, made by Télic Alcatel. So 80s.

The Minitel, starting from model 1B, can be used as a VT100-compatible Linux terminal with the proper wiring. So let’s try…

Continue reading A Minitel as a Linux terminal

An ethernet Tor box

You are without doubt already familiar with the Tor project. The Tor browser is already a very handy tool to surf anonymously, but what if we had an entire network’s traffic forwarded through Tor via a special gateway? Let’s transform a tiny router in a transparent Tor proxy, a portable wifi access point redirecting all traffic to the Tor network!


Let’s begin with a short presentation of one of my favorite hackable network devices: the TL-MR3020.

The portable 3G/4G wireless N router TL-MR3020 from TP-Link
The portable 3G/4G wireless N router TL-MR3020 from TP-Link

Continue reading An ethernet Tor box

A small 3D-printed NAS

Network-Attached Storages (NAS) are very handy devices on a home network. They offer a simple way to share or synchronize files, and can host various useful services at the same time provided they are generic enough. A NAS being nothing more than a specialized file server, we will actually build a small home server than will be able to do anything.

The functions can be the following:

  • File server (FTP, NFS, SMB/CIFS…)
  • Streaming server (audio or video on the local network)
  • Personal web server (to host a website, synchonize contacts or send files to people)
  • Local seedbox (to download torrent files)
  • Domotic hub (for instance by adding a Zigbee USB dongle)

The server will be pretty simple in its technical design: a Raspberry Pi 2 model B with two hard disks connected with USB adapters.

The Raspberry Pi is actually not able to power the two drives over USB, since we would need 500mA per drive, so 1000mA overall, and the Pi can only supply 600mA over USB. There is a possible boot setting in /boot/config.txt called max_usb_current, which when set to 1 raises the maximum current intensity over USB to 1.2A, but since it is applied only during boot, our disks will still prevent the Pi to actually start properly. For this reason, we need a USB hub with a 2A adapter to power everything and connect the drives to the Pi. Backfeeding would be quite a bad idea, so the Pi needs to be connected to the hub twice, once as a device for power and once as the host.

In this kind of setup, always pay attention to use a genuine power adapter that will be able to handle the load, some really cheap adapters are rated 2A but might not be able to supply this current over a long period of time due to overheating.

I designed the case, front panel and lid with OpenSCAD to print them in 3D. You can download the SCAD source files and the corresponding STL files here (licensed under GPLv3).

3D models of the case, the front panel and the lid generated with OpenSCAD
3D models of the case, the front panel and the lid generated with OpenSCAD

Continue reading A small 3D-printed NAS

A smart VPN gateway

My network setup at home is surprisingly pretty common: a DSL modem (VDSL2 actually) followed by a router featuring an ethernet switch and an 802.11n wifi access point, configured as a NAT gateway.

My home network setup before modifications
My home network setup. Nothing fancy here.

Let’s imagine I’m in a country that doesn’t care about the right to private life of its citizens and performs automated mass surveillance, on the pretext of fighting against terrorism or copyright infringement. A gloomy perspective for sure, but let’s keep that as our work hypothesis.

Of course, I could just set up on every computer a VPN whose gateway happens to be in a foreign and more respectful country. However, multiple VPNs on multiple computers are a highly impractical setup for various reasons:

  • VPN configuration has to be done multiple times, and I’m allergic to repetitive tasks
  • The maximum number of concurrent connections is restricted by VPN service providers
  • Access to resources on a local network at the same time is a hassle and need specific configuration, like DNS settings

So, why not install the VPN once and for all in a privacy-enhancing gateway? We will implement it in a clean, IPv6-compatible manner so we even have public addresses working on the hosts.

Our goal is to get a smart gateway behaving as follows:

  • Outgoing connections are routed through the VPN. We have to use Network Address Translation since the VPN provider only attributed us one IPv4 address and one IPv6 address.
  • Incoming connections are routed normally to the LAN, so we get IPv4 port forwarding and working IPv6 public addresses.
Packet streams inside the smart gateway
Routing inside the gateway: outgoing connections through VPN

Continue reading A smart VPN gateway