mpv – Display YouTube Link Name When Playing Audio

mpvyoutube-dl

When playing just the audio from a youtube link, you have some thing like this:

mpv '<youtube_link>' --no-video

and when the song starts to play you have this on the terminal:

AO: [pulse] 44100Hz stereo 2ch float
A: 00:00:40 / 00:31:39 (2%) Cache: 10s+16498KB

or something similar.

Is there a way to display the link name (the name of the link being played)?

When you just play a normal video, the name is at the top of the window, and above the controls.

Best Answer

I have a script that I use just for exactly that purpose. It looks as follows:

#!/bin/sh
if [[ "x$1" == "x" ]]; then
  echo "Usage: mpvy <URL>"
else
  title=`youtube-dl --skip-download --get-title $1`
  mpv --no-video --term-playing-msg "### $title ###" $1
fi

If you are already using mpv to watch/listen to youtube clips then you should have youtube-dl installed since it is what mpv uses to download the youtube clip.

It is a little rough of a solution (e.g. does not work with several links at once) but serves its purpose. And can be easily extended using a for loop.

Related Question