When it comes to download play YouTube videos, there are many CLI and GUI applications available, such as ClipGrab, Streamlink, NewPipe and Youtube-dl etc. Today, we are going to learn yet another command line YouTube Player and downloader named Mps-youtube. It is a commandline program based on mps, which is also a command line program used to search, stream and download music. Using mps-youtube, we can easily search, play and download Youtube videos from commandline. It needs Mplayer or mpv to play videos. It is a free, open source program written using Python. It supports Linux, Mac OS X, and Windows.
Table of Contents
Key features of mps-youtube
Concerning about the features of mps-youtube application, we can list the following:
- Search and play audio/video from YouTube.
- Search tracks of albums by album title.
- Search and import YouTube playlists.
- Create and save local playlists.
- Download audio/video.
- Convert to mp3 and other formats (requires ffmpeg or avconv).
- View video comments.
- Free and open source.
Mps-youtube - A Commandline Youtube Player And Downloader
Installing Mps-youtube
First, make sure you have installed the required dependencies:
- mplayer: Alternative to mpv for playback
- ffmpeg: for transcoding downloaded content
All of these packages are available in the official repositories of most Linux distribution.
Mps-youtube is available in the default repositories of some Linux distributions.
To install mps-youtube along with all required dependencies on Arch Linux and derivatives, run:
$ sudo pacman -S mps-youtube mplayer ffmpeg
On Debian, Ubuntu, linux Mint:
$ sudo apt-get install mps-youtube mplayer ffmpeg
Mps-youtube can also be installed using pip3, a python package manager. Make sure you have installed pip3. It is available in the default repositories as well. So, you can install it using your distribution's package manager.
For instance, pip3 can be installed using the following command in Debian, Ubuntu and other DEB based systems.
$ sudo apt-get install python3-pip
You can install mps-youtube using pip3 like below.
$ sudo pip3 install mps-youtube
Don't forget to install other required dependencies Mplayer and FFMpeg.
Configure Mps-youtube
Once installed, you can launch mps-youtube using command:
$ mpsyt
The above command will take you to the mps-youtube console window. Here is how mps-youtube console looks like.
Before going further, we need to do some necessary configurations.
By default mps-youtube will search for videos in the music category. To change this to all categories, enter the following command in mps-youtube console:
$ set search_music false
After the successful execution of the above command, you will see the following output:
Also, mps-youtube is set to play audio only by default. To view video output, enter the following command in the mps-youtube console:
$ set show_video true
Now, it is time to see how to use mps-youtube application to play your videos and/or download them.
Searching Youtube videos
To search for a video, use / or . followed by your search term. For instance, to search for the youtube video "see you again", type the following in mps-youtube console.
$ /see you again
After entering the above command, you will see the list of youtube videos based on your search term:
As you see above, the results are displayed with serial number.
To go back and forth through search results, you can type "n" (for next video) or "p" (for previous video).
Playing videos
To play any video from the list just type its serial number and hit ENTER key. The video will play in the default player.
To adjust volume, use 9 and 0. Press Spacebar to pause the video. To seek, use left/right and up/down arrows. To exit the video, press q.
Viewing information about a video
To view the information of a specific video, say 1st video, type "i" followed by the serial number in the mps-youtube console window.
$ i 1
To go back, press ENTER key.
Viewing the comments of a video
To view the comments of a youtube video, type c followed by the specific video serial number.
$ c 1
Downloading videos
To download a video from the list, type d followed the serial number in the mps-youtube console.
$ d 1
This command will display the list of available formats. Choose any format to download by entering the respective number.
The downloaded files will stored in /home/user/Downloads/mps/ directory.
Show related videos
To view the similar videos type "r" followed by the video number.
$ r 1
Show videos by uploader
To show videos uploaded by uploader of a video, use "u" followed by number.
$ u 1
Copying URL to clipboard
To copy the URL of a video to clipboard, use "x" followed by the video number. Make sure you have installed python-pyperclip package.
$ x 1
Exit from Mps-youtube
To exit mps-youtube application, simply type q in the console.
Viewing help
To view the help topics, just type "h".
Resource:
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Reddit | Facebook | Twitter | LinkedIn | RSS feeds
Have a Good day!!
9 comments
This looks very promising! I am super excited to check it out for a retro project that I am working on.
Running into an issue. Attempting to invoke playing a video from url and used the syntax described in the help menu: mpsyt playurl https://www.youtube.com/ however I receive error bad syntax………….
Are you sure Mps-youtube is available in the default repositories of some Linux distributions, for example Debian? I’ve searched it and it is not!
Yes, it is available. https://packages.debian.org/search?keywords=mps-youtube https://pkgs.org/download/mps-youtube
I have both python3 and 2.7 installed and python calls the 2.7. when I try mpsyt I get a bunch of python errors that look like coming from mpsyt expecting python3 but getting 2.7. what is the way to make mpsyt call python3?
Try setting up Python3 as the default version. The update-alternatives command will help to switch between versions. I have documented the steps to switch between PHP in this article -> https://ostechnix.com/how-to-switch-between-multiple-php-versions-in-ubuntu/. I guess you can set Puthon3 as default by following the same steps.
it says no alternatives for python. I know I can do it by using conda environments, but was trying to avoid installing conda which is huge.
I get invalid laod key with python 3:
$ mpsyt
Traceback (most recent call last):
File “/usr/bin/mpsyt”, line 11, in
load_entry_point(‘mps-youtube==0.2.8’, ‘console_scripts’, ‘mpsyt’)()
File “/usr/lib/python3/dist-packages/pkg_resources/__init__.py”, line 489, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
File “/usr/lib/python3/dist-packages/pkg_resources/__init__.py”, line 2793, in load_entry_point
return ep.load()
File “/usr/lib/python3/dist-packages/pkg_resources/__init__.py”, line 2411, in load
return self.resolve()
File “/usr/lib/python3/dist-packages/pkg_resources/__init__.py”, line 2417, in resolve
module = __import__(self.module_name, fromlist=[‘__name__’], level=0)
File “/usr/lib/python3/dist-packages/mps_youtube/__init__.py”, line 8, in
init.init()
File “/usr/lib/python3/dist-packages/mps_youtube/init.py”, line 55, in init
config.load()
File “/usr/lib/python3/dist-packages/mps_youtube/config.py”, line 382, in load
saved_config = pickle.load(cf)
_pickle.UnpicklingError: invalid load key, ‘m’.
Hi, can you uninstall the current version and reinstall mps-youtube again? Try installing it with pip3, so it will automatically call and use Python 3.