yt-dlp + mpv: the best combination to watch YouTube videos without downloading them and away from the browser

yt-dlp with MPV

It's been a while since i wrote an article explaining the basis to be able to use yt-dlp, which is the successor of the famous and now discontinued youtube-dl. The truth is that it works very well and I no longer use anything else even if they have prettier interfaces. It does what I expect and has me covered. I've even been using it to watch videos from websites that don't work if I have third-party cookie blocking enabled, but there's something better.

The issue would be more or less like this: I go to a page that asks me to have all cookies activated to function correctly, I read a news item that has a video and that video does not work, I use yt-dlp, which can even download the videos of these types of links, and when it ends I watch the video and delete it. As I explained, there is something better, and that is to use yt-dlp in combination with MPV, an all-terrain player that is the basis for many others such as KDE's Haruna.

How to use yt-dlp in combination with MPV

The secret is to learn a command, or create a script to make things easier. The command would be like this:

yt-dlp -o - "LINK" | mpv -

From the above:

  • yt-dlp It is the main program that will start everything.
  • -o indicates the output that is enclosed in dashes (-). To be more specific, it causes it to be sent to stdout, standard output, and not saved to the hard drive.
  • "LINK", which has to be enclosed in quotes, will be the link.
  • mPV It will be the player where we want to see the content.

After pressing Enter, it will start downloading. We will see many errors and warnings, but also the video.

As in his day with the web applications, we can also create a bash script to automate it, but in this case it will be much shorter and simpler. It would look like this:

#!/bin/bash echo "YTB Enter link to multimedia content:" read link echo "Which player do you want to use?:" read yt-dlp player -o - "$link" | $player -

From the above, the first line is just a name, then it asks for the input of a link, a player and finally launches the command, which this way we won't have to remember. To open it we can use ./file-name that we have used after giving it execution permissions. It is a simple script that does not handle errors. Due to its simplicity, if the wrong link or player is entered it will show an error and end.

This can also be used to watch any YouTube video without downloading it, and for any use that one can imagine as long as what you intend is to use yt-dlp together with another compatible player – VLC is compatible, but it is worse – without downloading the content .


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.