skip to content
MusesΜοῦσαιdocs

playing / 05 of 15

YouTube

phonto asks yt-dlp for a YouTube video's stream, and plays that stream like any other.

shell
phonto "https://www.youtube.com/watch?v=VIDEO_ID"
phonto youtu.be/VIDEO_ID

phonto recognises links on youtube.com, www.youtube.com, m.youtube.com and youtu.be, with or without https://. Quote a link with a ? in it, or your shell may read it as a pattern. Live streams play too.

It needs yt-dlp on your PATH:

shell
# Arch Linux
sudo pacman -S yt-dlp
# Homebrew
brew install yt-dlp
# anywhere with Python
pip install yt-dlp

How it works

When phonto starts, it runs yt-dlp -g on the link, takes the first stream URL yt-dlp prints, and plays that. YouTube turns away GStreamer’s own user agent, so on Linux phonto sends a browser’s.

Quality

--yt-dlp-format goes to yt-dlp as its -f. Without it, yt-dlp picks, usually the best video it can find.

shell
# at most 1080p
phonto --yt-dlp-format "bestvideo[height<=1080]" youtu.be/VIDEO_ID
# the smallest stream, to save bandwidth
phonto --yt-dlp-format worst youtu.be/VIDEO_ID

Leave it unset for live streams. They don’t offer video-only formats, and a format like bestvideo finds nothing. yt-dlp’s format selection has the full syntax.

Signing in

YouTube sometimes blocks yt-dlp until it looks like a signed-in browser. --cookies-from-browser lends it your browser’s session:

shell
phonto --cookies-from-browser firefox youtu.be/VIDEO_ID

It takes any browser yt-dlp knows, like firefox, chrome or safari.

Other yt-dlp flags

--yt-dlp-args adds its value to yt-dlp’s command line, split on spaces:

shell
phonto --yt-dlp-args "--proxy socks5://127.0.0.1:9050" youtu.be/VIDEO_ID