I’ve only started using it but there is no turning back: mpv, a command line multimedia player, is a much better player than any of the more fancy ones I’ve ever used, on any platform. Not only is it good for video, but for audio too. It lets me precisely control the speed of the video/audio, precisely navigate within the video/audio or in a list ot those (it can be used to manage playlists, even on-the-fly lists). I can tell mpv to remember the positon of any file I pause or close, until next time. And so on, and all of that without ever leaving my fingers from the keyboard. Also, mpv is fast and it’s small.

What’s not to like about it? Oh, yeah, it doesn’t sport a pretty UI. like I said, it’s a command line tool: it’s not pretty, but it’s efficient and focused. And, coupled with newsboat, a command line RSS reader, and yt-download, a command line to deal with YouTube video, it’s one of the best findings I’ve made since I’ve started using Linux. And I’ve barely scratched their surface…

What’s even better is that mpv makes it simple to listen to the audio-only of any video file, including YouTube. Great, but why would anyone want do that? I don’t know, maybe…

  • One just want to listen to the speaker, not watch him, because there is not that much to watch or because, one having a really bad eyesight, one needs to let his eyes rest?
  • One doesn’t want to stress the computer with a huge video? Playing an audio feed is much easier on the CPU than decoding h.264 video. Using less CPU means having a longer battery-life, generating less heat and less (fan) noise.
  • One has a huge collection of video clips and, sometimes, one doesn’t feel like watching the video, just playing the music?
  • No matter the reason, what’s great is to be able to do it if you want to.

Am I crazy? Using a command line to watch a video? Or to listen to audio? It seems stupid, and so complicated. It is not. Maybe it’s unusual — it was, for me — but who cares if it works well?

Here, I’ve opened the YouTube feed “François Bon” in newsboat. François is a French author, a writing teacher, and a translator that publishes a lot of videos related to writing and publishing. He is also a passionate translator of Lovecraft’s work. Next to his books, he shares quite a lot of his translations online, reading them on YouTube. Imo, his translations are amongs the few that succeed in creating a convincing French version of Lovecraft’s oddities, his sophisticated style and the way he constructs his sentences, using specific vocabulary, grammar and punctuation, to create tension and give rhythm to his stories and to his otherwise often insignificant characters.

Back to newsboat and mpv. Here, the ‘detailed’ page of François reading his Dagon (original page). Note the link, that’s what I will send in an instant to mpv.

  • If I want to watch the video, like I would do on YouTube but without all the distractions, I just press , (coma), the shortcut that tells newsboat I want to run a macro, followed by y, the shortcut I defined for the macro that plays YouTube directly in mpv.
  • If I want to listen to the audio only, I just need to press , followed by a.

And Bam! A mere second later (I have a fast Internet) I can enjoy the voice and/or the video, within mpv while benefiting of its many useful keyboard shortcuts while completely avoiding YouTube’s bloated pages.

Not much to see, but a lot to listen to, with a lot of controls and few distractions ;)

Create the macros

For this to work, you will need to have installed those three command line tools:

  • Newsboat (RSS reader)
  • mpv (player)
  • youtube-dl (download youtube content, and more: read its doc)

They’re all in Manjaro’s official repo. Also, I will not explain how to add YouTube feeds to newsboat: let me know if you want more info.

  1. Open newsboat configuration file, it’s in ~/.config/newsboat/config.
  2. Add these lines, each on a single line. Save. It’s done, you have two new macros.

macro y set browser "mpv %u"; open-in-browser ; set browser "elinks %u"

macro a set browser "mpv --no-video %u"; open-in-browser ; set browser "elinks %u"

I stole the “--no-video” parameter from this guy.

Launch newsboat, find some content you want to watch or listen to. Here, François reading his Dagon, in the same mpv player but with the video (the window can be resized or be played in full screen) ;)

Limit video resolution

Dowloading 4k video or more may not be the best idea if your hardware is not the most recent or powerful one, or if you don’t have a great connection. Alas, by default, mpv will always try to grab the best format available (eg. 4K, or more), no matter what.

If you want to limit its greed, you can add this line to its config file, in ~/.config/mpv/mpv.conf:

ytdl-format=bestvideo[height<=?1080][fps<=?30][vcodec!=?vp9]+bestaudio/best

This tells mpv to only grab the best format available up to 1080p max. The fps parameter, next to it, limits the frame rate to 30, which should be more than enough and will also drasticaly reduce the bandwidth. If you want to grab an even smaller 720p video feed, replace 1080 by 720.

I found the solution here.

More info