Encoder for HDMI capture card to view it on Alexa Echo Show and mobile devices

Este artículo se puede leer en castellano aquí

This project, which is dual-purpose, involves two different Alexa skills, which I’ve named “screen control” and “the screen,” one of which is hosted on Amazon’s own servers, written in Node.js, and the other, written in Python, is hosted on my Raspberry Pi.

On the other hand, it also involves a Telegram bot, written in Python, hosted on my Raspberry Pi.

Taking a look at the wiring part, I had to purchase an HDMI splitter like this one:


And an HDMI capture card like this one:


This way, it is possible to connect a TV decoder to both the TV and the HDMI capture card.

The code for the “the screen” skill can be observed here, and simply upon the command, “Alexa, open the screen,” it opens a video player pointing to the specified URL. As a note, it is CRITICAL that this URL be HTTPS, which is achieved through appropriate nginx configuration, a dynamic DDNS name, and Letsencrypt to sign the necessary certificates.

The “screen control” skill, on the other hand, uses an HTTP-based API, similar to the one used in this project, to control what the encoder is playing and, through voice commands, change to the desired channel.

It also runs the command:

ffmpeg -f video4linux2 -input_format yuyv422 -s 1280×720 -i /dev/video2 -f alsa -i plughw:CARD=UHD,DEV=0 -vcodec h264_omx -b:v 2M -c:a aac -b:a 64k -f mpegts -loglevel error -filter:v fps=30 – | /usr/bin/vlc -I dummy – –sout “#duplicate{dst=std{access=http,mux=mkv,dst=:8950/stream}}”

To encode the captured video in a codec and resolution suitable for the Alexa Echo Show at the URL, finally, nginx converts this loopback URL into a public URL under HTTPS.

The Telegram bot is used to provide convenient interaction, also making use of the HTTP API to control what the encoder is playing and offering three different video qualities to choose from, suitable for desired data consumption or available bandwidth at that moment.


Leave a Reply

Your email address will not be published. Required fields are marked *