ytcast lets you cast YouTube videos to your TV using the command line

The ability to wirelessly cast the screen of a smartphone to other devices like a TV is not that difficult these days. In fact, when it comes to streaming a YouTube video from your phone or tablet to your Smart TV, the small icon takes care of everything from device discovery to seamless context switching. But if you are a command line lover, you might want to see behind the curtain and take control of the whole streaming routine via CLI. This is exactly what Marco Lucidi did and came up with a handy tool called ytcast.

What is ytcast?

Marco, a self-proclaimed twenties computer enthusiastwho bears the pseudonym MarcoLucidi01 on GitHub, coded the ytcast utility as a standalone replacement for the cast button. According to the developer, anyone can use the program to replicate the functionality of the “Play on TV” button directly from the command line interface. It’s written in Go and you can run it on Windows, Linux, and macOS.

How ytcast works

Under the hood, ytcast uses the DIAL (Discovery And Launch) protocol developed by Netflix and Google to handle device discovery and app launch events. For targets that no longer use the DIAL protocol (e.g. Chromecast), the program also offers a manual pairing option powered by the “link with code” feature of the YouTube on TV app. Next comes the screen identification part, for which the developer relied on the reverse-engineered YouTube Lounge API. Finally, it passes the video URL from the source device to the target screen.

Limits

As the project is still in its infancy, there are some shortcomings. Session management is sometimes unreliable, especially due to the use of undocumented APIs. The developer has yet to find a reliable way to pass YouTube playlist URLs through ytcast, but there is a workaround that involves the youtube-dl executable. Last but not least, you may not find ytcast in the Settings > Paired devices menu.

Needless to say, the ytcast project is incredibly useful for power users. There’s a ton of potential, and we have to remember that this is clearly beta-quality software at this point. Once it hits the stable milestone, it might be the best casting option for anyone who loves scripting and automation.

Download ytcast

You can get started with ytcast by visiting the GitHub repository of the project. There are pre-compiled binaries hosted in the “Releases” section. Be sure to provide feedback to help Marco refine this program.

Download ytcast

Shirley K. Rosa