Turn your Raspberry Pi into a Smart TV

Sam Berry
The Startup
Published in
4 min readDec 21, 2020

A wireless solution for casting Spotify, YouTube, and more, to the Raspberry Pi

Smart TVs are great and all, but they’re often pricey, clunky, and the more budget ones tend to be limited in functionality.

Wouldn’t a Raspberry Pi be a perfect alternative to an expensive, limited, Smart TV device, with its low power consumption, HDMI capability, wireless abilities, and ultimately unlimited potential?

Well, it turns out — yes! It is the perfect alternative. Read on to find out how your Pi can stand in as a wireless media streaming centre.

For this project we will utilize a few pre-existing tools that allow us to wirelessly stream music, video files, photos, YouTube videos, and more.

Part 1 —Raspotify

Perhaps the easiest to set up, and definitely my most used feature, Raspotify allows you to stream music from Spotify to your Raspberry Pi over Wi-Fi.

To install simply paste:

curl -sL https://dtcooper.github.io/raspotify/install.sh | sh

That’s it — next time you reboot you’ll find a Raspotify device on your Spotify connect list, as pictured below

Image courtesy of pimylifeup

Part 2 — Raspicast

Raspicast allows android users to cast YouTube videos, video files, stream URLs, and more to their Raspberry Pis with speed.

Not much software is required on the Pi, which is a plus, but an extra app is needed on the phone, and the casting isn’t directly from the YouTube app, unlike with some Smart TVs.

Firstly, there are some packages required before omxiv, the media player for this solution, can be installed. Install them with the following command:

sudo apt-get install libjpeg8-dev libpng12-dev

Now we install omxiv.

git clone https://github.com/HaarigerHarald/omxiv
cd omxiv
make ilclient
make -j4
sudo make install

Make sure SSH is enabled. You can do this by typing: sudo raspi-config, navigating to 5-Interfacing Options, then P2 SSH, and finally selecting YES.

You will need to know your hostname, which in most cases is raspberrypi, and your username and password.

Download the “Raspicast” app on Google Play

On launching the app, you’ll be prompted with an SSH settings dialogue.

you can leave public key authentication unchecked

Enter your details, and you’ll be ready to go.

On the YouTube app, and other media apps, you can press the share button, and there will be a “Cast (Raspicast)” option, which sends off the video to be played on the Pi.

Part 3 — Gotubecast

This has similar functionality to Raspicast, but for me, it performed worse and loaded videos slower, but on the other hand it is much better integrated and works more platforms due to the YouTube cast button compatibility that it brings.

This one is a tricky one to install since there are lots of steps, but no worries, there’s an installer script that you can use.

Clone the viamybox repo. This is the script that does the installation for you.

git clone https://github.com/viatc/viamybox.git

Run the setup script.

sudo /home/pi/viamybox/scripts/via-setup.sh

You’ll be presented with something like this:

Type 3, and press enter, and you’ll see this menu:

Type 3 again, and press 1 to install.

After the installation you’ll see a new menu like the one below.

First, you need to generate a Screen ID (option 4). Once you’ve generated a Screen ID, you should choose option 2 to start gotubecast. You’ll be given a pairing code on the main menu.

On the YouTube mobile app, go to settings/Watch on TV, and press “Enter TV Code”. Type the pairing code displayed on your Raspberry Pi, and you’ll find that you are paired to your Pi, and any video you play can be seen on the HDMI display connected to your Pi.

Finally, I recommend entering option 3 so that gotubecast starts on boot.

That’s all for this article. If you have any problems get in touch, and I’ll try my best to help you.

I truly hope this was helpful. If it was, please consider giving some claps or a follow.

--

--